fix: language list containing duplicate en
lang (#6583)
This commit is contained in:
parent
306e133651
commit
5bf27a463c
@ -538,6 +538,10 @@
|
||||
height: 3px;
|
||||
}
|
||||
|
||||
select::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: var(--scrollbar-thumb);
|
||||
border-radius: 10px;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useSetAtom } from "jotai";
|
||||
import React from "react";
|
||||
import { appLangCodeAtom } from "..";
|
||||
import { defaultLang, useI18n } from "../../i18n";
|
||||
import { useI18n } from "../../i18n";
|
||||
import { languages } from "../../i18n";
|
||||
|
||||
export const LanguageList = ({ style }: { style?: React.CSSProperties }) => {
|
||||
@ -16,9 +16,6 @@ export const LanguageList = ({ style }: { style?: React.CSSProperties }) => {
|
||||
aria-label={t("buttons.selectLanguage")}
|
||||
style={style}
|
||||
>
|
||||
<option key={defaultLang.code} value={defaultLang.code}>
|
||||
{defaultLang.label}
|
||||
</option>
|
||||
{languages.map((lang) => (
|
||||
<option key={lang.code} value={lang.code}>
|
||||
{lang.label}
|
||||
|
13
src/i18n.ts
13
src/i18n.ts
@ -14,7 +14,9 @@ export interface Language {
|
||||
|
||||
export const defaultLang = { code: "en", label: "English" };
|
||||
|
||||
const allLanguages: Language[] = [
|
||||
export const languages: Language[] = [
|
||||
defaultLang,
|
||||
...[
|
||||
{ code: "ar-SA", label: "العربية", rtl: true },
|
||||
{ code: "bg-BG", label: "Български" },
|
||||
{ code: "ca-ES", label: "Català" },
|
||||
@ -59,15 +61,14 @@ const allLanguages: Language[] = [
|
||||
{ code: "zh-TW", label: "繁體中文" },
|
||||
{ code: "vi-VN", label: "Tiếng Việt" },
|
||||
{ code: "mr-IN", label: "मराठी" },
|
||||
].concat([defaultLang]);
|
||||
|
||||
export const languages: Language[] = allLanguages
|
||||
.sort((left, right) => (left.label > right.label ? 1 : -1))
|
||||
]
|
||||
.filter(
|
||||
(lang) =>
|
||||
(percentages as Record<string, number>)[lang.code] >=
|
||||
COMPLETION_THRESHOLD,
|
||||
);
|
||||
)
|
||||
.sort((left, right) => (left.label > right.label ? 1 : -1)),
|
||||
];
|
||||
|
||||
const TEST_LANG_CODE = "__test__";
|
||||
if (process.env.NODE_ENV === ENV.DEVELOPMENT) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user