Search code examples
ruby-on-railslocalefallbackrails-i18n

Rails locale fallbacks are not working in production env


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?


Solution

  • If you comment out config.i18n.fallbacks = true in your production / staging environments it works as expected.