From 3500689ed0a7e19cd36283df10482171572d0d1c Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 24 Apr 2018 09:53:16 -0700 Subject: [PATCH 1/3] i18n-helper - abort on i18n failure --- ui/i18n-helper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/i18n-helper.js b/ui/i18n-helper.js index 3eee55ae9..fddce522b 100644 --- a/ui/i18n-helper.js +++ b/ui/i18n-helper.js @@ -11,8 +11,9 @@ const getMessage = (locale, key, substitutions) => { const { current, en } = locale const entry = current[key] || en[key] if (!entry) { - log.error(`Translator - Unable to find value for "${key}"`) // throw new Error(`Translator - Unable to find value for "${key}"`) + log.error(`Translator - Unable to find value for "${key}"`) + return '' } let phrase = entry.message // perform substitutions From b2fbc6399a94fee5e6fee17f2a84c0d28ef1e042 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 25 Apr 2018 10:57:44 -0700 Subject: [PATCH 2/3] Return key instead of empty string on i18n fail --- ui/i18n-helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/i18n-helper.js b/ui/i18n-helper.js index fddce522b..7753b3bda 100644 --- a/ui/i18n-helper.js +++ b/ui/i18n-helper.js @@ -13,7 +13,7 @@ const getMessage = (locale, key, substitutions) => { if (!entry) { // throw new Error(`Translator - Unable to find value for "${key}"`) log.error(`Translator - Unable to find value for "${key}"`) - return '' + return key } let phrase = entry.message // perform substitutions From ee8b91262df3c614252e7f2a0aae464f533a06ed Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 25 Apr 2018 15:27:30 -0700 Subject: [PATCH 3/3] i18n-helper - wrap fallback in brackets to help indicate something is wrong --- ui/i18n-helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/i18n-helper.js b/ui/i18n-helper.js index 7753b3bda..79aa93116 100644 --- a/ui/i18n-helper.js +++ b/ui/i18n-helper.js @@ -13,7 +13,7 @@ const getMessage = (locale, key, substitutions) => { if (!entry) { // throw new Error(`Translator - Unable to find value for "${key}"`) log.error(`Translator - Unable to find value for "${key}"`) - return key + return `[${key}]` } let phrase = entry.message // perform substitutions