From 3cca6fc8862673eb96a04586c5d31438f875431a Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Wed, 12 Dec 2018 12:43:53 -0330 Subject: [PATCH] Add missing translation to the gas customization component. --- app/_locales/en/messages.json | 30 +++++++++++++++++++ .../advanced-tab-content.component.js | 14 +++++---- .../advanced-tab-content-component.test.js | 6 ++-- .../basic-tab-content.component.js | 7 +++-- .../tests/basic-tab-content-component.test.js | 2 +- .../gas-price-chart.component.js | 2 +- 6 files changed, 47 insertions(+), 14 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 400633c8c..ed757ca18 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -44,6 +44,9 @@ "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": { "message": "Accessing your camera..." }, @@ -212,6 +215,9 @@ "confirm": { "message": "Confirm" }, + "confirmationTime": { + "message": "Confirmation time (sec)" + }, "confirmed": { "message": "Confirmed" }, @@ -436,6 +442,9 @@ "etherscanView": { "message": "View account on Etherscan" }, + "estimatedProcessingTimes": { + "message": "Estimated Processing Times" + }, "exchangeRate": { "message": "Exchange Rate" }, @@ -454,6 +463,9 @@ "fast": { "message": "Fast" }, + "faster": { + "message": "Faster" + }, "fastest": { "message": "Fastest" }, @@ -514,6 +526,9 @@ "gasPrice": { "message": "Gas Price (GWEI)" }, + "gasPriceExtremelyLow": { + "message": "Gas Price Extremely Low" + }, "gasPriceNoDenom": { "message": "Gas Price" }, @@ -615,6 +630,9 @@ "initialTransactionConfirmed": { "message": "Your initial transaction was confirmed by the network. Click OK to go back." }, + "insufficientBalance": { + "message": "Insufficient balance." + }, "insufficientFunds": { "message": "Insufficient funds." }, @@ -680,6 +698,9 @@ "limit": { "message": "Limit" }, + "liveGasPricePredictions": { + "message": "Live Gas Price Predictions" + }, "loading": { "message": "Loading..." }, @@ -1044,6 +1065,9 @@ "slow": { "message": "Slow" }, + "slower": { + "message": "Slower" + }, "saveAsCsvFile": { "message": "Save as CSV File" }, @@ -1123,6 +1147,9 @@ "selectAnAccountHelp": { "message": "Select the account to view in MetaMask" }, + "selectAHigherGasFee": { + "message": "Select a higher gas fee to accelerate the processing of your transaction.*" + }, "selectHdPath": { "message": "Select HD Path" }, @@ -1452,5 +1479,8 @@ }, "yourPrivateSeedPhrase": { "message": "Your private seed phrase" + }, + "zeroGasPriceOnSpeedUpError": { + "message":"Zero gas price on speed up" } } diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js index 7c3142d0d..ba28ba63d 100644 --- a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js +++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js @@ -40,19 +40,20 @@ export default class AdvancedTabContent extends Component { } gasInputError ({ labelKey, insufficientBalance, customPriceIsSafe, isSpeedUp, value }) { + const { t } = this.context let errorText let errorType let isInError = true if (insufficientBalance) { - errorText = 'Insufficient Balance' + errorText = t('insufficientBalance') errorType = 'error' } else if (labelKey === 'gasPrice' && isSpeedUp && value === 0) { - errorText = 'Zero gas price on speed up' + errorText = t('zeroGasPriceOnSpeedUpError') errorType = 'error' } else if (labelKey === 'gasPrice' && !customPriceIsSafe) { - errorText = 'Gas Price Extremely Low' + errorText = t('gasPriceExtremelyLow') errorType = 'warning' } else { isInError = false @@ -164,6 +165,7 @@ export default class AdvancedTabContent extends Component { } render () { + const { t } = this.context const { updateCustomGasPrice, updateCustomGasLimit, @@ -191,14 +193,14 @@ export default class AdvancedTabContent extends Component { customPriceIsSafe, isSpeedUp, }) } -
Live Gas Price Predictions
+
{ t('liveGasPricePredictions') }
{!gasEstimatesLoading ? : }
- Slower - Faster + { t('slower') } + { t('faster') }
diff --git a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js index 00242e430..932be6290 100644 --- a/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js +++ b/ui/app/components/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js @@ -315,7 +315,7 @@ describe('AdvancedTabContent Component', function () { }) assert.deepEqual(gasInputError, { isInError: true, - errorText: 'Insufficient Balance', + errorText: 'insufficientBalance', errorType: 'error', }) }) @@ -330,7 +330,7 @@ describe('AdvancedTabContent Component', function () { }) assert.deepEqual(gasInputError, { isInError: true, - errorText: 'Zero gas price on speed up', + errorText: 'zeroGasPriceOnSpeedUpError', errorType: 'error', }) }) @@ -345,7 +345,7 @@ describe('AdvancedTabContent Component', function () { }) assert.deepEqual(gasInputError, { isInError: true, - errorText: 'Gas Price Extremely Low', + errorText: 'gasPriceExtremelyLow', errorType: 'warning', }) }) diff --git a/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js b/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js index 264d038da..05b8f700b 100644 --- a/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js +++ b/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js @@ -13,12 +13,13 @@ export default class BasicTabContent extends Component { } render () { + const { t } = this.context const { gasPriceButtonGroupProps } = this.props return (
-
Estimated Processing Times
-
Select a higher gas fee to accelerate the processing of your transaction.*
+
{ t('estimatedProcessingTimes') }
+
{ t('selectAHigherGasFee') }
{!gasPriceButtonGroupProps.loading ? : } -
* 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.
+
{ t('acceleratingATransaction') }
) } diff --git a/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js b/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js index 25abdd997..47864fcab 100644 --- a/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js +++ b/ui/app/components/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js @@ -1,6 +1,6 @@ import React from 'react' import assert from 'assert' -import { shallow } from 'enzyme' +import shallow from '../../../../../../lib/shallow-with-context' import BasicTabContent from '../basic-tab-content.component' import GasPriceButtonGroup from '../../../gas-price-button-group/' diff --git a/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js b/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js index d4c67bbde..c0eaf4852 100644 --- a/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js +++ b/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js @@ -32,7 +32,7 @@ export default class GasPriceChart extends Component { estimatedTimesMax, updateCustomGasPrice, }) { - const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax) + const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax, this.context.t) setTimeout(function () { setTickPosition('y', 0, -5, 8) setTickPosition('y', 1, -3, -5)