Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails i18n : "fr" is not a valid locale

I would like to translate my rails application in two languages, french and english but got some problem. I've got 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 receive the locale in parameters:

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

I don't have any problem with the locale "en". My app is well translated but I've this error message when I use a different parameter than "en".

I use Rails 4.2.0

like image 435
Jean Creuzé des Châtelliers Avatar asked Nov 19 '15 17:11

Jean Creuzé des Châtelliers


2 Answers

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

like image 152
Jean Creuzé des Châtelliers Avatar answered Nov 12 '22 19:11

Jean Creuzé des Châtelliers


Check at your application.rb if config.i18n.available_locales = :en is set to your language and also check inside config/locales if you already heave your language.yml created there.

After all don't forget to reset your server

regards

like image 3
Nicollas Avatar answered Nov 12 '22 21:11

Nicollas