0

I would like to use I18n.t call in an initializer file. Unfortunately, it doesn't work. Rails returns the usual "translation missing:" message. It seems that the I18n files haven't been loaded yet when the call is made.

Are there any workarounds ?

Thanks

jlfenaux
  • 3,263
  • 1
  • 26
  • 33
  • This has appeared again in Rails 3.1.1 (maybe sooner?). I would like to usilize the same format for I18n.locale(some_time, :format => :my_format) and some_time.utc.to_s(:my_format). When I to use the following in config/initializers/time_formats.rb: `Time::DATE_FORMATS[:dxl] = I18n.translate('time.formats.dxl')` I get: > Time.now.utc.to_s(:dxl) => "translation missing: en.time.formats.dxl" – Matt Scilipoti Nov 04 '11 at 13:32
  • Formatting is rather limited. Since this is so old (and for a previous version of Rails), I created a new Question: http://stackoverflow.com/questions/8010092/unable-to-use-i18n-t-call-in-an-initializer-file-in-rails-3-1-1 – Matt Scilipoti Nov 04 '11 at 17:19

1 Answers1

0

I had the problem when I was using Rails 2.3.2. Since then, I've migrated to 2.3.5 and I18n.t calls work fine in my initializers.

jlfenaux
  • 3,263
  • 1
  • 26
  • 33