diff --git a/test/lib/render-helpers.js b/test/lib/render-helpers.js index 874c80846..3671ad129 100644 --- a/test/lib/render-helpers.js +++ b/test/lib/render-helpers.js @@ -27,14 +27,12 @@ export function mountWithRouter (component, store = {}, pathname = '/') { context: { router, t: (str) => str, - tOrKey: (str) => str, metricsEvent: () => {}, store, }, childContextTypes: { router: PropTypes.object, t: PropTypes.func, - tOrKey: PropTypes.func, metricsEvent: PropTypes.func, store: PropTypes.object, }, diff --git a/ui/app/helpers/higher-order-components/i18n-provider.js b/ui/app/helpers/higher-order-components/i18n-provider.js index 56a55d95b..7a4df814d 100644 --- a/ui/app/helpers/higher-order-components/i18n-provider.js +++ b/ui/app/helpers/higher-order-components/i18n-provider.js @@ -4,14 +4,6 @@ import PropTypes from 'prop-types' import { getMessage } from '../utils/i18n-helper' class I18nProvider extends Component { - tOrDefault = (key, defaultValue, ...args) => { - if (!key) { - return defaultValue - } - const { localeMessages: { current, en } = {}, currentLocale } = this.props - return getMessage(currentLocale, current, key, ...args) || getMessage(currentLocale, en, key, ...args) || defaultValue - } - getChildContext () { const { localeMessages, currentLocale } = this.props const { current, en } = localeMessages @@ -25,10 +17,6 @@ class I18nProvider extends Component { t (key, ...args) { return getMessage(currentLocale, current, key, ...args) || getMessage(currentLocale, en, key, ...args) || `[${key}]` }, - tOrDefault: this.tOrDefault, - tOrKey: (key, ...args) => { - return this.tOrDefault(key, key, ...args) - }, } } @@ -45,8 +33,6 @@ I18nProvider.propTypes = { I18nProvider.childContextTypes = { t: PropTypes.func, - tOrDefault: PropTypes.func, - tOrKey: PropTypes.func, } const mapStateToProps = (state) => { diff --git a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js index 6707cf1be..754c23b9b 100644 --- a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -21,7 +21,6 @@ import TextField from '../../components/ui/text-field' export default class ConfirmTransactionBase extends Component { static contextTypes = { t: PropTypes.func, - tOrKey: PropTypes.func.isRequired, metricsEvent: PropTypes.func, } @@ -311,7 +310,7 @@ export default class ConfirmTransactionBase extends Component { ) } - renderData () { + renderData (functionType) { const { t } = this.context const { txData: { @@ -320,12 +319,10 @@ export default class ConfirmTransactionBase extends Component { } = {}, } = {}, methodData: { - name, params, } = {}, hideData, dataComponent, - transactionCategory, } = this.props if (hideData) { @@ -337,7 +334,7 @@ export default class ConfirmTransactionBase extends Component {
{`${t('functionType')}:`} - { getMethodName(name) || this.context.tOrKey(transactionCategory) || this.context.t('contractInteraction') } + { functionType }
{ @@ -627,6 +624,7 @@ export default class ConfirmTransactionBase extends Component { } render () { + const { t } = this.context const { isTxReprice, fromName, @@ -660,6 +658,14 @@ export default class ConfirmTransactionBase extends Component { const { name } = methodData const { valid, errorKey } = this.getErrorKey() const { totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = this.getNavigateTxData() + + let functionType = getMethodName(name) + if (!functionType) { + functionType = transactionCategory + ? t(transactionCategory) + : t('contractInteraction') + } + return (