Skip to content

Commit 299b651

Browse files
authored
Merge pull request rails#53259 from Shopify/dont_run_i18n_watcher_on_boot
Don't execute i18n watcher on boot.
2 parents b59befc + b4afdb0 commit 299b651

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

activesupport/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
2+
and unnecessarily slows down boot of applications with lots of translations.
3+
4+
*Gannon McGibbon*, *David Stosik*
5+
16
* Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
27

38
Previously:

activesupport/lib/active_support/i18n_railtie.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ def self.initialize_i18n(app)
6868
directories = watched_dirs_with_extensions(reloadable_paths)
6969
root_load_paths = I18n.load_path.select { |path| path.to_s.start_with?(Rails.root.to_s) }
7070
reloader = app.config.file_watcher.new(root_load_paths, directories) do
71-
I18n.load_path.delete_if { |p| p.to_s.start_with?(Rails.root.to_s) && !File.exist?(p) }
71+
I18n.load_path.delete_if { |path| path.to_s.start_with?(Rails.root.to_s) && !File.exist?(path) }
7272
I18n.load_path |= reloadable_paths.flat_map(&:existent)
7373
end
7474

7575
app.reloaders << reloader
7676
app.reloader.to_run do
7777
reloader.execute_if_updated { require_unload_lock! }
7878
end
79-
reloader.execute
8079
end
8180

8281
@i18n_inited = true

0 commit comments

Comments
 (0)