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

Add missing translation to the gas customization component.

This commit is contained in:
Dan Miller 2018-12-12 12:43:53 -03:30
parent 7c60414075
commit 3cca6fc886
6 changed files with 47 additions and 14 deletions

View File

@ -44,6 +44,9 @@
"accept": { "accept": {
"message": "Accept" "message": "Accept"
}, },
"acceleratingATransaction": {
"message": "* Accelerating a transaction by using a higher gas price increases its chances of getting processed by the network faster, but it is not always guaranteed."
},
"accessingYourCamera": { "accessingYourCamera": {
"message": "Accessing your camera..." "message": "Accessing your camera..."
}, },
@ -212,6 +215,9 @@
"confirm": { "confirm": {
"message": "Confirm" "message": "Confirm"
}, },
"confirmationTime": {
"message": "Confirmation time (sec)"
},
"confirmed": { "confirmed": {
"message": "Confirmed" "message": "Confirmed"
}, },
@ -436,6 +442,9 @@
"etherscanView": { "etherscanView": {
"message": "View account on Etherscan" "message": "View account on Etherscan"
}, },
"estimatedProcessingTimes": {
"message": "Estimated Processing Times"
},
"exchangeRate": { "exchangeRate": {
"message": "Exchange Rate" "message": "Exchange Rate"
}, },
@ -454,6 +463,9 @@
"fast": { "fast": {
"message": "Fast" "message": "Fast"
}, },
"faster": {
"message": "Faster"
},
"fastest": { "fastest": {
"message": "Fastest" "message": "Fastest"
}, },
@ -514,6 +526,9 @@
"gasPrice": { "gasPrice": {
"message": "Gas Price (GWEI)" "message": "Gas Price (GWEI)"
}, },
"gasPriceExtremelyLow": {
"message": "Gas Price Extremely Low"
},
"gasPriceNoDenom": { "gasPriceNoDenom": {
"message": "Gas Price" "message": "Gas Price"
}, },
@ -615,6 +630,9 @@
"initialTransactionConfirmed": { "initialTransactionConfirmed": {
"message": "Your initial transaction was confirmed by the network. Click OK to go back." "message": "Your initial transaction was confirmed by the network. Click OK to go back."
}, },
"insufficientBalance": {
"message": "Insufficient balance."
},
"insufficientFunds": { "insufficientFunds": {
"message": "Insufficient funds." "message": "Insufficient funds."
}, },
@ -680,6 +698,9 @@
"limit": { "limit": {
"message": "Limit" "message": "Limit"
}, },
"liveGasPricePredictions": {
"message": "Live Gas Price Predictions"
},
"loading": { "loading": {
"message": "Loading..." "message": "Loading..."
}, },
@ -1044,6 +1065,9 @@
"slow": { "slow": {
"message": "Slow" "message": "Slow"
}, },
"slower": {
"message": "Slower"
},
"saveAsCsvFile": { "saveAsCsvFile": {
"message": "Save as CSV File" "message": "Save as CSV File"
}, },
@ -1123,6 +1147,9 @@
"selectAnAccountHelp": { "selectAnAccountHelp": {
"message": "Select the account to view in MetaMask" "message": "Select the account to view in MetaMask"
}, },
"selectAHigherGasFee": {
"message": "Select a higher gas fee to accelerate the processing of your transaction.*"
},
"selectHdPath": { "selectHdPath": {
"message": "Select HD Path" "message": "Select HD Path"
}, },
@ -1452,5 +1479,8 @@
}, },
"yourPrivateSeedPhrase": { "yourPrivateSeedPhrase": {
"message": "Your private seed phrase" "message": "Your private seed phrase"
},
"zeroGasPriceOnSpeedUpError": {
"message":"Zero gas price on speed up"
} }
} }

View File

@ -40,19 +40,20 @@ export default class AdvancedTabContent extends Component {
} }
gasInputError ({ labelKey, insufficientBalance, customPriceIsSafe, isSpeedUp, value }) { gasInputError ({ labelKey, insufficientBalance, customPriceIsSafe, isSpeedUp, value }) {
const { t } = this.context
let errorText let errorText
let errorType let errorType
let isInError = true let isInError = true
if (insufficientBalance) { if (insufficientBalance) {
errorText = 'Insufficient Balance' errorText = t('insufficientBalance')
errorType = 'error' errorType = 'error'
} else if (labelKey === 'gasPrice' && isSpeedUp && value === 0) { } else if (labelKey === 'gasPrice' && isSpeedUp && value === 0) {
errorText = 'Zero gas price on speed up' errorText = t('zeroGasPriceOnSpeedUpError')
errorType = 'error' errorType = 'error'
} else if (labelKey === 'gasPrice' && !customPriceIsSafe) { } else if (labelKey === 'gasPrice' && !customPriceIsSafe) {
errorText = 'Gas Price Extremely Low' errorText = t('gasPriceExtremelyLow')
errorType = 'warning' errorType = 'warning'
} else { } else {
isInError = false isInError = false
@ -164,6 +165,7 @@ export default class AdvancedTabContent extends Component {
} }
render () { render () {
const { t } = this.context
const { const {
updateCustomGasPrice, updateCustomGasPrice,
updateCustomGasLimit, updateCustomGasLimit,
@ -191,14 +193,14 @@ export default class AdvancedTabContent extends Component {
customPriceIsSafe, customPriceIsSafe,
isSpeedUp, isSpeedUp,
}) } }) }
<div className="advanced-tab__fee-chart__title">Live Gas Price Predictions</div> <div className="advanced-tab__fee-chart__title">{ t('liveGasPricePredictions') }</div>
{!gasEstimatesLoading {!gasEstimatesLoading
? <GasPriceChart {...gasChartProps} updateCustomGasPrice={updateCustomGasPrice} /> ? <GasPriceChart {...gasChartProps} updateCustomGasPrice={updateCustomGasPrice} />
: <Loading /> : <Loading />
} }
<div className="advanced-tab__fee-chart__speed-buttons"> <div className="advanced-tab__fee-chart__speed-buttons">
<span>Slower</span> <span>{ t('slower') }</span>
<span>Faster</span> <span>{ t('faster') }</span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -315,7 +315,7 @@ describe('AdvancedTabContent Component', function () {
}) })
assert.deepEqual(gasInputError, { assert.deepEqual(gasInputError, {
isInError: true, isInError: true,
errorText: 'Insufficient Balance', errorText: 'insufficientBalance',
errorType: 'error', errorType: 'error',
}) })
}) })
@ -330,7 +330,7 @@ describe('AdvancedTabContent Component', function () {
}) })
assert.deepEqual(gasInputError, { assert.deepEqual(gasInputError, {
isInError: true, isInError: true,
errorText: 'Zero gas price on speed up', errorText: 'zeroGasPriceOnSpeedUpError',
errorType: 'error', errorType: 'error',
}) })
}) })
@ -345,7 +345,7 @@ describe('AdvancedTabContent Component', function () {
}) })
assert.deepEqual(gasInputError, { assert.deepEqual(gasInputError, {
isInError: true, isInError: true,
errorText: 'Gas Price Extremely Low', errorText: 'gasPriceExtremelyLow',
errorType: 'warning', errorType: 'warning',
}) })
}) })

View File

@ -13,12 +13,13 @@ export default class BasicTabContent extends Component {
} }
render () { render () {
const { t } = this.context
const { gasPriceButtonGroupProps } = this.props const { gasPriceButtonGroupProps } = this.props
return ( return (
<div className="basic-tab-content"> <div className="basic-tab-content">
<div className="basic-tab-content__title">Estimated Processing Times</div> <div className="basic-tab-content__title">{ t('estimatedProcessingTimes') }</div>
<div className="basic-tab-content__blurb">Select a higher gas fee to accelerate the processing of your transaction.*</div> <div className="basic-tab-content__blurb">{ t('selectAHigherGasFee') }</div>
{!gasPriceButtonGroupProps.loading {!gasPriceButtonGroupProps.loading
? <GasPriceButtonGroup ? <GasPriceButtonGroup
className="gas-price-button-group--alt" className="gas-price-button-group--alt"
@ -27,7 +28,7 @@ export default class BasicTabContent extends Component {
/> />
: <Loading /> : <Loading />
} }
<div className="basic-tab-content__footer-blurb">* Accelerating a transaction by using a higher gas price increases its chances of getting processed by the network faster, but it is not always guaranteed.</div> <div className="basic-tab-content__footer-blurb">{ t('acceleratingATransaction') }</div>
</div> </div>
) )
} }

View File

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import assert from 'assert' import assert from 'assert'
import { shallow } from 'enzyme' import shallow from '../../../../../../lib/shallow-with-context'
import BasicTabContent from '../basic-tab-content.component' import BasicTabContent from '../basic-tab-content.component'
import GasPriceButtonGroup from '../../../gas-price-button-group/' import GasPriceButtonGroup from '../../../gas-price-button-group/'

View File

@ -32,7 +32,7 @@ export default class GasPriceChart extends Component {
estimatedTimesMax, estimatedTimesMax,
updateCustomGasPrice, updateCustomGasPrice,
}) { }) {
const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax) const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax, this.context.t)
setTimeout(function () { setTimeout(function () {
setTickPosition('y', 0, -5, 8) setTickPosition('y', 0, -5, 8)
setTickPosition('y', 1, -3, -5) setTickPosition('y', 1, -3, -5)