diff --git a/packages/client/src/i18n/reducer.ts b/packages/client/src/i18n/reducer.ts index 8eae65c301..5ac0a6d197 100644 --- a/packages/client/src/i18n/reducer.ts +++ b/packages/client/src/i18n/reducer.ts @@ -164,14 +164,19 @@ export const intlReducer: LoopReducer = ( switch (action.type) { case actions.CHANGE_LANGUAGE: const messages = getNextMessages(action.payload.language, state.languages) + let language = action.payload.language + + if (!state.languages[language]) { + language = getDefaultLanguage() + } return loop( { ...state, - language: action.payload.language, + language, messages }, - Cmd.run(() => storeLanguage(action.payload.language)) + Cmd.run(() => storeLanguage(language)) ) case offlineActions.READY: diff --git a/packages/login/src/i18n/reducer.ts b/packages/login/src/i18n/reducer.ts index 0bedc672e5..e129286c4a 100644 --- a/packages/login/src/i18n/reducer.ts +++ b/packages/login/src/i18n/reducer.ts @@ -124,14 +124,19 @@ export const intlReducer: LoopReducer = ( } case actions.CHANGE_LANGUAGE: const messages = getNextMessages(action.payload.language, state.languages) + let language = action.payload.language + + if (!state.languages[language]) { + language = getDefaultLanguage() + } return loop( { ...state, - language: action.payload.language, + language, messages }, - Cmd.run(() => storeLanguage(action.payload.language)) + Cmd.run(() => storeLanguage(language)) ) default: return state