Skip to content

Commit 4975e0b

Browse files
authored
Merge pull request rails#44567 from Shopify/i18n-reloader-cache-classes
Don't setup i18n reloader if `config.cache_classes = true`
2 parents 1cf3fde + f4d1356 commit 4975e0b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

activesupport/lib/active_support/i18n_railtie.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,19 @@ def self.initialize_i18n(app)
6060
# Restore available locales check so it will take place from now on.
6161
I18n.enforce_available_locales = enforce_available_locales
6262

63-
directories = watched_dirs_with_extensions(reloadable_paths)
64-
reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do
65-
I18n.load_path.keep_if { |p| File.exist?(p) }
66-
I18n.load_path |= reloadable_paths.flat_map(&:existent)
67-
end
63+
unless app.config.cache_classes
64+
directories = watched_dirs_with_extensions(reloadable_paths)
65+
reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do
66+
I18n.load_path.keep_if { |p| File.exist?(p) }
67+
I18n.load_path |= reloadable_paths.flat_map(&:existent)
68+
end
6869

69-
app.reloaders << reloader
70-
app.reloader.to_run do
71-
reloader.execute_if_updated { require_unload_lock! }
70+
app.reloaders << reloader
71+
app.reloader.to_run do
72+
reloader.execute_if_updated { require_unload_lock! }
73+
end
74+
reloader.execute
7275
end
73-
reloader.execute
7476

7577
@i18n_inited = true
7678
end

0 commit comments

Comments
 (0)