This project is archived and is in readonly mode.
Config option to prevent i18n.reload! on each request
Reported by Lawrence Pit | June 10th, 2010 @ 02:03 PM | in 3.0.2
In development mode on each request I18n.reload! is called. If you use a custom backend that e.g. loads all translations from a database this will significantly slow down development.
Attached patches for 2-3-stable and rails 3 add the option config.i18n.reload_on_each_request, which is default set to +false+. In environment/development.rb it is set to +true+ by default.
Comments and changes to this ticket
-
Lawrence Pit June 10th, 2010 @ 02:03 PM
- no changes were found...
-
Lawrence Pit June 10th, 2010 @ 02:09 PM
Btw, in rails 3 I18n.reload! is called twice on initialization in railtie.rb, namely in "i18n.initialize" and in the after_initialize. Not sure if any of the two could be removed.. it seems to me the call in the initialize block could be removed. What do you think?
-
José Valim June 10th, 2010 @ 02:12 PM
- Milestone cleared.
Hey Lawrence, a few notes. First, it would be nice if the new option you added simply delegates to config.cache_classes if it is not set. I think that less than 1% of people are going to use it, so it makes no sense being required to add it config/environments/*.rb.
Besides that, it looks great! Just one note, you don't need to update the patch for Rails 2.3, because I'm not willing to apply it on 2.3, since it's a maintenance branch.
-
Lawrence Pit June 11th, 2010 @ 01:23 AM
In development mode I do want to reload the classes on each request, just not all the i18n stuff, so delegating to cache_caches is not what I want.
I think > 90% don't do i18n, they just hard code all strings. So having i18n reload by default is just a waste for them.
-
José Valim June 11th, 2010 @ 07:22 AM
It's going to delegate to cache_classes unless it is set. The idea is to avoid configuration hell. If they are not using I18n at all, reloading it take few miliseconds just.
-
José Valim June 21st, 2010 @ 12:10 PM
We just changed I18n.reload! to be called only if any of the locale files were modified. This may have solved your problem!
-
Ryan Bigg November 8th, 2010 @ 01:48 AM
- Importance changed from to Low
Automatic cleanup of spam.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>