FIX: deprecation warning - initialization autoloaded the constant (#12347)

Get rid of deprecation related to Zeitwerk autoloader.
This commit is contained in:
Krzysztof Kotlarek
2021-03-12 08:42:53 +11:00
committed by GitHub
parent b42ee6e296
commit 9a5a38a529
6 changed files with 163 additions and 150 deletions

View File

@@ -5,15 +5,17 @@
require 'i18n/backend/discourse_i18n'
require 'i18n/backend/fallback_locale_list'
I18n.backend = I18n::Backend::DiscourseI18n.new
I18n.fallbacks = I18n::Backend::FallbackLocaleList.new
I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) }
I18n.reload!
I18n.init_accelerator!(overrides_enabled: ENV['DISABLE_TRANSLATION_OVERRIDES'] != '1')
Rails.application.reloader.to_prepare do
I18n.backend = I18n::Backend::DiscourseI18n.new
I18n.fallbacks = I18n::Backend::FallbackLocaleList.new
I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) }
I18n.reload!
I18n.init_accelerator!(overrides_enabled: ENV['DISABLE_TRANSLATION_OVERRIDES'] != '1')
unless Rails.env.test?
MessageBus.subscribe("/i18n-flush") do
I18n.reload!
ExtraLocalesController.clear_cache!
unless Rails.env.test?
MessageBus.subscribe("/i18n-flush") do
I18n.reload!
ExtraLocalesController.clear_cache!
end
end
end