mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Refactor getLanguage
This commit is contained in:
parent
cba0a57ce3
commit
e0e1e4fde7
4 changed files with 3 additions and 8 deletions
|
@ -76,7 +76,7 @@ import { actions } from "../actions/register";
|
|||
|
||||
import { ActionResult } from "../actions/types";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { t, getLanguage } from "../i18n";
|
||||
import { t } from "../i18n";
|
||||
|
||||
import {
|
||||
copyToAppClipboard,
|
||||
|
@ -194,7 +194,6 @@ export class App extends React.Component<any, AppState> {
|
|||
return !element.isDeleted;
|
||||
})}
|
||||
setElements={this.setElements}
|
||||
language={getLanguage()}
|
||||
onRoomCreate={this.createRoom}
|
||||
onRoomDestroy={this.destroyRoom}
|
||||
onLockToggle={this.toggleLock}
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as i18n from "../i18n";
|
|||
export function LanguageList({
|
||||
onChange,
|
||||
languages = i18n.languages,
|
||||
currentLanguage = i18n.getLanguage(),
|
||||
currentLanguage = i18n.getLanguage().lng,
|
||||
floating,
|
||||
}: {
|
||||
languages?: { lng: string; label: string }[];
|
||||
|
|
|
@ -30,7 +30,6 @@ interface LayerUIProps {
|
|||
canvas: HTMLCanvasElement | null;
|
||||
setAppState: any;
|
||||
elements: readonly ExcalidrawElement[];
|
||||
language: string;
|
||||
setElements: (elements: readonly ExcalidrawElement[]) => void;
|
||||
onRoomCreate: () => void;
|
||||
onRoomDestroy: () => void;
|
||||
|
@ -44,7 +43,6 @@ export const LayerUI = React.memo(
|
|||
setAppState,
|
||||
canvas,
|
||||
elements,
|
||||
language,
|
||||
setElements,
|
||||
onRoomCreate,
|
||||
onRoomDestroy,
|
||||
|
@ -191,7 +189,6 @@ export const LayerUI = React.memo(
|
|||
setAppState({});
|
||||
}}
|
||||
languages={languages}
|
||||
currentLanguage={language}
|
||||
floating
|
||||
/>
|
||||
{appState.scrolledOutside && (
|
||||
|
@ -228,7 +225,6 @@ export const LayerUI = React.memo(
|
|||
const keys = Object.keys(prevAppState) as (keyof Partial<AppState>)[];
|
||||
|
||||
return (
|
||||
prev.language === next.language &&
|
||||
prev.elements === next.elements &&
|
||||
keys.every((key) => prevAppState[key] === nextAppState[key])
|
||||
);
|
||||
|
|
|
@ -42,7 +42,7 @@ export function setLanguage(newLng: string | undefined) {
|
|||
}
|
||||
|
||||
export function getLanguage() {
|
||||
return currentLanguage.lng;
|
||||
return currentLanguage;
|
||||
}
|
||||
|
||||
function findPartsForData(data: any, parts: string[]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue