4
我想用两种语言,法语和英语翻译我的rails应用程序,但遇到了一些问题。我有以下错误:Rails i18n:“fr”不是有效的语言环境
"fr" is not a valid locale
在我的config/application.rb中:
I18n.enforce_available_locales = false
I18n.config.available_locales = :fr
config.i18n.default_locale = :en
而在我的控制,我收到的语言环境中的参数:
I18n.locale = export_params[:lang] || I18n.default_locale
我对于语言环境“en”没有任何问题。我的应用翻译得很好,但是当我使用与“en”不同的参数时,出现此错误消息。
我使用的Rails 4.2.0
你需要在'config/locales /'中为'fr'提供配置,就像'en.yml' – ImranNaqvi
给出的那样。我的翻译有一个config/locales/fr.yml,但它不起作用... –