aboutsummaryrefslogtreecommitdiffstats
path: root/ui/i18n-helper.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-22 08:41:47 +0800
committerDan <danjm.com@gmail.com>2018-03-22 08:41:47 +0800
commitd24a0590d363dbe88d383c8faec8eb28809242f0 (patch)
tree189e54ca9ea117804c96afa551cfca8158f36974 /ui/i18n-helper.js
parent29cc2f8ab9628d21cc32962666879c71be4e69d1 (diff)
downloadtangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.gz
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.zst
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.zip
i18n redux solution doesn't require importing t() and passing state to each t() call; t is just available on props.
Diffstat (limited to 'ui/i18n-helper.js')
-rw-r--r--ui/i18n-helper.js4
1 files changed, 3 insertions, 1 deletions
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}"`)