Rails i18n: "fr" is not a valid language

I would like to translate the rails app into two languages: French and English, but you are having problems. I have the following error:

"fr" is not a valid locale 

In my config / application.rb:

 I18n.enforce_available_locales = false I18n.config.available_locales = :fr config.i18n.default_locale = :en 

And in my controller, I get the locale in the parameters:

 I18n.locale = export_params[:lang] || I18n.default_locale 

I have no problem with locale "en". My application is well translated, but I have this error message when I use a parameter other than "en".

I am using Rails 4.2.0

+5
source share
1 answer

OK, it works. I just need to restart the server.

+5
source

Source: https://habr.com/ru/post/1236355/


All Articles