Move translate to redux
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
ActionTypes,
|
||||
AssetToken,
|
||||
BlockchainErrs,
|
||||
Language,
|
||||
Order,
|
||||
ProviderType,
|
||||
ScreenWidths,
|
||||
@@ -211,4 +212,10 @@ export class Dispatcher {
|
||||
data: injectedProviderName,
|
||||
});
|
||||
}
|
||||
public updateSelectedLanguage(language: Language) {
|
||||
this._dispatch({
|
||||
type: ActionTypes.UpdateSelectedLanguage,
|
||||
data: language,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import {
|
||||
SideToAssetToken,
|
||||
TokenByAddress,
|
||||
} from 'ts/types';
|
||||
import { Translate } from 'ts/utils/translate';
|
||||
import { utils } from 'ts/utils/utils';
|
||||
|
||||
// Instead of defaulting the docs version to an empty string, we pre-populate it with
|
||||
@@ -49,6 +50,7 @@ export interface State {
|
||||
flashMessage: string | React.ReactNode;
|
||||
providerType: ProviderType;
|
||||
injectedProviderName: string;
|
||||
translate: Translate;
|
||||
}
|
||||
|
||||
const INITIAL_STATE: State = {
|
||||
@@ -86,6 +88,7 @@ const INITIAL_STATE: State = {
|
||||
flashMessage: undefined,
|
||||
providerType: ProviderType.Injected,
|
||||
injectedProviderName: '',
|
||||
translate: new Translate(),
|
||||
};
|
||||
|
||||
export function reducer(state: State = INITIAL_STATE, action: Action) {
|
||||
@@ -101,6 +104,13 @@ export function reducer(state: State = INITIAL_STATE, action: Action) {
|
||||
};
|
||||
}
|
||||
|
||||
case ActionTypes.UpdateSelectedLanguage: {
|
||||
return {
|
||||
...state,
|
||||
translate: new Translate(action.data),
|
||||
};
|
||||
}
|
||||
|
||||
case ActionTypes.UpdateNodeVersion: {
|
||||
return {
|
||||
...state,
|
||||
|
Reference in New Issue
Block a user