From 34aeef50a0519576da64f23d65afdfbfa278273d Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 14 Mar 2018 16:31:45 -0700 Subject: i18n - load locales manually --- ui/app/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/app.js') diff --git a/ui/app/app.js b/ui/app/app.js index 9708a2485..f7fea0c22 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -4,7 +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') +const t = global.getMessage // mascara const MascaraFirstTime = require('../../mascara/src/app/first-time').default -- cgit From 5fe0be722b6514692a68e920ee8058c5d572237d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 15 Mar 2018 21:59:45 -0230 Subject: Handle i18n with redux. --- ui/app/app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ui/app/app.js') diff --git a/ui/app/app.js b/ui/app/app.js index f7fea0c22..34dd3d868 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -1,10 +1,10 @@ const inherits = require('util').inherits const Component = require('react').Component -const connect = require('react-redux').connect +const connect = require('./metamask-connect') const h = require('react-hyperscript') const actions = require('./actions') const classnames = require('classnames') -const t = global.getMessage +const t = require('../i18n-helper').getMessage // mascara const MascaraFirstTime = require('../../mascara/src/app/first-time').default @@ -294,8 +294,8 @@ App.prototype.renderAppBar = function () { // metamask name h('.flex-row', [ - h('h1', t('appName')), - h('div.beta-label', t('beta')), + h('h1', t(this.props.localeMessages, 'appName')), + h('div.beta-label', t(this.props.localeMessages, 'beta')), ]), ]), -- cgit From d24a0590d363dbe88d383c8faec8eb28809242f0 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 21 Mar 2018 22:11:47 -0230 Subject: i18n redux solution doesn't require importing t() and passing state to each t() call; t is just available on props. --- ui/app/app.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'ui/app/app.js') diff --git a/ui/app/app.js b/ui/app/app.js index f69efd1c7..91d5af899 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -4,7 +4,6 @@ const connect = require('./metamask-connect') const h = require('react-hyperscript') const actions = require('./actions') const classnames = require('classnames') -const t = require('../i18n-helper').getMessage // mascara const MascaraFirstTime = require('../../mascara/src/app/first-time').default @@ -294,8 +293,8 @@ App.prototype.renderAppBar = function () { // metamask name h('.flex-row', [ - h('h1', t(this.props.localeMessages, 'appName')), - h('div.beta-label', t(this.props.localeMessages, 'beta')), + h('h1', this.props.t('appName')), + h('div.beta-label', this.props.t('beta')), ]), ]), @@ -557,15 +556,15 @@ App.prototype.getConnectingLabel = function () { let name if (providerName === 'mainnet') { - name = t('connectingToMainnet') + name = this.props.t('connectingToMainnet') } else if (providerName === 'ropsten') { - name = t('connectingToRopsten') + name = this.props.t('connectingToRopsten') } else if (providerName === 'kovan') { - name = t('connectingToRopsten') + name = this.props.t('connectingToRopsten') } else if (providerName === 'rinkeby') { - name = t('connectingToRinkeby') + name = this.props.t('connectingToRinkeby') } else { - name = t('connectingToUnknown') + name = this.props.t('connectingToUnknown') } return name @@ -578,15 +577,15 @@ App.prototype.getNetworkName = function () { let name if (providerName === 'mainnet') { - name = t('mainnet') + name = this.props.t('mainnet') } else if (providerName === 'ropsten') { - name = t('ropsten') + name = this.props.t('ropsten') } else if (providerName === 'kovan') { - name = t('kovan') + name = this.props.t('kovan') } else if (providerName === 'rinkeby') { - name = t('rinkeby') + name = this.props.t('rinkeby') } else { - name = t('unknownNetwork') + name = this.props.t('unknownNetwork') } return name -- cgit From 10609493c5a23a930dd8f7bda0435e576fd24815 Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 28 Mar 2018 22:30:35 -0700 Subject: ui - use relative location for images --- ui/app/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/app.js') diff --git a/ui/app/app.js b/ui/app/app.js index d23238bab..d658cf809 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -288,7 +288,7 @@ App.prototype.renderAppBar = function () { h('img.metafox-icon', { height: 42, width: 42, - src: '/images/metamask-fox.svg', + src: './images/metamask-fox.svg', }), // metamask name -- cgit From 0a711f0de0e342b24988a5da4ca5c64342153210 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 29 Mar 2018 12:30:44 -0230 Subject: Removes t from props via metamask-connect and instead places it on context via a provider. --- ui/app/app.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'ui/app/app.js') diff --git a/ui/app/app.js b/ui/app/app.js index d23238bab..ea88f3039 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -1,7 +1,8 @@ const inherits = require('util').inherits const Component = require('react').Component -const connect = require('./metamask-connect') +const connect = require('react-redux').connect const h = require('react-hyperscript') +const PropTypes = require('prop-types') const actions = require('./actions') const classnames = require('classnames') @@ -45,8 +46,13 @@ const QrView = require('./components/qr-code') // Global Modals const Modal = require('./components/modals/index').Modal +App.contextTypes = { + t: PropTypes.func, +} + module.exports = connect(mapStateToProps, mapDispatchToProps)(App) + inherits(App, Component) function App () { Component.call(this) } @@ -293,8 +299,8 @@ App.prototype.renderAppBar = function () { // metamask name h('.flex-row', [ - h('h1', this.props.t('appName')), - h('div.beta-label', this.props.t('beta')), + h('h1', this.context.t('appName')), + h('div.beta-label', this.context.t('beta')), ]), ]), @@ -556,15 +562,15 @@ App.prototype.getConnectingLabel = function () { let name if (providerName === 'mainnet') { - name = this.props.t('connectingToMainnet') + name = this.context.t('connectingToMainnet') } else if (providerName === 'ropsten') { - name = this.props.t('connectingToRopsten') + name = this.context.t('connectingToRopsten') } else if (providerName === 'kovan') { - name = this.props.t('connectingToRopsten') + name = this.context.t('connectingToRopsten') } else if (providerName === 'rinkeby') { - name = this.props.t('connectingToRinkeby') + name = this.context.t('connectingToRinkeby') } else { - name = this.props.t('connectingToUnknown') + name = this.context.t('connectingToUnknown') } return name @@ -577,15 +583,15 @@ App.prototype.getNetworkName = function () { let name if (providerName === 'mainnet') { - name = this.props.t('mainnet') + name = this.context.t('mainnet') } else if (providerName === 'ropsten') { - name = this.props.t('ropsten') + name = this.context.t('ropsten') } else if (providerName === 'kovan') { - name = this.props.t('kovan') + name = this.context.t('kovan') } else if (providerName === 'rinkeby') { - name = this.props.t('rinkeby') + name = this.context.t('rinkeby') } else { - name = this.props.t('unknownNetwork') + name = this.context.t('unknownNetwork') } return name -- cgit