diff --git a/config/initializers/100-i18n.rb b/config/initializers/100-i18n.rb index 10749264a41..739fca222dd 100644 --- a/config/initializers/100-i18n.rb +++ b/config/initializers/100-i18n.rb @@ -9,7 +9,7 @@ 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! +I18n.init_accelerator!(overrides_enabled: ENV['DISABLE_TRANSLATION_OVERRIDES'] != '1') unless Rails.env.test? MessageBus.subscribe("/i18n-flush") do diff --git a/lib/backup_restore/database_restorer.rb b/lib/backup_restore/database_restorer.rb index d0880c97edd..929e318a9f4 100644 --- a/lib/backup_restore/database_restorer.rb +++ b/lib/backup_restore/database_restorer.rb @@ -134,7 +134,11 @@ module BackupRestore log "Migrating the database..." log Discourse::Utils.execute_command( - { "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "0", "SKIP_OPTIMIZE_ICONS" => "1" }, + { + "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "0", + "SKIP_OPTIMIZE_ICONS" => "1", + "DISABLE_TRANSLATION_OVERRIDES" => "1" + }, "rake db:migrate", failure_message: "Failed to migrate database.", chdir: Rails.root diff --git a/lib/freedom_patches/translate_accelerator.rb b/lib/freedom_patches/translate_accelerator.rb index 704da6ec4b9..ee724d56d12 100644 --- a/lib/freedom_patches/translate_accelerator.rb +++ b/lib/freedom_patches/translate_accelerator.rb @@ -21,8 +21,8 @@ module I18n LRU_CACHE_SIZE = 400 - def init_accelerator! - @overrides_enabled = true + def init_accelerator!(overrides_enabled: true) + @overrides_enabled = overrides_enabled execute_reload end diff --git a/spec/lib/backup_restore/database_restorer_spec.rb b/spec/lib/backup_restore/database_restorer_spec.rb index 02666093b0a..9f1cc0c935b 100644 --- a/spec/lib/backup_restore/database_restorer_spec.rb +++ b/spec/lib/backup_restore/database_restorer_spec.rb @@ -38,6 +38,7 @@ describe BackupRestore::DatabaseRestorer do Discourse::Utils.expects(:execute_command).with do |env, command, options| env["SKIP_POST_DEPLOYMENT_MIGRATIONS"] == "0" && env["SKIP_OPTIMIZE_ICONS"] == "1" && + env["DISABLE_TRANSLATION_OVERRIDES"] == "1" && command == "rake db:migrate" && options[:chdir] == Rails.root end.once