Sfoglia il codice sorgente

Fix language selection (#726)

BM 5 anni fa
parent
commit
a7dc067dfe
3 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 2 0
      src/appState.ts
  2. 1 1
      src/index.tsx
  3. 1 0
      src/types.ts

+ 2 - 0
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(),
   };
 }
 

+ 1 - 1
src/index.tsx

@@ -1820,7 +1820,7 @@ export class App extends React.Component<any, AppState> {
           <LanguageList
             onChange={lng => {
               setLanguage(lng);
-              this.setState({});
+              this.setState({ lng });
             }}
             languages={languages}
             currentLanguage={getLanguage()}

+ 1 - 0
src/types.ts

@@ -27,4 +27,5 @@ export type AppState = {
   name: string;
   selectedId?: string;
   isResizing: boolean;
+  lng: string;
 };