mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
prefer locale slice for locale state (#17499)
This commit is contained in:
parent
d9275bb1c1
commit
0885c6cd1f
@ -3,7 +3,7 @@ import { useHistory } from 'react-router-dom';
|
||||
import { useSelector } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
|
||||
import { getCurrentLocale } from '../../../ducks/locale/locale';
|
||||
import { I18nContext } from '../../../contexts/i18n';
|
||||
import { useEqualityCheck } from '../../../hooks/useEqualityCheck';
|
||||
import Button from '../../ui/button';
|
||||
|
@ -154,12 +154,6 @@ export default function reduceMetamask(state = {}, action) {
|
||||
welcomeScreenSeen: true,
|
||||
};
|
||||
|
||||
case actionConstants.SET_CURRENT_LOCALE:
|
||||
return {
|
||||
...metamaskState,
|
||||
currentLocale: action.value.locale,
|
||||
};
|
||||
|
||||
case actionConstants.SET_PENDING_TOKENS:
|
||||
return {
|
||||
...metamaskState,
|
||||
@ -250,8 +244,6 @@ export function updateGasFees({
|
||||
|
||||
// Selectors
|
||||
|
||||
export const getCurrentLocale = (state) => state.metamask.currentLocale;
|
||||
|
||||
export const getAlertEnabledness = (state) => state.metamask.alertEnabledness;
|
||||
|
||||
export const getUnconnectedAccountAlertEnabledness = (state) =>
|
||||
|
@ -248,18 +248,6 @@ describe('MetaMask Reducers', () => {
|
||||
expect(state.welcomeScreenSeen).toStrictEqual(true);
|
||||
});
|
||||
|
||||
it('sets current locale', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
{
|
||||
type: actionConstants.SET_CURRENT_LOCALE,
|
||||
value: { locale: 'ge' },
|
||||
},
|
||||
);
|
||||
|
||||
expect(state.currentLocale).toStrictEqual('ge');
|
||||
});
|
||||
|
||||
it('sets pending tokens', () => {
|
||||
const payload = {
|
||||
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import MetaFoxLogo from '../../../components/ui/metafox-logo';
|
||||
import Dropdown from '../../../components/ui/dropdown';
|
||||
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
|
||||
import { getCurrentLocale } from '../../../ducks/locale/locale';
|
||||
import { updateCurrentLocale } from '../../../store/actions';
|
||||
import locales from '../../../../app/_locales/index.json';
|
||||
|
||||
|
@ -37,6 +37,9 @@ describe('Onboarding Flow', () => {
|
||||
metamask: {
|
||||
identities: {},
|
||||
},
|
||||
localeMessages: {
|
||||
currentLocale: 'en',
|
||||
},
|
||||
};
|
||||
|
||||
const store = configureMockStore()(mockState);
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import { ONBOARDING_REVIEW_SRP_ROUTE } from '../../../helpers/constants/routes';
|
||||
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
|
||||
import { getCurrentLocale } from '../../../ducks/locale/locale';
|
||||
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
|
||||
import SkipSRPBackup from './skip-srp-backup-popover';
|
||||
|
||||
|
@ -28,6 +28,9 @@ describe('Secure Your Wallet Onboarding View', () => {
|
||||
type: 'test',
|
||||
},
|
||||
},
|
||||
localeMessages: {
|
||||
currentLocale: 'en',
|
||||
},
|
||||
};
|
||||
|
||||
const store = configureMockStore([thunk])(mockStore);
|
||||
|
Loading…
Reference in New Issue
Block a user