1

I'm having trouble getting i18n to work on heroku. I set:

I18n.default_locale = :de

in my environment.rb and the translation is in config/locales/de.yml works perfect on my local machines but not so on Heroku. On heroku everything is in english. I don't think I need a special gem like i18n gem, cause I don't have it on my local machine either. Maybe someone has a solution to this?

Marc-André Lafortune
  • 78,216
  • 16
  • 166
  • 166
nvano
  • 23
  • 3
  • Hello, I have the same problem as Mark, did you find a solution that works? – Peter Jan 07 '11 at 14:25
  • He did mark an answer as accepted. If this didn't help, maybe this do: http://stackoverflow.com/questions/5156765/heroku-i18n-locale-is-different-from-default-locale-works-fine-locally – oma Mar 05 '11 at 10:23

2 Answers2

1

Try to set the default local like this in your config.environment.rb:

Rails::Initializer.run do |config|
  # ...
  config.i18n.default_locale = :de
end
jigfox
  • 18,057
  • 3
  • 60
  • 73
1

The only solution I found that worked for me, on heroku, was setting it manually in the application controller.

application_controller.rb

before_filter :set_locale

def set_locale 
  I18n.locale = 'fr-QC' || I18n.default_locale 
end

cheers

Pavel
  • 1,934
  • 3
  • 30
  • 49
c-a
  • 5,928
  • 1
  • 17
  • 12