I have a rails 3.2 application. It has 2 locales ko & en. ko is the default but I want it to fallback to en if it's not available. The fallback works in development env but not in production env.
[config/application.rb]
config.i18n.default_locale = :ko
config.i18n.fallbacks = [:en]
[config/environments/production.rb]
config.i18n.fallbacks = true
[config/locales/en.yml]
ttt: TTT
[config/locales/ko.yml]
(ttt is not defined)
**In development console:**
I18n.locale #=> :ko
I18n.t("ttt") #=> "TTT" (Works fine)
**In production console:**
I18n.locale #=> :ko
I18n.t("ttt") #=> "translation missing: ko.ttt" (Not working)
What am I missing?
If you comment out config.i18n.fallbacks = true
in your production / staging environments it works as expected.
Even if this question/answer is quite old, I will let here what I found for my case (Rails 5.X). The settings should look like this in application.rb
config.i18n.default_locale = :en
config.i18n.available_locales = %i(en de)
config.i18n.fallbacks = {
de: :en
}
And with that, all the references to config.i18n.fallbacks = true
should be removed from the different environments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With