mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 23:33:37 +08:00
23 lines
703 B
Ruby
23 lines
703 B
Ruby
# frozen_string_literal: true
|
|
|
|
# order: after 02-freedom_patches.rb
|
|
|
|
require "i18n/backend/discourse_i18n"
|
|
require "i18n/backend/fallback_locale_list"
|
|
|
|
# Requires the `translate_accelerator.rb` freedom patch to be loaded
|
|
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!
|
|
end
|
|
end
|
|
end
|