From d24a0590d363dbe88d383c8faec8eb28809242f0 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 21 Mar 2018 22:11:47 -0230 Subject: i18n redux solution doesn't require importing t() and passing state to each t() call; t is just available on props. --- ui/i18n-helper.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui/i18n-helper.js') diff --git a/ui/i18n-helper.js b/ui/i18n-helper.js index 10147b0f6..70555f239 100644 --- a/ui/i18n-helper.js +++ b/ui/i18n-helper.js @@ -2,13 +2,15 @@ const log = require('loglevel') const getMessage = (locale, key, substitutions) => { + console.log(`locale, key, substitutions`, locale, key, substitutions); // check locale is loaded if (!locale) { // throw new Error('Translator - has not loaded a locale yet.') return '' } // check entry is present - const entry = locale[key] + 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}"`) -- cgit