diff --git a/src/actions/ethereum/SendFormValidationActions.js b/src/actions/ethereum/SendFormValidationActions.js index f857bb28..e088d1bb 100644 --- a/src/actions/ethereum/SendFormValidationActions.js +++ b/src/actions/ethereum/SendFormValidationActions.js @@ -321,15 +321,23 @@ export const gasLimitValidation = ($state: State): PayloadAction => ( const { network } = getState().selectedAccount; if (!network) return state; + // get react-intl imperative api + const { language, messages } = getState().wallet; + const intlProvider = new IntlProvider({ language, messages }); + const { intl } = intlProvider.getChildContext(); + const { gasLimit } = state; if (gasLimit.length < 1) { - state.errors.gasLimit = 'Gas limit is not set'; + // state.errors.gasLimit = 'Gas limit is not set'; + state.errors.gasLimit = intl.formatMessage(l10nMessages.TR_GAS_LIMIT_IS_NOT_SET); } else if (gasLimit.length > 0 && !validators.isNumber(gasLimit)) { - state.errors.gasLimit = 'Gas limit is not a number'; + // state.errors.gasLimit = 'Gas limit is not a number'; + state.errors.gasLimit = intl.formatMessage(l10nMessages.TR_GAS_LIMIT_IS_NOT_A_NUMBER); } else { const gl: BigNumber = new BigNumber(gasLimit); if (gl.isLessThan(1)) { - state.errors.gasLimit = 'Gas limit is too low'; + // state.errors.gasLimit = 'Gas limit is too low'; + state.errors.gasLimit = intl.formatMessage(l10nMessages.TR_GAS_LIMIT_IS_TOO_LOW); } else if ( gl.isLessThan( state.currency !== state.networkSymbol @@ -337,7 +345,10 @@ export const gasLimitValidation = ($state: State): PayloadAction => ( : network.defaultGasLimit ) ) { - state.warnings.gasLimit = 'Gas limit is below recommended'; + // state.warnings.gasLimit = 'Gas limit is below recommended'; + state.warnings.gasLimit = intl.formatMessage( + l10nMessages.TR_GAS_LIMIT_IS_BELOW_RECOMMENDED + ); } } return state; diff --git a/src/views/Wallet/views/Account/Send/validation.messages.js b/src/views/Wallet/views/Account/Send/validation.messages.js index a9e020e3..fd8880ae 100644 --- a/src/views/Wallet/views/Account/Send/validation.messages.js +++ b/src/views/Wallet/views/Account/Send/validation.messages.js @@ -39,6 +39,22 @@ const definedMessages: Messages = defineMessages({ id: 'TR_ADDRESS_CHECKSUM_IS_NOT_VALID', defaultMessage: 'Address checksum is not valid', }, + TR_GAS_LIMIT_IS_NOT_SET: { + id: 'TR_GAS_LIMIT_IS_NOT_SET', + defaultMessage: 'Gas limit is not set', + }, + TR_GAS_LIMIT_IS_NOT_A_NUMBER: { + id: 'TR_GAS_LIMIT_IS_NOT_A_NUMBER', + defaultMessage: 'Gas limit is not a number', + }, + TR_GAS_LIMIT_IS_TOO_LOW: { + id: 'TR_GAS_LIMIT_IS_TOO_LOW', + defaultMessage: 'Gas limit is too low', + }, + TR_GAS_LIMIT_IS_BELOW_RECOMMENDED: { + id: 'TR_GAS_LIMIT_IS_BELOW_RECOMMENDED', + defaultMessage: 'Gas limit is below recommended', + }, }); export default definedMessages;