Rails I18n: How do I set a fallback locale?
I am on Rails 4
and I am following how to use rails i18n fallback features
My site only has 2 lang, zh
and en
, and I want another language, for example de
, fr
to fall back to en
, so I installed as suggested above:
config.i18n.fallbacks =[:en]
But when I visit http://localhost:3000/?locale=de
, he still reports
"de" is not a valid locale
. ( locale
for en
and zh
works great)
How can I fix this?
UPDATE: this is how I get locale
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
source to share