aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/redux
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-02-22 09:09:33 +0800
committerGitHub <noreply@github.com>2018-02-22 09:09:33 +0800
commitdfe2579eebdaf348bb2e5690f901ca717c5f6392 (patch)
tree59a0d97371fd69f79a54f6dd4f6c602561f04115 /packages/website/ts/redux
parentbe19316dfb45600b2ce264a90dde7ace460fd0ac (diff)
parent1b3a9102f1d9c83ca6675a0e95cea6c4ceab01eb (diff)
downloaddexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.tar
dexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.tar.gz
dexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.tar.bz2
dexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.tar.lz
dexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.tar.xz
dexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.tar.zst
dexon-sol-tools-dfe2579eebdaf348bb2e5690f901ca717c5f6392.zip
Merge pull request #410 from 0xProject/translateHomepage
Translate Landing Page
Diffstat (limited to 'packages/website/ts/redux')
-rw-r--r--packages/website/ts/redux/dispatcher.ts7
-rw-r--r--packages/website/ts/redux/reducer.ts15
2 files changed, 21 insertions, 1 deletions
diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts
index 925f2aa29..5c40ded2c 100644
--- a/packages/website/ts/redux/dispatcher.ts
+++ b/packages/website/ts/redux/dispatcher.ts
@@ -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,
+ });
+ }
}
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts
index c2a21dc07..1f489db85 100644
--- a/packages/website/ts/redux/reducer.ts
+++ b/packages/website/ts/redux/reducer.ts
@@ -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,13 +88,17 @@ const INITIAL_STATE: State = {
flashMessage: undefined,
providerType: ProviderType.Injected,
injectedProviderName: '',
+ translate: new Translate(),
};
export function reducer(state: State = INITIAL_STATE, action: Action) {
switch (action.type) {
// Portal
case ActionTypes.ResetState:
- return INITIAL_STATE;
+ return {
+ ...INITIAL_STATE,
+ translate: state.translate,
+ };
case ActionTypes.UpdateOrderSalt: {
return {
@@ -101,6 +107,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,