From 5fe0be722b6514692a68e920ee8058c5d572237d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 15 Mar 2018 21:59:45 -0230 Subject: Handle i18n with redux. --- ui/app/components/hex-as-decimal-input.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ui/app/components/hex-as-decimal-input.js') diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js index a43d44f89..7e53ba2f0 100644 --- a/ui/app/components/hex-as-decimal-input.js +++ b/ui/app/components/hex-as-decimal-input.js @@ -4,7 +4,7 @@ const inherits = require('util').inherits const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN const extend = require('xtend') -const t = require('../../i18n') +const t = require('../../i18n-helper').getMessage module.exports = HexAsDecimalInput @@ -127,13 +127,13 @@ HexAsDecimalInput.prototype.constructWarning = function () { let message = name ? name + ' ' : '' if (min && max) { - message += t('betweenMinAndMax', [min, max]) + message += t(this.props.localeMessages, 'betweenMinAndMax', [min, max]) } else if (min) { - message += t('greaterThanMin', [min]) + message += t(this.props.localeMessages, 'greaterThanMin', [min]) } else if (max) { - message += t('lessThanMax', [max]) + message += t(this.props.localeMessages, 'lessThanMax', [max]) } else { - message += t('invalidInput') + message += t(this.props.localeMessages, 'invalidInput') } return message -- cgit From d24a0590d363dbe88d383c8faec8eb28809242f0 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 21 Mar 2018 22:11:47 -0230 Subject: i18n redux solution doesn't require importing t() and passing state to each t() call; t is just available on props. --- ui/app/components/hex-as-decimal-input.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ui/app/components/hex-as-decimal-input.js') diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js index 7e53ba2f0..be7ba4c9e 100644 --- a/ui/app/components/hex-as-decimal-input.js +++ b/ui/app/components/hex-as-decimal-input.js @@ -4,9 +4,9 @@ const inherits = require('util').inherits const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN const extend = require('xtend') -const t = require('../../i18n-helper').getMessage +const connect = require('../metamask-connect') -module.exports = HexAsDecimalInput +module.exports = connect()(HexAsDecimalInput) inherits(HexAsDecimalInput, Component) function HexAsDecimalInput () { @@ -127,13 +127,13 @@ HexAsDecimalInput.prototype.constructWarning = function () { let message = name ? name + ' ' : '' if (min && max) { - message += t(this.props.localeMessages, 'betweenMinAndMax', [min, max]) + message += this.props.t('betweenMinAndMax', [min, max]) } else if (min) { - message += t(this.props.localeMessages, 'greaterThanMin', [min]) + message += this.props.t('greaterThanMin', [min]) } else if (max) { - message += t(this.props.localeMessages, 'lessThanMax', [max]) + message += this.props.t('lessThanMax', [max]) } else { - message += t(this.props.localeMessages, 'invalidInput') + message += this.props.t('invalidInput') } return message -- cgit