Setting Up Fallback Locale(s) in Rails 3
I18n(internationalization) and l10n(localization) are topics that are covered superbly by the Rails Guides. The one thing that’s left out is the setup of fallback locales in case something is missing in the currently selected locale (and mark my words - something probably is). Therefore I’m writing this post.
Ideally we’d have i18n-ed and localized everything perfectly, but
that’s rarely the case. I’d rather have the users see things from
another locale than error messages. So how do we do that in Rails 3?
It’s pretty simple actually. There are three fallback options we can
select and they all require small changes to the
- fallback to the default locale
- fallback to a specified locale
- specify a fallback map (different fallback locales for different locales)
1 2 3
Well, that’s the gist of it. Happy coding!