mirror of
https://github.com/discourse/discourse.git
synced 2026-07-29 15:54:48 -05:00
FIX: Translation fallback was not using fallback's translation override.
https://meta.discourse.org/t/discobot-falling-back-to-site-locale-is-not-using-customized-copies/65140
This commit is contained in:
@@ -72,8 +72,9 @@ module I18n
|
||||
# the original translations before applying our overrides.
|
||||
def lookup(locale, key, scope = [], options = {})
|
||||
existing_translations = super(locale, key, scope, options)
|
||||
overrides = options.dig(:overrides, locale)
|
||||
|
||||
if options[:overrides] && existing_translations
|
||||
if overrides && existing_translations
|
||||
if options[:count]
|
||||
|
||||
remapped_translations =
|
||||
@@ -85,13 +86,13 @@ module I18n
|
||||
|
||||
result = {}
|
||||
|
||||
remapped_translations.merge(options[:overrides]).each do |k, v|
|
||||
remapped_translations.merge(overrides).each do |k, v|
|
||||
result[k.split('.').last.to_sym] = v if k != key && k.start_with?(key.to_s)
|
||||
end
|
||||
return result if result.size > 0
|
||||
end
|
||||
|
||||
return options[:overrides][key] if options[:overrides][key]
|
||||
return overrides[key] if overrides[key]
|
||||
end
|
||||
|
||||
existing_translations
|
||||
|
||||
Reference in New Issue
Block a user