aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-03-07 07:32:35 +0800
committerDan Finlay <dan@danfinlay.com>2018-03-07 07:32:35 +0800
commitf06bca1151b07d908cd90f6efd97064e288e5f27 (patch)
treee3933155aec8b54a19052b807e39230035237441 /ui
parentabfa74f09a0119345165a32090d88a1d95df6c80 (diff)
downloadtangerine-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')
-rw-r--r--ui/app/app.js3
-rw-r--r--ui/app/unlock.js3
-rw-r--r--ui/i18n.js13
3 files changed, 11 insertions, 8 deletions
diff --git a/ui/app/app.js b/ui/app/app.js
index df9eab03c..3205baebb 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -4,6 +4,7 @@ const connect = require('react-redux').connect
const h = require('react-hyperscript')
const actions = require('./actions')
const classnames = require('classnames')
+const t = require('../i18n')
// mascara
const MascaraFirstTime = require('../../mascara/src/app/first-time').default
@@ -264,7 +265,7 @@ App.prototype.renderAppBar = function () {
}),
// metamask name
- h('h1', 'MetaMask'),
+ h('h1', t('appName')),
]),
diff --git a/ui/app/unlock.js b/ui/app/unlock.js
index ec97b03bf..7a48c5f09 100644
--- a/ui/app/unlock.js
+++ b/ui/app/unlock.js
@@ -5,6 +5,7 @@ const connect = require('react-redux').connect
const actions = require('./actions')
const getCaretCoordinates = require('textarea-caret')
const EventEmitter = require('events').EventEmitter
+const t = require('../i18n')
const Mascot = require('./components/mascot')
@@ -43,7 +44,7 @@ UnlockScreen.prototype.render = function () {
textTransform: 'uppercase',
color: '#7F8082',
},
- }, 'MetaMask'),
+ }, t('appName')),
h('input.large-input', {
type: 'password',
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