mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 11:55:09 +08:00
8022e51179
Rails calls I18n.translate during initialization and by default translation overrides are used. Database migrations would fail if the system tried to migrate from an old version that didn't have the `translation_overrides` table with all its columns yet. This makes restoring really old backups work again. Running `DISABLE_TRANSLATION_OVERRIDES=1 rake db:migrate` will allow you to upgrade such an old database as well.
20 lines
567 B
Ruby
20 lines
567 B
Ruby
# frozen_string_literal: true
|
|
|
|
# order: after 02-freedom_patches.rb
|
|
|
|
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')
|
|
|
|
unless Rails.env.test?
|
|
MessageBus.subscribe("/i18n-flush") do
|
|
I18n.reload!
|
|
ExtraLocalesController.clear_cache!
|
|
end
|
|
end
|