2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-07-16 00:04:45 +08:00
|
|
|
# order: after 02-freedom_patches.rb
|
|
|
|
|
2015-11-14 04:42:01 +08:00
|
|
|
require 'i18n/backend/discourse_i18n'
|
2018-01-22 21:42:12 +08:00
|
|
|
require 'i18n/backend/fallback_locale_list'
|
|
|
|
|
2021-03-20 03:51:13 +08:00
|
|
|
# Requires the `translate_accelerator.rb` freedom patch to be loaded
|
2021-03-16 06:47:57 +08:00
|
|
|
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')
|
2015-11-18 05:14:42 +08:00
|
|
|
|
2021-03-16 06:47:57 +08:00
|
|
|
unless Rails.env.test?
|
|
|
|
MessageBus.subscribe("/i18n-flush") do
|
|
|
|
I18n.reload!
|
|
|
|
ExtraLocalesController.clear_cache!
|
|
|
|
end
|
2019-11-05 09:15:44 +08:00
|
|
|
end
|
2015-11-24 05:45:05 +08:00
|
|
|
end
|