Rails的语言环境回退不适用于生产环境

Sam*_*ong 3 fallback locale ruby-on-rails rails-i18n

我有一个Rails 3.2应用程序。它有2个语言环境ko&en。ko是默认设置,但是如果不可用,我希望它回退到en。后备功能在开发环境中有效,而在生产环境中无效。

[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.localt #=> :ko
I18n.t("ttt") #=> "TTT" (Works fine)


**In production console:**

I18n.locale #=> :ko
I18n.t("ttt") #=> "translation missing: ko.ttt" (Not working)
Run Code Online (Sandbox Code Playgroud)

我想念什么?

谢谢。

山姆

Jua*_*nda 6

如果您config.i18n.fallbacks = true生产 / 暂存环境中将其注释掉,它将按预期工作。