This fallback functionality was discussed substantially in Globalize
last year -I was a big proponent.  It is very much needed for real-
word apps.  However, I would suggest a three (or four) level hierarchy
of preference:

In decreasing order of preference:

1. The specified language (fr-CA in this example)
2. The related "generic" language (fr)
3. Any related "sister" language (fr-FR or fr-CH)
4. The overall default language (en-US)

I like looking at the "fallback" concept this way as it encompasses
the existing default language of the app as well.  And including
"sister" languages means that an app that already has en-US
translations can support en-GB (and such) with no difficulty.

-Chris


On Jan 13, 10:11 pm, Kip <[email protected]> wrote:
> I've uploaded a small rails plugin that changes the behaviour of
> I18N#translate which attempt to lookup a translation in a broader
> locale if the current translation fails. The idea is to be able to
> maintain only small localization files for regional differences (where
> appropriate).  Example:  the differences between en-US, en-UK, en-CA,
> en-AU are miniscule.  Duplicating then maintaining the content is not
> much fun.
>
> With this plugin, I18N#translate will do the folllowing:
>
> 1.  Lookup in the current locale (or the one supplied in options to
> #translate)
> 2.  If not found, look in the broader locale if one exists.
>
> If our locale is "en-UK", look first in "en-UK", then in "en" (which,
> for english speakers, is helpful since Rails supplies defaults for
> this locale).
>
> Git repository is 
> at:http://github.com/kipcole9/rails-i18n-translation-inheritance-helper/...
>
> Cheers, --Kip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"rails-i18n" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-i18n?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to