Implemented feedback to make i18n work on mac

feature/default_network_editable
Dan Finlay 7 years ago
parent abfa74f09a
commit f06bca1151
  1. 3
      ui/app/app.js
  2. 3
      ui/app/unlock.js
  3. 13
      ui/i18n.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')),
]),

@ -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',

@ -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

Loading…
Cancel
Save