fix(i18n): add missing translation keys, update lang/locale logic

This commit is contained in:
Amruth Pillai
2022-03-11 08:43:20 +01:00
parent 8bc7d2599e
commit 7d8828a358
35 changed files with 124 additions and 113 deletions

View File

@ -1,8 +1,6 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import merge from 'lodash/merge';
import { Language, languageMap } from '@/config/languages';
export type Theme = 'light' | 'dark';
export type Sidebar = 'left' | 'right';
@ -13,7 +11,6 @@ export type Orientation = 'horizontal' | 'vertical';
export type BuildState = {
theme?: Theme;
language: Language;
sidebar: Record<Sidebar, SidebarState>;
page: {
breakLine: boolean;
@ -22,7 +19,6 @@ export type BuildState = {
};
const initialState: BuildState = {
language: languageMap['en'],
sidebar: {
left: { open: false },
right: { open: false },
@ -35,8 +31,6 @@ const initialState: BuildState = {
type SetThemePayload = { theme: Theme };
type SetLanguagePayload = { language: string };
type ToggleSidebarPayload = { sidebar: Sidebar };
type SetSidebarStatePayload = { sidebar: Sidebar; state: SidebarState };
@ -50,11 +44,6 @@ export const buildSlice = createSlice({
state.theme = theme;
},
setLanguage: (state, action: PayloadAction<SetLanguagePayload>) => {
const { language } = action.payload;
state.language = languageMap[language];
},
toggleSidebar: (state, action: PayloadAction<ToggleSidebarPayload>) => {
const { sidebar } = action.payload;
@ -76,7 +65,7 @@ export const buildSlice = createSlice({
},
});
export const { setTheme, setLanguage, toggleSidebar, setSidebarState, togglePageBreakLine, togglePageOrientation } =
export const { setTheme, toggleSidebar, setSidebarState, togglePageBreakLine, togglePageOrientation } =
buildSlice.actions;
export default buildSlice.reducer;