From a7dc067dfe081a058c8486bc989dbb7bb87dfa15 Mon Sep 17 00:00:00 2001 From: BM Date: Fri, 7 Feb 2020 10:43:30 +0000 Subject: [PATCH] Fix language selection (#726) --- src/appState.ts | 2 ++ src/index.tsx | 2 +- src/types.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/appState.ts b/src/appState.ts index f28e15dd..3ca929ea 100644 --- a/src/appState.ts +++ b/src/appState.ts @@ -1,5 +1,6 @@ import { AppState } from "./types"; import { getDateTime } from "./utils"; +import { getLanguage } from "./i18n"; const DEFAULT_PROJECT_NAME = `excalidraw-${getDateTime()}`; @@ -28,6 +29,7 @@ export function getDefaultAppState(): AppState { name: DEFAULT_PROJECT_NAME, isResizing: false, selectionElement: null, + lng: getLanguage(), }; } diff --git a/src/index.tsx b/src/index.tsx index f330ca76..fc67ac33 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1820,7 +1820,7 @@ export class App extends React.Component { { setLanguage(lng); - this.setState({}); + this.setState({ lng }); }} languages={languages} currentLanguage={getLanguage()} diff --git a/src/types.ts b/src/types.ts index 0fee4633..e570ec5c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -27,4 +27,5 @@ export type AppState = { name: string; selectedId?: string; isResizing: boolean; + lng: string; };