i have a rather specific setup regarding rails internationalization. I'm using rails-i18n
gem, but that shouldn't matter. It worked perfectly with Rails 3. Here is my config from config/application.rb
config.i18n.default_locale = :en
config.i18n.locale = :hr
Let me explain:
:hr
(Croatian) because I mostly make localized applications in Croatian language:en
because I'm often using gems like rails-admin
which have English translations included. It plays nicely in production where missing (Croatian) translations fallback to English. That's fine, all admins understand English :)It seems that Rails 4 ignores config.i18n.locale
, and it always use :en
locale.
So far, I've been using before_action
to set I18n.locale = :hr
but that doesn't work in Rails console or Rack middleware...
Thanks in advance,
Danijel
I found a simple solution and I'm posting it here...
Insert into config/application.rb
config.i18n.default_locale = :hr
config.i18n.available_locales = [:hr, :en]
config.i18n.fallbacks = [:en]
Remove or comment the following line from config/environments/production.rb
# config.i18n.fallbacks = true
or change it to:
config.i18n.fallbacks = [:en]