diff options
author | Dan Finlay <dan@danfinlay.com> | 2018-03-07 07:32:35 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2018-03-07 07:32:35 +0800 |
commit | f06bca1151b07d908cd90f6efd97064e288e5f27 (patch) | |
tree | e3933155aec8b54a19052b807e39230035237441 /ui/i18n.js | |
parent | abfa74f09a0119345165a32090d88a1d95df6c80 (diff) | |
download | tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.tar tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.tar.gz tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.tar.bz2 tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.tar.lz tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.tar.xz tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.tar.zst tangerine-wallet-browser-f06bca1151b07d908cd90f6efd97064e288e5f27.zip |
Implemented feedback to make i18n work on mac
Diffstat (limited to 'ui/i18n.js')
-rw-r--r-- | ui/i18n.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/i18n.js b/ui/i18n.js index db79c87e8..8601ce756 100644 --- a/ui/i18n.js +++ b/ui/i18n.js @@ -3,18 +3,18 @@ const chrome = chrome || null const browser = browser || null -let getMessage = null +const extension = require('extensionizer') +let getMessage -if ((chrome && chrome.i18n && chrome.i18n.getMessage) || - (browser && browser.i18n && browser.i18n.getMessage)) { - getMessage = (chrome || browser).i18n.getMessage +if (extension.i18n && extension.i18n.getMessage) { + getMessage = extension.i18n.getMessage } else { // fallback function - console.warn('browser.i18n API not available?') + log.warn('browser.i18n API not available, calling back to english.') const msg = require('../app/_locales/en/messages.json') getMessage = function (key, substitutions) { if (!msg[key]) { - console.error(key) + log.error(key) throw new Error(key) } let phrase = msg[key].message @@ -28,4 +28,5 @@ if ((chrome && chrome.i18n && chrome.i18n.getMessage) || } } +window.h = getMessage module.exports = getMessage |