From 6f8f2c494da4e7e67df93334db8a4d8508a5794e Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 24 Nov 2017 14:11:01 -0500 Subject: [PATCH] FIX: admin strings in plugins should fallback to english when untranslated --- app/assets/javascripts/locales/i18n.js | 3 +-- lib/js_locale_helper.rb | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/locales/i18n.js b/app/assets/javascripts/locales/i18n.js index ddf3fd55f1d..ba56bc3a80c 100644 --- a/app/assets/javascripts/locales/i18n.js +++ b/app/assets/javascripts/locales/i18n.js @@ -48,8 +48,7 @@ function checkExtras(origScope, sep, extras) { I18n.lookup = function(scope, options) { options = options || {}; - var lookupInitialScope = scope, - translations = this.prepareOptions(I18n.translations), + var translations = this.prepareOptions(I18n.translations), locale = options.locale || I18n.currentLocale(), messages = translations[locale] || {}, currentScope; diff --git a/lib/js_locale_helper.rb b/lib/js_locale_helper.rb index 172c4c0ac57..99bd3755e16 100644 --- a/lib/js_locale_helper.rb +++ b/lib/js_locale_helper.rb @@ -52,7 +52,10 @@ module JsLocaleHelper end # merge translations (plugin translations overwrite default translations) - translations[locale_str]['js'].deep_merge!(plugin_translations(locale_str)['js']) if translations[locale_str] && plugin_translations(locale_str) && plugin_translations(locale_str)['js'] + if translations[locale_str] && plugin_translations(locale_str) + 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'] + end translations end