Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i18n for rails works in dev not in production

The i18n is configured in the rails 3.0.3 project :

config.i18n.default_locale = :fr

In my dev environnement, everything works fine with price in € and text (like next previous from will_paginate) correctly displayed.

In production environnement, everything is in english and in $.

Where can i found the problem of my i18n ?

What am I missing in i18n in production?

More Info:

On the production server in the rails console production :

irb(main):002:0> I18n.config.default_locale
=> :fr

2Nd Edit

Is there a way to display I18n properties or config in a debug or in a view?

like image 392
Syl Avatar asked Dec 02 '11 18:12

Syl


2 Answers

I think this is related to this bug: http://groups.google.com/group/rubyonrails-core/browse_thread/thread/1fe3e88f9fe73177/ .

18n.locale is called before the config.i18n.default_locale is propagated to the I18n class.

I will try to also change it in config/initializers/locale.rb. According to 2.2 Optional: Custom I18n Configuration Setup in http://guides.rubyonrails.org/i18n.html, you should also change it in config/initializers/locale.rb . Hope this will fix it for you.

like image 81
DrChanimal Avatar answered Oct 19 '22 22:10

DrChanimal


Resolved by adding config.i18n.locale = :fr in addition of the default config.i18n.default_locale = :fr in my application.rb

like image 29
Sidhannowe Avatar answered Oct 19 '22 23:10

Sidhannowe