Safety in case translations are missing root keys

This commit is contained in:
Robin Ward 2018-06-12 10:09:40 -04:00
parent 5d445fb810
commit e0096b0d1c

View File

@ -55,6 +55,10 @@ module JsLocaleHelper
# merge translations (plugin translations overwrite default translations)
if translations[locale_str] && plugin_translations(locale_str)
translations[locale_str]['js'] ||= {}
translations[locale_str]['admin_js'] ||= {}
translations[locale_str]['wizard_js'] ||= {}
translations[locale_str]['js'].deep_merge!(plugin_translations(locale_str)['js']) if plugin_translations(locale_str)['js']
translations[locale_str]['admin_js'].deep_merge!(plugin_translations(locale_str)['admin_js']) if plugin_translations(locale_str)['admin_js']
translations[locale_str]['wizard_js'].deep_merge!(plugin_translations(locale_str)['wizard_js']) if plugin_translations(locale_str)['wizard_js']