Ruby on rails 在Heroku上配置I18n回退
我已经尽了一切努力让i18n在Heroku上后退,但我做不到。 我不想得到“翻译丢失的信息”。它在开发模式下工作正常 请帮忙 谢谢Ruby on rails 在Heroku上配置I18n回退,ruby-on-rails,ruby-on-rails-3,heroku,internationalization,i18n-gem,Ruby On Rails,Ruby On Rails 3,Heroku,Internationalization,I18n Gem,我已经尽了一切努力让i18n在Heroku上后退,但我做不到。 我不想得到“翻译丢失的信息”。它在开发模式下工作正常 请帮忙 谢谢 require "i18n/backend/fallbacks" I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) I18n.fallbacks.map(:es => [:en]) config.i18n.fallbacks = true 在config/environments/p
require "i18n/backend/fallbacks"
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
I18n.fallbacks.map(:es => [:en])
config.i18n.fallbacks = true
在config/environments/production.rb中
class Appname::Application.configure do
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
end
我的application.rb文件中有:
config.i18n.fallbacks = [:en]
我刚刚在production.rb中注释了这段代码:
config.i18n.fallbacks = true
在heroku中,它工作正常。据我所知,要使用回退,必须将默认值传递给I18n。看见如果找不到任何值,它将显示“翻译缺失消息”。太好了!注释
config.i18n.fallbacks=true
帮助!