Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom i18n.load_path ignored in rake tasks in rails 2.3.8 #53

Closed
jamesbebbington opened this issue Aug 25, 2010 · 1 comment
Closed

Comments

@jamesbebbington
Copy link

We have a rails app with a config/seeds.rb task that populates the database with various records. Some of these records have a locale attribute which we validate against I18n.available_locales. In upgrading from rails 2.3.5 to 2.3.8 this seeds task broke, with the generated records complaining that the locale was invalid.

Firing up a console and calling I18n.available_locales returned all the locales as expected. Printing the available_locales from within the seeds task only returned [:en].

Much digging revealed that when the app is booted via a rake task the translations are being loaded before config/environment.rb is loaded (containing our custom i18n.load_path), with the call to #to_sentence in the recently added deprecation warning in rails/railties/lib/tasks/rails.rb being responsible for this premature call to I18n.translate. Removing this deprecation warning makes everything work again.

Anyone have any recommendations for how best to handle this issue?

Mac OS X 10.6.4
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
rails v2.3.8
i18n v0.4.1

@josevalim
Copy link
Contributor

Send a patch to Rails and ask them to use join(", ") instead of to_sentence. Or update your plugins so the deprecation warnings is not exhibited anymore.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants