Translation key escape suggestion

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs