aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/dropdowns
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/components/dropdowns
parent29cc2f8ab9628d21cc32962666879c71be4e69d1 (diff)
downloadtangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.gz
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.bz2
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.lz
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.xz
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/components/dropdowns')
-rw-r--r--ui/app/components/dropdowns/components/account-dropdowns.js19
-rw-r--r--ui/app/components/dropdowns/network-dropdown.js27
-rw-r--r--ui/app/components/dropdowns/token-menu-dropdown.js3
3 files changed, 23 insertions, 26 deletions
diff --git a/ui/app/components/dropdowns/components/account-dropdowns.js b/ui/app/components/dropdowns/components/account-dropdowns.js
index 6de4d8280..d570b3d36 100644
--- a/ui/app/components/dropdowns/components/account-dropdowns.js
+++ b/ui/app/components/dropdowns/components/account-dropdowns.js
@@ -10,7 +10,6 @@ const Identicon = require('../../identicon')
const ethUtil = require('ethereumjs-util')
const copyToClipboard = require('copy-to-clipboard')
const { formatBalance } = require('../../../util')
-const t = require('../../../../i18n-helper').getMessage
class AccountDropdowns extends Component {
@@ -131,7 +130,7 @@ class AccountDropdowns extends Component {
actions.showEditAccountModal(identity)
},
}, [
- t(this.props.localeMessages, 'edit'),
+ this.props.t('edit'),
]),
]),
@@ -145,7 +144,7 @@ class AccountDropdowns extends Component {
try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type
const isLoose = type !== 'HD Key Tree'
- return isLoose ? h('.keyring-label.allcaps', t(this.props.localeMessages, 'loose')) : null
+ return isLoose ? h('.keyring-label.allcaps', this.props.t('loose')) : null
} catch (e) { return }
}
@@ -203,7 +202,7 @@ class AccountDropdowns extends Component {
fontSize: '16px',
lineHeight: '23px',
},
- }, t(this.props.localeMessages, 'createAccount')),
+ }, this.props.t('createAccount')),
],
),
h(
@@ -237,7 +236,7 @@ class AccountDropdowns extends Component {
fontSize: '16px',
lineHeight: '23px',
},
- }, t(this.props.localeMessages, 'importAccount')),
+ }, this.props.t('importAccount')),
]
),
]
@@ -288,7 +287,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t(this.props.localeMessages, 'accountDetails'),
+ this.props.t('accountDetails'),
),
h(
DropdownMenuItem,
@@ -304,7 +303,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t(this.props.localeMessages, 'etherscanView'),
+ this.props.t('etherscanView'),
),
h(
DropdownMenuItem,
@@ -320,7 +319,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t(this.props.localeMessages, 'copyAddress'),
+ this.props.t('copyAddress'),
),
h(
DropdownMenuItem,
@@ -332,7 +331,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t(this.props.localeMessages, 'exportPrivateKey'),
+ this.props.t('exportPrivateKey'),
),
h(
DropdownMenuItem,
@@ -347,7 +346,7 @@ class AccountDropdowns extends Component {
menuItemStyles,
),
},
- t(this.props.localeMessages, 'addToken'),
+ this.props.t('addToken'),
),
]
diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js
index 61c574aed..aac7a9ee5 100644
--- a/ui/app/components/dropdowns/network-dropdown.js
+++ b/ui/app/components/dropdowns/network-dropdown.js
@@ -7,7 +7,6 @@ const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const NetworkDropdownIcon = require('./components/network-dropdown-icon')
const R = require('ramda')
-const t = require('../../../i18n-helper').getMessage
// classes from nodes of the toggle element.
@@ -95,13 +94,13 @@ NetworkDropdown.prototype.render = function () {
}, [
h('div.network-dropdown-header', {}, [
- h('div.network-dropdown-title', {}, t(this.props.localeMessages, 'networks')),
+ h('div.network-dropdown-title', {}, this.props.t('networks')),
h('div.network-dropdown-divider'),
h('div.network-dropdown-content',
{},
- t(this.props.localeMessages, 'defaultNetwork')
+ this.props.t('defaultNetwork')
),
]),
@@ -123,7 +122,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'mainnet' ? '#ffffff' : '#9b9b9b',
},
- }, t(this.props.localeMessages, 'mainnet')),
+ }, this.props.t('mainnet')),
]
),
@@ -145,7 +144,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'ropsten' ? '#ffffff' : '#9b9b9b',
},
- }, t(this.props.localeMessages, 'ropsten')),
+ }, this.props.t('ropsten')),
]
),
@@ -167,7 +166,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'kovan' ? '#ffffff' : '#9b9b9b',
},
- }, t(this.props.localeMessages, 'kovan')),
+ }, this.props.t('kovan')),
]
),
@@ -189,7 +188,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: providerType === 'rinkeby' ? '#ffffff' : '#9b9b9b',
},
- }, t(this.props.localeMessages, 'rinkeby')),
+ }, this.props.t('rinkeby')),
]
),
@@ -211,7 +210,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b',
},
- }, t(this.props.localeMessages, 'localhost')),
+ }, this.props.t('localhost')),
]
),
@@ -235,7 +234,7 @@ NetworkDropdown.prototype.render = function () {
style: {
color: activeNetwork === 'custom' ? '#ffffff' : '#9b9b9b',
},
- }, t(this.props.localeMessages, 'customRPC')),
+ }, this.props.t('customRPC')),
]
),
@@ -250,15 +249,15 @@ NetworkDropdown.prototype.getNetworkName = function () {
let name
if (providerName === 'mainnet') {
- name = t(this.props.localeMessages, 'mainnet')
+ name = this.props.t('mainnet')
} else if (providerName === 'ropsten') {
- name = t(this.props.localeMessages, 'ropsten')
+ name = this.props.t('ropsten')
} else if (providerName === 'kovan') {
- name = t(this.props.localeMessages, 'kovan')
+ name = this.props.t('kovan')
} else if (providerName === 'rinkeby') {
- name = t(this.props.localeMessages, 'rinkeby')
+ name = this.props.t('rinkeby')
} else {
- name = t(this.props.localeMessages, 'unknownNetwork')
+ name = this.props.t('unknownNetwork')
}
return name
diff --git a/ui/app/components/dropdowns/token-menu-dropdown.js b/ui/app/components/dropdowns/token-menu-dropdown.js
index 403d17591..630e1f99d 100644
--- a/ui/app/components/dropdowns/token-menu-dropdown.js
+++ b/ui/app/components/dropdowns/token-menu-dropdown.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
module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown)
@@ -45,7 +44,7 @@ TokenMenuDropdown.prototype.render = function () {
showHideTokenConfirmationModal(this.props.token)
this.props.onClose()
},
- }, t(this.props.localeMessages, 'hideToken')),
+ }, this.props.t('hideToken')),
]),
]),