mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Replace i18n by a custom implementation (#638)
There are two problems with the current localization strategy: - We download the translations on-demand, which means that it does a serial roundtrip for nothing. - withTranslation helper actually renders the app 3 times on startup, instead of once (I haven't tried to debug it)
This commit is contained in:
parent
637276301a
commit
e4919e2e6c
21 changed files with 101 additions and 167 deletions
|
@ -1,22 +1,20 @@
|
|||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export function LanguageList<T>({
|
||||
onClick,
|
||||
onChange,
|
||||
languages,
|
||||
currentLanguage,
|
||||
}: {
|
||||
languages: { lng: string; label: string }[];
|
||||
onClick: (value: string) => void;
|
||||
onChange: (value: string) => void;
|
||||
currentLanguage: string;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<select
|
||||
className="language-select"
|
||||
onChange={({ target }) => onClick(target.value)}
|
||||
onChange={({ target }) => onChange(target.value)}
|
||||
value={currentLanguage}
|
||||
aria-label={t("buttons.selectLanguage")}
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue