Skip to content

Commit ad264ed

Browse files
committed
Modify load order of locales
The load order as controlled by an additional code snippet during Redmine initialization is modified to be conditional. That is, the code won't get executed when the redmine_message_customize plugin is not installed anymore. This won't break the restart when the plugin is (temporarily) uninstalled but the additional file in Redmine config/initializers is not removed.
1 parent f67a004 commit ad264ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

35_change_load_order_locales.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3-
p = Redmine::Plugin.find(:redmine_message_customize)
4-
custom_locales = Dir.glob(File.join(p.directory, 'config', 'locales', 'custom_messages', '*.rb'))
5-
Rails.application.config.i18n.load_path = (Rails.application.config.i18n.load_path - custom_locales + custom_locales)
3+
if Redmine::Plugin.installed? :redmine_message_customize
4+
p = Redmine::Plugin.find(:redmine_message_customize)
5+
custom_locales = Dir.glob(File.join(p.directory, 'config', 'locales', 'custom_messages', '*.rb'))
6+
Rails.application.config.i18n.load_path = (Rails.application.config.i18n.load_path - custom_locales + custom_locales)
7+
end

0 commit comments

Comments
 (0)