Forum: Rails I18n Translation key escape suggestion

Posted by ginger72 (Guest)
on 2010-03-09 16:19
(Received via mailing list)
Hi,

while working on globalize_bridge, a plugin that is supposed to
provide a seamless migration path to I18n from Globalize1, I
discovered what might be a useful feature in future versions of I18n.

My app uses translations (mind I am using Globalize1) and therefore
keys can look like this: "Cat. Or Dog.", which, by default, is not
picked up correctly by I18n, e.g.:

de:
  "Cat. Or Dog.": "Katze oder Hund...outside namespace."
  namespace:
    "Cat. Or Dog.": "Katze oder Hund...within namespace."

Reason being, the default separator (I18n.default_separator) is set to
".", therefore, normalize_keys (or normalize_translation_keys) is not
parsing key parameters correctly.

So I overloaded I18.normalize_keys to parse translations defined like
this:

I18n.t 'namespace."Cat. Or Dog."'  -> "Katze oder Hund...within
namespace."
I18n.t "Cat. Or Dog." -> "Katze oder Hund...outside namespace."


What are your thoughts?

Greetings,
Juergen
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.