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:
Guo Xiang Tan
2017-07-03 14:52:27 +09:00
parent d3ee5752b8
commit 52e654b3ac
3 changed files with 32 additions and 7 deletions
+4 -3
View File
@@ -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