discourse/config/initializers/100-i18n.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
703 B
Ruby
Raw Normal View History

# 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")
2015-11-17 16:14:42 -05:00
unless Rails.env.test?
MessageBus.subscribe("/i18n-flush") do
I18n.reload!
ExtraLocalesController.clear_cache!
end
end
end