aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/accounts
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-22 08:41:47 +0800
committerDan <danjm.com@gmail.com>2018-03-22 08:41:47 +0800
commitd24a0590d363dbe88d383c8faec8eb28809242f0 (patch)
tree189e54ca9ea117804c96afa551cfca8158f36974 /ui/app/accounts
parent29cc2f8ab9628d21cc32962666879c71be4e69d1 (diff)
downloadtangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.gz
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.zst
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.zip
i18n redux solution doesn't require importing t() and passing state to each t() call; t is just available on props.
Diffstat (limited to 'ui/app/accounts')
-rw-r--r--ui/app/accounts/import/index.js15
-rw-r--r--ui/app/accounts/import/json.js17
-rw-r--r--ui/app/accounts/import/private-key.js7
-rw-r--r--ui/app/accounts/import/seed.js5
-rw-r--r--ui/app/accounts/new-account/create-form.js9
-rw-r--r--ui/app/accounts/new-account/index.js7
6 files changed, 27 insertions, 33 deletions
diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js
index 00b1aab8e..75552924b 100644
--- a/ui/app/accounts/import/index.js
+++ b/ui/app/accounts/import/index.js
@@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('../../metamask-connect')
-const t = require('../../../i18n-helper').getMessage
import Select from 'react-select'
// Subviews
@@ -15,8 +14,8 @@ module.exports = connect(mapStateToProps)(AccountImportSubview)
function mapStateToProps (state) {
return {
menuItems: [
- t(this.props.localeMessages, 'privateKey'),
- t(this.props.localeMessages, 'jsonFile'),
+ this.props.t('privateKey'),
+ this.props.t('jsonFile'),
],
}
}
@@ -36,7 +35,7 @@ AccountImportSubview.prototype.render = function () {
h('div.new-account-import-form', [
h('.new-account-import-disclaimer', [
- h('span', t('importAccountMsg')),
+ h('span', this.props.t('importAccountMsg')),
h('span', {
style: {
cursor: 'pointer',
@@ -47,12 +46,12 @@ AccountImportSubview.prototype.render = function () {
url: 'https://metamask.helpscoutdocs.com/article/17-what-are-loose-accounts',
})
},
- }, t('here')),
+ }, this.props.t('here')),
]),
h('div.new-account-import-form__select-section', [
- h('div.new-account-import-form__select-label', t('selectType')),
+ h('div.new-account-import-form__select-label', this.props.t('selectType')),
h(Select, {
className: 'new-account-import-form__select',
@@ -85,9 +84,9 @@ AccountImportSubview.prototype.renderImportView = function () {
const current = type || menuItems[0]
switch (current) {
- case t(this.props.localeMessages, 'privateKey'):
+ case this.props.t('privateKey'):
return h(PrivateKeyImportView)
- case t(this.props.localeMessages, 'jsonFile'):
+ case this.props.t('jsonFile'):
return h(JsonImportView)
default:
return h(JsonImportView)
diff --git a/ui/app/accounts/import/json.js b/ui/app/accounts/import/json.js
index 326e052f2..8bcc1a14e 100644
--- a/ui/app/accounts/import/json.js
+++ b/ui/app/accounts/import/json.js
@@ -4,7 +4,6 @@ const h = require('react-hyperscript')
const connect = require('../../metamask-connect')
const actions = require('../../actions')
const FileInput = require('react-simple-file-input').default
-const t = require('../../../i18n-helper').getMessage
const HELP_LINK = 'https://support.metamask.io/kb/article/7-importing-accounts'
@@ -25,11 +24,11 @@ class JsonImportSubview extends Component {
return (
h('div.new-account-import-form__json', [
- h('p', t(this.props.localeMessages, 'usedByClients')),
+ h('p', this.props.t('usedByClients')),
h('a.warning', {
href: HELP_LINK,
target: '_blank',
- }, t(this.props.localeMessages, 'fileImportFail')),
+ }, this.props.t('fileImportFail')),
h(FileInput, {
readAs: 'text',
@@ -44,7 +43,7 @@ class JsonImportSubview extends Component {
h('input.new-account-import-form__input-password', {
type: 'password',
- placeholder: t(this.props.localeMessages, 'enterPassword'),
+ placeholder: this.props.t('enterPassword'),
id: 'json-password-box',
onKeyPress: this.createKeyringOnEnter.bind(this),
}),
@@ -54,13 +53,13 @@ class JsonImportSubview extends Component {
h('button.new-account-create-form__button-cancel', {
onClick: () => this.props.goHome(),
}, [
- t(this.props.localeMessages, 'cancel'),
+ this.props.t('cancel'),
]),
h('button.new-account-create-form__button-create', {
onClick: () => this.createNewKeychain(),
}, [
- t(this.props.localeMessages, 'import'),
+ this.props.t('import'),
]),
]),
@@ -85,14 +84,14 @@ class JsonImportSubview extends Component {
const state = this.state
if (!state) {
- const message = t('validFileImport')
+ const message = this.props.t('validFileImport')
return this.props.displayWarning(message)
}
const { fileContents } = state
if (!fileContents) {
- const message = t(this.props.localeMessages, 'needImportFile')
+ const message = this.props.t('needImportFile')
return this.props.displayWarning(message)
}
@@ -100,7 +99,7 @@ class JsonImportSubview extends Component {
const password = passwordInput.value
if (!password) {
- const message = t(this.props.localeMessages, 'needImportPassword')
+ const message = this.props.t('needImportPassword')
return this.props.displayWarning(message)
}
diff --git a/ui/app/accounts/import/private-key.js b/ui/app/accounts/import/private-key.js
index 9a23b791a..40114ceca 100644
--- a/ui/app/accounts/import/private-key.js
+++ b/ui/app/accounts/import/private-key.js
@@ -3,7 +3,6 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('../../metamask-connect')
const actions = require('../../actions')
-const t = require('../../../i18n-helper').getMessage
module.exports = connect(mapStateToProps, mapDispatchToProps)(PrivateKeyImportView)
@@ -34,7 +33,7 @@ PrivateKeyImportView.prototype.render = function () {
return (
h('div.new-account-import-form__private-key', [
- h('span.new-account-create-form__instruction', t(this.props.localeMessages, 'pastePrivateKey')),
+ h('span.new-account-create-form__instruction', this.props.t('pastePrivateKey')),
h('div.new-account-import-form__private-key-password-container', [
@@ -51,13 +50,13 @@ PrivateKeyImportView.prototype.render = function () {
h('button.new-account-create-form__button-cancel.allcaps', {
onClick: () => goHome(),
}, [
- t(this.props.localeMessages, 'cancel'),
+ this.props.t('cancel'),
]),
h('button.new-account-create-form__button-create.allcaps', {
onClick: () => this.createNewKeychain(),
}, [
- t(this.props.localeMessages, 'import'),
+ this.props.t('import'),
]),
]),
diff --git a/ui/app/accounts/import/seed.js b/ui/app/accounts/import/seed.js
index d701feedc..5479a6be9 100644
--- a/ui/app/accounts/import/seed.js
+++ b/ui/app/accounts/import/seed.js
@@ -2,7 +2,6 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('../../metamask-connect')
-const t = require('../../../i18n-helper').getMessage
module.exports = connect(mapStateToProps)(SeedImportSubview)
@@ -21,10 +20,10 @@ SeedImportSubview.prototype.render = function () {
style: {
},
}, [
- t(this.props.localeMessages, 'pasteSeed'),
+ this.props.t('pasteSeed'),
h('textarea'),
h('br'),
- h('button', t(this.props.localeMessages, 'submit')),
+ h('button', this.props.t('submit')),
])
)
}
diff --git a/ui/app/accounts/new-account/create-form.js b/ui/app/accounts/new-account/create-form.js
index 6eed0215c..b0e109cd7 100644
--- a/ui/app/accounts/new-account/create-form.js
+++ b/ui/app/accounts/new-account/create-form.js
@@ -3,7 +3,6 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const connect = require('../../metamask-connect')
const actions = require('../../actions')
-const t = require('../../../i18n-helper').getMessage
class NewAccountCreateForm extends Component {
constructor (props) {
@@ -14,7 +13,7 @@ class NewAccountCreateForm extends Component {
this.state = {
newAccountName: '',
- defaultAccountName: t(this.props.localeMessages, 'newAccountNumberName', [newAccountNumber]),
+ defaultAccountName: this.props.t('newAccountNumberName', [newAccountNumber]),
}
}
@@ -25,7 +24,7 @@ class NewAccountCreateForm extends Component {
return h('div.new-account-create-form', [
h('div.new-account-create-form__input-label', {}, [
- t(this.props.localeMessages, 'accountName'),
+ this.props.t('accountName'),
]),
h('div.new-account-create-form__input-wrapper', {}, [
@@ -41,13 +40,13 @@ class NewAccountCreateForm extends Component {
h('button.new-account-create-form__button-cancel.allcaps', {
onClick: () => this.props.goHome(),
}, [
- t(this.props.localeMessages, 'cancel'),
+ this.props.t('cancel'),
]),
h('button.new-account-create-form__button-create.allcaps', {
onClick: () => this.props.createAccount(newAccountName || defaultAccountName),
}, [
- t(this.props.localeMessages, 'create'),
+ this.props.t('create'),
]),
]),
diff --git a/ui/app/accounts/new-account/index.js b/ui/app/accounts/new-account/index.js
index 8c305bfae..584016974 100644
--- a/ui/app/accounts/new-account/index.js
+++ b/ui/app/accounts/new-account/index.js
@@ -3,7 +3,6 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('../../metamask-connect')
const actions = require('../../actions')
-const t = require('../../../i18n-helper').getMessage
const { getCurrentViewContext } = require('../../selectors')
const classnames = require('classnames')
@@ -46,7 +45,7 @@ AccountDetailsModal.prototype.render = function () {
h('div.new-account__header', [
- h('div.new-account__title', t(this.props.localeMessages, 'newAccount')),
+ h('div.new-account__title', this.props.t('newAccount')),
h('div.new-account__tabs', [
@@ -56,7 +55,7 @@ AccountDetailsModal.prototype.render = function () {
'new-account__tabs__unselected cursor-pointer': displayedForm !== 'CREATE',
}),
onClick: () => displayForm('CREATE'),
- }, t(this.props.localeMessages, 'createDen')),
+ }, this.props.t('createDen')),
h('div.new-account__tabs__tab', {
className: classnames('new-account__tabs__tab', {
@@ -64,7 +63,7 @@ AccountDetailsModal.prototype.render = function () {
'new-account__tabs__unselected cursor-pointer': displayedForm !== 'IMPORT',
}),
onClick: () => displayForm('IMPORT'),
- }, t(this.props.localeMessages, 'import')),
+ }, this.props.t('import')),
]),