I am working on this plugin I am calling globalize_bridge. It is meant
to provide a seamless migration path for rails apps using Globalize
(1) and utilizing the built in rails I18n mechanism. I am pretty much
done covering the entire scope of mapping the Globalize API, however,
only Globalize namespaces still make me scratch my head.
The problem is: with a translation string “Foo. And Bar.”.t,
containing periods, the “.” is mistaken for the scope separator.
Luckily, later versions of the I18n gem have the scope_separator
directive, to support gettext, etc. So this come handy for Globalize1
usage, however, Globalize also had the concept of namespaces (~ I18n
scopes), and it would be a shame if we could port the namespaces over.
Here is an example:
“Foo. And Bar.”.tn(:my_namespace) # Globalize1 syntax
translates into this
I18n.t “Foo. And Bar.”, :separator => “\001”, :scope => :my_namespace
So this does not pick up the correct translation and ignores the scope
I was looking for a seamless solution. However, the only workaround I
can think of is to define a secondary separator e.g. :separator => “|”
tweak my translations yml/db.
Anyone having a better idea?