This commit is contained in:
2023-09-01 13:35:44 +01:00
parent 0c06f88a2d
commit 567258ce73
2 changed files with 9 additions and 15 deletions

View File

@ -11,12 +11,7 @@ async function importLang(code: string) {
return Object.fromEntries(ent) as Record<string, string>;
}
export const AllLocales = [
"en",
"de",
"es",
"th"
]
export const AllLocales = ["en", "de", "es", "th"];
const getMessages = (locale: string) => {
const truncatedLocale = locale.toLowerCase().split(/[_-]+/)[0];

View File

@ -30,9 +30,7 @@ export function LayoutPage() {
menuClassName="ctx-menu"
menuButton={
<div className="flex f-center g24">
<div className="flag">
</div>
<div className="flag"></div>
<div className="uppercase pointer">
<b>{lang.includes("-") ? lang.split("-")[0] : lang}</b>
</div>
@ -40,12 +38,13 @@ export function LayoutPage() {
}
align="end"
gap={5}>
{AllLocales.sort().map(l => <MenuItem onClick={() => setLang(l)} key={l}>
{new Intl.DisplayNames([l], {
type: "language",
}).of(l)}
</MenuItem>)}
{AllLocales.sort().map(l => (
<MenuItem onClick={() => setLang(l)} key={l}>
{new Intl.DisplayNames([l], {
type: "language",
}).of(l)}
</MenuItem>
))}
</Menu>
);
}