feat: Add language separator and list English twice (#2739)
This commit is contained in:
parent
eb71e571e0
commit
bafbe9bbc8
@ -22,6 +22,10 @@ export const LanguageList = ({
|
||||
value={currentLangCode}
|
||||
aria-label={i18n.t("buttons.selectLanguage")}
|
||||
>
|
||||
<option key={i18n.defaultLang.code} value={i18n.defaultLang.code}>
|
||||
{i18n.defaultLang.label}
|
||||
</option>
|
||||
<option disabled>{"──────────"}</option>
|
||||
{languages.map((lang) => (
|
||||
<option key={lang.code} value={lang.code}>
|
||||
{lang.label}
|
||||
|
12
src/i18n.ts
12
src/i18n.ts
@ -9,6 +9,8 @@ export interface Language {
|
||||
rtl?: boolean;
|
||||
}
|
||||
|
||||
export const defaultLang = { code: "en", label: "English" };
|
||||
|
||||
const allLanguages: Language[] = [
|
||||
{ code: "ar-SA", label: "العربية", rtl: true },
|
||||
{ code: "bg-BG", label: "Български" },
|
||||
@ -42,14 +44,10 @@ const allLanguages: Language[] = [
|
||||
{ code: "uk-UA", label: "Українська" },
|
||||
{ code: "zh-CN", label: "简体中文" },
|
||||
{ code: "zh-TW", label: "繁體中文" },
|
||||
];
|
||||
].concat([defaultLang]);
|
||||
|
||||
export const defaultLang = { code: "en", label: "English" };
|
||||
|
||||
export const languages: Language[] = [defaultLang]
|
||||
.concat(
|
||||
allLanguages.sort((left, right) => (left.label > right.label ? 1 : -1)),
|
||||
)
|
||||
export const languages: Language[] = allLanguages
|
||||
.sort((left, right) => (left.label > right.label ? 1 : -1))
|
||||
.filter(
|
||||
(lang) =>
|
||||
(percentages as Record<string, number>)[lang.code] >=
|
||||
|
Loading…
x
Reference in New Issue
Block a user