I am using I18n-js, and my client side I18n.t calls all return a translation missing message when running in production.
All is ok in development and test.
The root of this issue appears to be in the asset pipeline.
I18n.load_path does not contain any of my translations (when running bin/rake assets:precompile) it only contains the following paths:
["/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/activesupport-3.2.3/lib/active_support/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/activemodel-3.2.3/lib/active_model/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/activerecord-3.2.3/lib/active_record/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/actionpack-3.2.3/lib/action_view/locale/en.yml"]
These look like the default activesupport, activemodel, activerecord and actionpack translations from the gems...
My translation paths do however get set as expected when running bin/rails console in development and production:
1.9.3p125 :002 > I18n.load_path
=> ["/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/activesupport-3.2.3/lib/active_support/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/activemodel-3.2.3/lib/active_model/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/activerecord-3.2.3/lib/active_record/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/actionpack-3.2.3/lib/action_view/locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/carrierwave-0.6.1/lib/carrierwave/validations/../locale/en.yml",
"/home/chris/.rvm/gems/ruby-1.9.3-p125@Project/gems/devise-2.0.4/config/locales/en.yml",
"/media/sf_code/Project/config/locales/active_record.en.yml",
"/media/sf_code/Project/config/locales/project.en.yml"]
Indeed the I18n documentation states: "The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded."
I've also tried specifying in application.rb
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
But still no joy.
Anyone have any idea what could cause I18n.load_path not to be set only when running assets:precompile?
Thanks for any ideas