mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fetch localeMessages in front end only.
This commit is contained in:
parent
5fe0be722b
commit
a51e8f6a16
@ -11,11 +11,11 @@ const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
|
|||||||
module.exports = initializePopup
|
module.exports = initializePopup
|
||||||
|
|
||||||
|
|
||||||
function initializePopup ({ container, connectionStream, localeMessages }, cb) {
|
function initializePopup ({ container, connectionStream }, cb) {
|
||||||
// setup app
|
// setup app
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
(cb) => connectToAccountManager(connectionStream, cb),
|
(cb) => connectToAccountManager(connectionStream, cb),
|
||||||
(accountManager, cb) => launchMetamaskUi({ container, accountManager, localeMessages }, cb),
|
(accountManager, cb) => launchMetamaskUi({ container, accountManager }, cb),
|
||||||
], cb)
|
], cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
// setup i18n
|
|
||||||
// const Translator = require('../../ui/create-i18n')
|
|
||||||
// const translator = new Translator()
|
|
||||||
// global.translator = translator
|
|
||||||
// global.getMessage = translator.getMessage.bind(translator)
|
|
||||||
|
|
||||||
const injectCss = require('inject-css')
|
const injectCss = require('inject-css')
|
||||||
const OldMetaMaskUiCss = require('../../old-ui/css')
|
const OldMetaMaskUiCss = require('../../old-ui/css')
|
||||||
const NewMetaMaskUiCss = require('../../ui/css')
|
const NewMetaMaskUiCss = require('../../ui/css')
|
||||||
@ -28,10 +22,6 @@ async function start() {
|
|||||||
const release = global.platform.getVersion()
|
const release = global.platform.getVersion()
|
||||||
setupRaven({ release })
|
setupRaven({ release })
|
||||||
|
|
||||||
// Load translator
|
|
||||||
// await translator.setLocale('ja')
|
|
||||||
const localeMessages = await fetchLocale('ja')
|
|
||||||
|
|
||||||
// inject css
|
// inject css
|
||||||
// const css = MetaMaskUiCss()
|
// const css = MetaMaskUiCss()
|
||||||
// injectCss(css)
|
// injectCss(css)
|
||||||
@ -47,7 +37,7 @@ async function start() {
|
|||||||
|
|
||||||
// start ui
|
// start ui
|
||||||
const container = document.getElementById('app-content')
|
const container = document.getElementById('app-content')
|
||||||
startPopup({ container, connectionStream, localeMessages }, (err, store) => {
|
startPopup({ container, connectionStream }, (err, store) => {
|
||||||
if (err) return displayCriticalError(err)
|
if (err) return displayCriticalError(err)
|
||||||
|
|
||||||
// Code commented out until we begin auto adding users to NewUI
|
// Code commented out until we begin auto adding users to NewUI
|
||||||
|
@ -4,7 +4,7 @@ const Root = require('./app/root')
|
|||||||
const actions = require('./app/actions')
|
const actions = require('./app/actions')
|
||||||
const configureStore = require('./app/store')
|
const configureStore = require('./app/store')
|
||||||
const txHelper = require('./lib/tx-helper')
|
const txHelper = require('./lib/tx-helper')
|
||||||
const { fetchLocale } = require('./i18n-helper').getMessage
|
const { fetchLocale } = require('./i18n-helper')
|
||||||
const { OLD_UI_NETWORK_TYPE, BETA_UI_NETWORK_TYPE } = require('../app/scripts/config').enums
|
const { OLD_UI_NETWORK_TYPE, BETA_UI_NETWORK_TYPE } = require('../app/scripts/config').enums
|
||||||
|
|
||||||
global.log = require('loglevel')
|
global.log = require('loglevel')
|
||||||
@ -19,17 +19,19 @@ function launchMetamaskUi (opts, cb) {
|
|||||||
// check if we are unlocked first
|
// check if we are unlocked first
|
||||||
accountManager.getState(function (err, metamaskState) {
|
accountManager.getState(function (err, metamaskState) {
|
||||||
if (err) return cb(err)
|
if (err) return cb(err)
|
||||||
startApp(metamaskState, accountManager, opts.localeMessages, opts)
|
startApp(metamaskState, accountManager, opts)
|
||||||
.then((store) => {
|
.then((store) => {
|
||||||
cb(null, store)
|
cb(null, store)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function startApp (metamaskState, accountManager, currentLocaleMessages, opts) {
|
async function startApp (metamaskState, accountManager, opts) {
|
||||||
// parse opts
|
// parse opts
|
||||||
if (!metamaskState.featureFlags) metamaskState.featureFlags = {}
|
if (!metamaskState.featureFlags) metamaskState.featureFlags = {}
|
||||||
|
|
||||||
|
const currentLocaleMessages = await fetchLocale(metamaskState.currentLocale)
|
||||||
|
|
||||||
const store = configureStore({
|
const store = configureStore({
|
||||||
|
|
||||||
// metamaskState represents the cross-tab state
|
// metamaskState represents the cross-tab state
|
||||||
|
Loading…
Reference in New Issue
Block a user