diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-03-28 09:41:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-28 09:41:45 +0800 |
commit | 0582fdb617a23cc56e9e08460f09d86769599fc1 (patch) | |
tree | 5daf844ac1fd0c9d1f683b479184509ebb96c850 /ui/index.js | |
parent | b6b18339e2de92afd2fb5364ec5bc4c29b4d10a3 (diff) | |
parent | b4ec68b2d4b6713e0a203df88eb4a8982c2cf2c6 (diff) | |
download | tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.tar tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.tar.gz tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.tar.bz2 tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.tar.lz tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.tar.xz tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.tar.zst tangerine-wallet-browser-0582fdb617a23cc56e9e08460f09d86769599fc1.zip |
Merge pull request #3609 from MetaMask/i18n-translator-redux
Handle i18n with redux.
Diffstat (limited to 'ui/index.js')
-rw-r--r-- | ui/index.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/ui/index.js b/ui/index.js index fdb2f23e0..1e0e9f1cc 100644 --- a/ui/index.js +++ b/ui/index.js @@ -4,6 +4,7 @@ const Root = require('./app/root') const actions = require('./app/actions') const configureStore = require('./app/store') const txHelper = require('./lib/tx-helper') +const { fetchLocale } = require('./i18n-helper') const { OLD_UI_NETWORK_TYPE, BETA_UI_NETWORK_TYPE } = require('../app/scripts/config').enums global.log = require('loglevel') @@ -18,14 +19,22 @@ function launchMetamaskUi (opts, cb) { // check if we are unlocked first accountManager.getState(function (err, metamaskState) { if (err) return cb(err) - const store = startApp(metamaskState, accountManager, opts) - cb(null, store) + startApp(metamaskState, accountManager, opts) + .then((store) => { + cb(null, store) + }) }) } -function startApp (metamaskState, accountManager, opts) { +async function startApp (metamaskState, accountManager, opts) { // parse opts if (!metamaskState.featureFlags) metamaskState.featureFlags = {} + + const currentLocaleMessages = metamaskState.currentLocale + ? await fetchLocale(metamaskState.currentLocale) + : {} + const enLocaleMessages = await fetchLocale('en') + const store = configureStore({ // metamaskState represents the cross-tab state @@ -34,6 +43,11 @@ function startApp (metamaskState, accountManager, opts) { // appState represents the current tab's popup state appState: {}, + localeMessages: { + current: currentLocaleMessages, + en: enLocaleMessages, + }, + // Which blockchain we are using: networkVersion: opts.networkVersion, }) |