Rails 3: I18n.locale not set to I18n.default_locale in production

I have an application that uses I18n, but in the first deployment, I
don’t want to enable different languages per user/request because
there are very few users who all speak german).
Therefore I have config.i18n.default_locale = :de in config/
application.rb.
I have no code whatsoever to set/change I18n.locale in my app.

In development environment, it works as expected: the application is
in german:
$ rails c
Loading development environment (Rails 3.0.0.rc)

I18n.default_locale
=> :de

I18n.locale
=> :de

But in production, the application is in english, although
default_locale is correctly set:
$ RAILS_ENV=production rails c
Loading production environment (Rails 3.0.0.rc)

I18n.default_locale
=> :de

I18n.locale
=> :en

Does anyone have an idea what might cause this, or how to change?
I have a completely unchanged config/environments/production.rb, but I
also tested with
config.i18n.fallbacks = false
with no change.

Rainer

Some system information:

I18n gem is version 0.4.1. Ruby is:
ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
but it is exactly the same on 1.9.2 p0.

FWIW:
Mac OS X 10.6.4, although the language of my account is English, I get
the following:
$ locale
LANG=“de_DE.UTF-8”
LC_COLLATE=“de_DE.UTF-8”
LC_CTYPE=“de_DE.UTF-8”
LC_MESSAGES=“de_DE.UTF-8”
LC_MONETARY=“de_DE.UTF-8”
LC_NUMERIC=“de_DE.UTF-8”
LC_TIME=“de_DE.UTF-8”
LC_ALL=

But I get the same behavior on Debian 5, with LANG=en_US.UTF-8

This has most likely to do with a problem which was posted to the core
mailing list here:
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/1fe3e88f9fe73177/

The culprit seems to be: I18n.locale is set to some value, if models
include a module that
requires some other files. Thus I18n.default_locale is no longer
relevant.

Rainer

rainerfrey wrote in post #935581:

This has most likely to do with a problem which was posted to the core
mailing list here:

http://groups.google.com/group/rubyonrails-core/browse_thread/thread/1fe3e88f9fe73177/

The culprit seems to be: I18n.locale is set to some value, if models
include a module that
requires some other files. Thus I18n.default_locale is no longer
relevant.

Rainer

Thanks for pointing out the problem. I just ran into it. Indeed setting
config.i18n.locale fixed the problem.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs