diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js index 8e3960ce4..ed0a3b45e 100644 --- a/ui/app/components/customize-gas-modal/index.js +++ b/ui/app/components/customize-gas-modal/index.js @@ -280,16 +280,16 @@ CustomizeGasModal.prototype.render = function () { h('div.send-v2__customize-gas__revert', { onClick: () => this.revert(), - }, [t('revert')]), + }, [t(this.props.localeMessages, 'revert')]), h('div.send-v2__customize-gas__buttons', [ h('div.send-v2__customize-gas__cancel.allcaps', { onClick: this.props.hideModal, - }, [t('cancel')]), + }, [t(this.props.localeMessages, 'cancel')]), h(`div.send-v2__customize-gas__save${error ? '__error' : ''}.allcaps`, { onClick: () => !error && this.save(gasPrice, gasLimit, gasTotal), - }, [t('save')]), + }, [t(this.props.localeMessages, 'save')]), ]), ]), diff --git a/ui/app/components/modals/deposit-ether-modal.js b/ui/app/components/modals/deposit-ether-modal.js index 500a225c7..307e89a47 100644 --- a/ui/app/components/modals/deposit-ether-modal.js +++ b/ui/app/components/modals/deposit-ether-modal.js @@ -123,7 +123,7 @@ DepositEtherModal.prototype.render = function () { h('div.page-container__header', [ - h('div.page-container__title', [t('depositEther')]), + h('div.page-container__title', [t(this.props.localeMessages, 'depositEther')]), h('div.page-container__subtitle', [ t(this.props.localeMessages, 'needEtherInWallet'), diff --git a/ui/app/components/modals/edit-account-name-modal.js b/ui/app/components/modals/edit-account-name-modal.js index 02de5b99c..a64a41b27 100644 --- a/ui/app/components/modals/edit-account-name-modal.js +++ b/ui/app/components/modals/edit-account-name-modal.js @@ -51,7 +51,7 @@ EditAccountNameModal.prototype.render = function () { ]), h('div.edit-account-name-modal-title', { - }, [t('editAccountName')]), + }, [t(this.props.localeMessages, 'editAccountName')]), h('input.edit-account-name-modal-input', { placeholder: identity.name, diff --git a/ui/app/components/modals/new-account-modal.js b/ui/app/components/modals/new-account-modal.js index 7f9b7a154..2744af0b3 100644 --- a/ui/app/components/modals/new-account-modal.js +++ b/ui/app/components/modals/new-account-modal.js @@ -1,7 +1,7 @@ const { Component } = require('react') const PropTypes = require('prop-types') const h = require('react-hyperscript') -const { connect } = require('react-redux') +const connect = require('../../metamask-connect') const actions = require('../../actions') const t = require('../../../i18n-helper').getMessage diff --git a/ui/app/components/modals/notification-modal.js b/ui/app/components/modals/notification-modal.js index c05d80251..ba2c92c92 100644 --- a/ui/app/components/modals/notification-modal.js +++ b/ui/app/components/modals/notification-modal.js @@ -1,7 +1,7 @@ const { Component } = require('react') const PropTypes = require('prop-types') const h = require('react-hyperscript') -const { connect } = require('react-redux') +const connect = require('../../metamask-connect') const actions = require('../../actions') const t = require('../../../i18n-helper').getMessage @@ -23,12 +23,12 @@ class NotificationModal extends Component { }, [ h('div.notification-modal__header', {}, [ - t(header), + t(this.props.localeMessages, header), ]), h('div.notification-modal__message-wrapper', {}, [ h('div.notification-modal__message', {}, [ - t(message), + t(this.props.localeMessages, message), ]), ]), diff --git a/ui/app/components/modals/notification-modals/confirm-reset-account.js b/ui/app/components/modals/notification-modals/confirm-reset-account.js index e1bc91b24..94ee997ab 100644 --- a/ui/app/components/modals/notification-modals/confirm-reset-account.js +++ b/ui/app/components/modals/notification-modals/confirm-reset-account.js @@ -1,7 +1,7 @@ const { Component } = require('react') const PropTypes = require('prop-types') const h = require('react-hyperscript') -const { connect } = require('react-redux') +const connect = require('../../../metamask-connect') const actions = require('../../../actions') const NotifcationModal = require('../notification-modal') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index d3a36b012..25003fd16 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -1,11 +1,12 @@ const Component = require('react').Component const h = require('react-hyperscript') +const connect = require('../metamask-connect') const classnames = require('classnames') const inherits = require('util').inherits const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon') const t = require('../../i18n-helper').getMessage -module.exports = Network +module.exports = connect()(Network) inherits(Network, Component) @@ -78,6 +79,8 @@ Network.prototype.render = function () { }, }, [ (function () { + console.log(`12312312312312312 props.localeMessages`, props.localeMessages); + console.log(`12312312312312312 t(props.localeMessages, 'mainnet')`, t(props.localeMessages, 'mainnet')); switch (iconName) { case 'ethereum-network': return h('.network-indicator', [ diff --git a/ui/app/components/pending-tx/confirm-deploy-contract.js b/ui/app/components/pending-tx/confirm-deploy-contract.js index 340653422..bc93ad2f7 100644 --- a/ui/app/components/pending-tx/confirm-deploy-contract.js +++ b/ui/app/components/pending-tx/confirm-deploy-contract.js @@ -1,5 +1,5 @@ const { Component } = require('react') -const { connect } = require('react-redux') +const connect = require('../../metamask-connect') const h = require('react-hyperscript') const PropTypes = require('prop-types') const actions = require('../../actions') diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js index be3a9d993..3a72f575f 100644 --- a/ui/app/components/pending-tx/confirm-send-ether.js +++ b/ui/app/components/pending-tx/confirm-send-ether.js @@ -1,5 +1,5 @@ const Component = require('react').Component -const { connect } = require('react-redux') +const connect = require('../../metamask-connect') const h = require('react-hyperscript') const inherits = require('util').inherits const actions = require('../../actions') diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js index fe5c80711..238223321 100644 --- a/ui/app/components/pending-tx/confirm-send-token.js +++ b/ui/app/components/pending-tx/confirm-send-token.js @@ -1,5 +1,5 @@ const Component = require('react').Component -const { connect } = require('react-redux') +const connect = require('../../metamask-connect') const h = require('react-hyperscript') const inherits = require('util').inherits const tokenAbi = require('human-standard-token-abi') diff --git a/ui/app/components/pending-tx/index.js b/ui/app/components/pending-tx/index.js index f4f6afb8f..e490a45f4 100644 --- a/ui/app/components/pending-tx/index.js +++ b/ui/app/components/pending-tx/index.js @@ -1,5 +1,5 @@ const Component = require('react').Component -const { connect } = require('react-redux') +const connect = require('../../metamask-connect') const h = require('react-hyperscript') const clone = require('clone') const abi = require('human-standard-token-abi') diff --git a/ui/app/components/send/gas-tooltip.js b/ui/app/components/send/gas-tooltip.js index 8411fd61b..7bdb164c7 100644 --- a/ui/app/components/send/gas-tooltip.js +++ b/ui/app/components/send/gas-tooltip.js @@ -82,7 +82,7 @@ GasTooltip.prototype.render = function () { 'marginTop': '81px', }, }, [ - h('span.gas-tooltip-label', {}, [t('gasLimit')]), + h('span.gas-tooltip-label', {}, [t(this.props.localeMessages, 'gasLimit')]), h('i.fa.fa-info-circle'), ]), h(InputNumber, { diff --git a/ui/app/components/sender-to-recipient.js b/ui/app/components/sender-to-recipient.js index a0e90a37f..530c4abae 100644 --- a/ui/app/components/sender-to-recipient.js +++ b/ui/app/components/sender-to-recipient.js @@ -30,7 +30,7 @@ class SenderToRecipient extends Component { ]), h('.sender-to-recipient__recipient', [ h('i.fa.fa-file-text-o'), - h('.sender-to-recipient__name.sender-to-recipient__recipient-name', t('newContract')), + h('.sender-to-recipient__name.sender-to-recipient__recipient-name', t(this.props.localeMessages, 'newContract')), ]), ]) ) diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 46b16975a..f915135f6 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -240,7 +240,7 @@ ShapeshiftForm.prototype.render = function () { className: btnClass, disabled: !token, onClick: () => this.onBuyWithShapeShift(), - }, [t('buy')]), + }, [t(this.props.localeMessages, 'buy')]), ]) } diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js index d6dd424ec..7f4493b66 100644 --- a/ui/app/components/signature-request.js +++ b/ui/app/components/signature-request.js @@ -76,7 +76,7 @@ SignatureRequest.prototype.renderAccountDropdown = function () { return h('div.request-signature__account', [ - h('div.request-signature__account-text', [t('account') + ':']), + h('div.request-signature__account-text', [t(this.props.localeMessages, 'account') + ':']), h(AccountDropdownMini, { selectedAccount, @@ -103,7 +103,7 @@ SignatureRequest.prototype.renderBalance = function () { return h('div.request-signature__balance', [ - h('div.request-signature__balance-text', [t('balance')]), + h('div.request-signature__balance-text', [t(this.props.localeMessages, 'balance')]), h('div.request-signature__balance-value', `${balanceInEther} ETH`), diff --git a/ui/app/metamask-connect.js b/ui/app/metamask-connect.js index eef90529b..d13f8e87e 100644 --- a/ui/app/metamask-connect.js +++ b/ui/app/metamask-connect.js @@ -8,8 +8,10 @@ const metamaskConnect = (mapStateToProps, mapDispatchToProps) => { } const _higherOrderMapStateToProps = (mapStateToProps) => { - return (state, ownProps) => { - const stateProps = mapStateToProps(state, ownProps) + return (state, ownProps = {}) => { + const stateProps = mapStateToProps + ? mapStateToProps(state, ownProps) + : ownProps stateProps.localeMessages = state.localeMessages || {} return stateProps } diff --git a/ui/app/settings.js b/ui/app/settings.js index 809792f79..2280b189b 100644 --- a/ui/app/settings.js +++ b/ui/app/settings.js @@ -1,7 +1,7 @@ const { Component } = require('react') const PropTypes = require('prop-types') const h = require('react-hyperscript') -const { connect } = require('react-redux') +const connect = require('./metamask-connect') const actions = require('./actions') const infuraCurrencies = require('./infura-conversion.json') const validUrl = require('valid-url') diff --git a/ui/i18n-helper.js b/ui/i18n-helper.js index 7ad8cd040..345e83f00 100644 --- a/ui/i18n-helper.js +++ b/ui/i18n-helper.js @@ -12,7 +12,7 @@ const getMessage = (locale, key, substitutions) => { const entry = locale[key] if (!entry) { log.error(`Translator - Unable to find value for "${key}"`) - throw new Error(`Translator - Unable to find value for "${key}"`) + // throw new Error(`Translator - Unable to find value for "${key}"`) } let phrase = entry.message // perform substitutions