diff --git a/app/models/translation_override.rb b/app/models/translation_override.rb index a7c927318cf..27914abbdcc 100644 --- a/app/models/translation_override.rb +++ b/app/models/translation_override.rb @@ -6,6 +6,8 @@ class TranslationOverride < ActiveRecord::Base params = { locale: locale, translation_key: key } row_count = where(params).update_all(value: value) create!(params.merge(value: value)) if row_count == 0 + + MessageBus.publish('/i18n-flush', { refresh: true }) end end diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index ca6ee5e5695..d9084154b32 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -3,3 +3,5 @@ require 'i18n/backend/discourse_i18n' I18n.backend = I18n::Backend::DiscourseI18n.new I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) } + +MessageBus.subscribe("/i18n-flush") { I18n.reload! }