fix: language list containing duplicate en lang (#6583)

This commit is contained in:
David Luzar 2023-05-13 22:50:14 +02:00 committed by GitHub
parent 306e133651
commit 5bf27a463c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 58 deletions

View File

@ -538,6 +538,10 @@
height: 3px; height: 3px;
} }
select::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: var(--scrollbar-thumb); background: var(--scrollbar-thumb);
border-radius: 10px; border-radius: 10px;

View File

@ -1,7 +1,7 @@
import { useSetAtom } from "jotai"; import { useSetAtom } from "jotai";
import React from "react"; import React from "react";
import { appLangCodeAtom } from ".."; import { appLangCodeAtom } from "..";
import { defaultLang, useI18n } from "../../i18n"; import { useI18n } from "../../i18n";
import { languages } from "../../i18n"; import { languages } from "../../i18n";
export const LanguageList = ({ style }: { style?: React.CSSProperties }) => { export const LanguageList = ({ style }: { style?: React.CSSProperties }) => {
@ -16,9 +16,6 @@ export const LanguageList = ({ style }: { style?: React.CSSProperties }) => {
aria-label={t("buttons.selectLanguage")} aria-label={t("buttons.selectLanguage")}
style={style} style={style}
> >
<option key={defaultLang.code} value={defaultLang.code}>
{defaultLang.label}
</option>
{languages.map((lang) => ( {languages.map((lang) => (
<option key={lang.code} value={lang.code}> <option key={lang.code} value={lang.code}>
{lang.label} {lang.label}

View File

@ -14,60 +14,61 @@ export interface Language {
export const defaultLang = { code: "en", label: "English" }; export const defaultLang = { code: "en", label: "English" };
const allLanguages: Language[] = [ export const languages: Language[] = [
{ code: "ar-SA", label: "العربية", rtl: true }, defaultLang,
{ code: "bg-BG", label: "Български" }, ...[
{ code: "ca-ES", label: "Català" }, { code: "ar-SA", label: "العربية", rtl: true },
{ code: "cs-CZ", label: "Česky" }, { code: "bg-BG", label: "Български" },
{ code: "de-DE", label: "Deutsch" }, { code: "ca-ES", label: "Català" },
{ code: "el-GR", label: "Ελληνικά" }, { code: "cs-CZ", label: "Česky" },
{ code: "es-ES", label: "Español" }, { code: "de-DE", label: "Deutsch" },
{ code: "eu-ES", label: "Euskara" }, { code: "el-GR", label: "Ελληνικά" },
{ code: "fa-IR", label: "فارسی", rtl: true }, { code: "es-ES", label: "Español" },
{ code: "fi-FI", label: "Suomi" }, { code: "eu-ES", label: "Euskara" },
{ code: "fr-FR", label: "Français" }, { code: "fa-IR", label: "فارسی", rtl: true },
{ code: "gl-ES", label: "Galego" }, { code: "fi-FI", label: "Suomi" },
{ code: "he-IL", label: "עברית", rtl: true }, { code: "fr-FR", label: "Français" },
{ code: "hi-IN", label: "हिन्दी" }, { code: "gl-ES", label: "Galego" },
{ code: "hu-HU", label: "Magyar" }, { code: "he-IL", label: "עברית", rtl: true },
{ code: "id-ID", label: "Bahasa Indonesia" }, { code: "hi-IN", label: "हिन्दी" },
{ code: "it-IT", label: "Italiano" }, { code: "hu-HU", label: "Magyar" },
{ code: "ja-JP", label: "日本語" }, { code: "id-ID", label: "Bahasa Indonesia" },
{ code: "kab-KAB", label: "Taqbaylit" }, { code: "it-IT", label: "Italiano" },
{ code: "kk-KZ", label: "Қазақ тілі" }, { code: "ja-JP", label: "日本語" },
{ code: "ko-KR", label: "한국어" }, { code: "kab-KAB", label: "Taqbaylit" },
{ code: "ku-TR", label: "Kurdî" }, { code: "kk-KZ", label: "Қазақ тілі" },
{ code: "lt-LT", label: "Lietuvių" }, { code: "ko-KR", label: "한국어" },
{ code: "lv-LV", label: "Latviešu" }, { code: "ku-TR", label: "Kurdî" },
{ code: "my-MM", label: "Burmese" }, { code: "lt-LT", label: "Lietuvių" },
{ code: "nb-NO", label: "Norsk bokmål" }, { code: "lv-LV", label: "Latviešu" },
{ code: "nl-NL", label: "Nederlands" }, { code: "my-MM", label: "Burmese" },
{ code: "nn-NO", label: "Norsk nynorsk" }, { code: "nb-NO", label: "Norsk bokmål" },
{ code: "oc-FR", label: "Occitan" }, { code: "nl-NL", label: "Nederlands" },
{ code: "pa-IN", label: "ਪੰਜਾਬੀ" }, { code: "nn-NO", label: "Norsk nynorsk" },
{ code: "pl-PL", label: "Polski" }, { code: "oc-FR", label: "Occitan" },
{ code: "pt-BR", label: "Português Brasileiro" }, { code: "pa-IN", label: "ਪੰਜਾਬੀ" },
{ code: "pt-PT", label: "Português" }, { code: "pl-PL", label: "Polski" },
{ code: "ro-RO", label: "Română" }, { code: "pt-BR", label: "Português Brasileiro" },
{ code: "ru-RU", label: "Русский" }, { code: "pt-PT", label: "Português" },
{ code: "sk-SK", label: "Slovenčina" }, { code: "ro-RO", label: "Română" },
{ code: "sv-SE", label: "Svenska" }, { code: "ru-RU", label: "Русский" },
{ code: "sl-SI", label: "Slovenščina" }, { code: "sk-SK", label: "Slovenčina" },
{ code: "tr-TR", label: "Türkçe" }, { code: "sv-SE", label: "Svenska" },
{ code: "uk-UA", label: "Українська" }, { code: "sl-SI", label: "Slovenščina" },
{ code: "zh-CN", label: "简体中文" }, { code: "tr-TR", label: "Türkçe" },
{ code: "zh-TW", label: "繁體中文" }, { code: "uk-UA", label: "Українська" },
{ code: "vi-VN", label: "Tiếng Việt" }, { code: "zh-CN", label: "简体中文" },
{ code: "mr-IN", label: "मराठी" }, { code: "zh-TW", label: "繁體中文" },
].concat([defaultLang]); { code: "vi-VN", label: "Tiếng Việt" },
{ code: "mr-IN", label: "मराठी" },
export const languages: Language[] = allLanguages ]
.sort((left, right) => (left.label > right.label ? 1 : -1)) .filter(
.filter( (lang) =>
(lang) => (percentages as Record<string, number>)[lang.code] >=
(percentages as Record<string, number>)[lang.code] >= COMPLETION_THRESHOLD,
COMPLETION_THRESHOLD, )
); .sort((left, right) => (left.label > right.label ? 1 : -1)),
];
const TEST_LANG_CODE = "__test__"; const TEST_LANG_CODE = "__test__";
if (process.env.NODE_ENV === ENV.DEVELOPMENT) { if (process.env.NODE_ENV === ENV.DEVELOPMENT) {