FIX: Extra-locale merging didn't account for fallbacks (#17128)
Regressed in #17027
This commit is contained in:
parent
84b0a6414d
commit
2eeb50dfc1
|
@ -202,8 +202,9 @@ module JsLocaleHelper
|
||||||
|
|
||||||
def self.output_extra_locales(bundle, locale)
|
def self.output_extra_locales(bundle, locale)
|
||||||
translations = translations_for(locale)
|
translations = translations_for(locale)
|
||||||
|
locales = translations.keys
|
||||||
|
|
||||||
translations.keys.each do |l|
|
locales.each do |l|
|
||||||
translations[l].keys.each do |k|
|
translations[l].keys.each do |k|
|
||||||
bundle_translations = translations[l].delete(k)
|
bundle_translations = translations[l].delete(k)
|
||||||
translations[l].deep_merge!(bundle_translations) if k == bundle
|
translations[l].deep_merge!(bundle_translations) if k == bundle
|
||||||
|
@ -212,19 +213,17 @@ module JsLocaleHelper
|
||||||
|
|
||||||
return "" if translations.blank?
|
return "" if translations.blank?
|
||||||
|
|
||||||
<<~JS
|
output = +"if (!I18n.extras) { I18n.extras = {}; }"
|
||||||
if (!I18n.extras) {
|
locales.each do |l|
|
||||||
I18n.extras = {}
|
output << <<~JS
|
||||||
}
|
if (!I18n.extras["#{l}"]) { I18n.extras["#{l}"] = {}; }
|
||||||
|
Object.assign(I18n.extras["#{l}"], #{translations[l].to_json});
|
||||||
if (!I18n.extras["#{locale}"]) {
|
|
||||||
I18n.extras["#{locale}"] = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.assign(I18n.extras["#{locale}"], #{translations[locale].to_json});
|
|
||||||
JS
|
JS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
output
|
||||||
|
end
|
||||||
|
|
||||||
MOMENT_LOCALE_MAPPING ||= {
|
MOMENT_LOCALE_MAPPING ||= {
|
||||||
"hy" => "hy-am"
|
"hy" => "hy-am"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue