Refresh I18n customizations on change
This commit is contained in:
parent
3282aec792
commit
1be4b6a8f5
|
@ -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
|
||||
|
|
|
@ -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! }
|
||||
|
|
Loading…
Reference in New Issue