1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

move hardcoded strings to localization file

This commit is contained in:
brunobar79 2018-07-02 15:16:05 -04:00
parent 86a8c98148
commit f19ffaf08d
2 changed files with 22 additions and 17 deletions

View File

@ -11,6 +11,9 @@
"accountName": {
"message": "Account Name"
},
"accountSelectionRequired": {
"message": "You need to select an account!"
},
"address": {
"message": "Address"
},
@ -125,6 +128,12 @@
"connect": {
"message": "Connect"
},
"connecting": {
"message": "Connecting..."
},
"connectToTrezor": {
"message": "Connect to Trezor"
},
"continue": {
"message": "Continue"
},
@ -618,6 +627,9 @@
"popularTokens": {
"message": "Popular Tokens"
},
"prev": {
"message": "Prev"
},
"privacyMsg": {
"message": "Privacy Policy"
},
@ -793,6 +805,9 @@
"searchTokens": {
"message": "Search Tokens"
},
"selectAnAddress": {
"message": "Select an Address"
},
"sendTokensAnywhere": {
"message": "Send Tokens to anyone with an Ethereum account"
},

View File

@ -4,7 +4,6 @@ const h = require('react-hyperscript')
const connect = require('react-redux').connect
const actions = require('../../../actions')
const genAccountLink = require('../../../../lib/account-link.js')
const log = require('loglevel')
const { DEFAULT_ROUTE } = require('../../../routes')
const { formatBalance } = require('../../../util')
@ -14,7 +13,7 @@ class ConnectHardwareForm extends Component {
this.state = {
error: null,
response: null,
btnText: 'Connect to Trezor', // Test
btnText: context.t('connectToTrezor'),
selectedAccount: '',
accounts: [],
}
@ -24,7 +23,7 @@ class ConnectHardwareForm extends Component {
if (this.state.accounts.length) {
return null
}
this.setState({ btnText: 'Connecting...' })
this.setState({ btnText: this.context.t('connecting')})
this.getPage(1)
}
@ -37,21 +36,18 @@ class ConnectHardwareForm extends Component {
}
})
.catch(e => {
this.setState({ btnText: 'Connect to Trezor' })
this.setState({ btnText: this.context.t('connectToTrezor') })
})
}
unlockAccount () {
if (this.state.selectedAccount === '') {
return Promise.reject({ error: 'You need to select an account!' })
return Promise.reject({ error: this.context.t('accountSelectionRequired') })
}
log.debug('should unlock account ', this.state.selectedAccount)
return this.props.unlockTrezorAccount(this.state.selectedAccount)
}
handleRadioChange = e => {
log.debug('Selected account with index ', e.target.value)
this.setState({
selectedAccount: e.target.value,
error: null,
@ -60,12 +56,9 @@ class ConnectHardwareForm extends Component {
getBalance (address) {
// Get the balance
log.debug('getBalance : ', address)
const { accounts } = this.props
const balanceValue = accounts && accounts[address] ? accounts[address].balance : ''
log.debug('balanceValue : ', balanceValue)
const formattedBalance = balanceValue ? formatBalance(balanceValue, 6) : '...'
log.debug('formattedBalance : ', formattedBalance)
return formattedBalance
}
@ -74,12 +67,9 @@ class ConnectHardwareForm extends Component {
return null
}
log.debug('ACCOUNTS : ', this.state.accounts)
log.debug('SELECTED?', this.state.selectedAccount)
return h('div.hw-account-list', [
h('div.hw-account-list__title_wrapper', [
h('div.hw-account-list__title', {}, ['Select an Address']),
h('div.hw-account-list__title', {}, [this.context.t('selectAnAddress')]),
h('div.hw-account-list__device', {}, ['Trezor - ETH']),
]),
this.state.accounts.map((a, i) => {
@ -127,7 +117,7 @@ class ConnectHardwareForm extends Component {
{
onClick: () => this.getPage(-1),
},
'< Prev'
`< ${this.context.t('prev')}`
),
h(
@ -135,7 +125,7 @@ class ConnectHardwareForm extends Component {
{
onClick: () => this.getPage(1),
},
'Next >'
`${this.context.t('next')} >`
),
])
}