Fix language names

This commit is contained in:
Felix Ableitner 2022-02-15 13:47:53 +01:00
parent 99f652422f
commit fe66a28638
4 changed files with 50 additions and 65 deletions

@ -1 +1 @@
Subproject commit 0d63b5affe2273bb88b3593cdc13e4bb0f4d2d5d Subproject commit b18bfc1a8d512d081056cf5aa1f422e4710ef683

View file

@ -74,7 +74,6 @@
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.4", "husky": "^7.0.4",
"import-sort-style-module": "^6.0.0", "import-sort-style-module": "^6.0.0",
"iso-639-1": "^2.1.10",
"lemmy-js-client": "0.15.1-rc.1", "lemmy-js-client": "0.15.1-rc.1",
"lint-staged": "^12.1.2", "lint-staged": "^12.1.2",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",

View file

@ -1,5 +1,4 @@
import emojiShortName from "emoji-short-name"; import emojiShortName from "emoji-short-name";
import ISO6391 from "iso-639-1";
import { import {
BlockCommunityResponse, BlockCommunityResponse,
BlockPersonResponse, BlockPersonResponse,
@ -116,54 +115,54 @@ export const fetchLimit = 20;
export const mentionDropdownFetchLimit = 10; export const mentionDropdownFetchLimit = 10;
export const languages = [ export const languages = [
{ code: "ca" }, { code: "ca", name: "Català" },
{ code: "en" }, { code: "en", name: "English" },
{ code: "el" }, { code: "el", name: "Ελληνικά" },
{ code: "eu" }, { code: "eu", name: "Euskara" },
{ code: "eo" }, { code: "eo", name: "Esperanto" },
{ code: "es" }, { code: "es", name: "Español" },
{ code: "da" }, { code: "da", name: "Dansk" },
{ code: "de" }, { code: "de", name: "Deutsch" },
{ code: "ga" }, { code: "ga", name: "Gaeilge" },
{ code: "gl" }, { code: "gl", name: "Galego" },
{ code: "hr" }, { code: "hr", name: "Hrvatski" },
{ code: "hu" }, { code: "hu", name: "Magyar" },
{ code: "id" }, { code: "id", name: "Bahasa Indonesia" },
{ code: "ka" }, { code: "ka", name: "ქართული" },
{ code: "ko" }, { code: "ko", name: "한국어" },
{ code: "km" }, { code: "km", name: "ខេមរភាសា" },
{ code: "hi" }, { code: "hi", name: "हिन्दी" },
{ code: "fa" }, { code: "fa", name: "فارسی" },
{ code: "ja" }, { code: "ja", name: "日本語" },
{ code: "oc" }, { code: "oc", name: "Occitan" },
{ code: "nb_NO" }, { code: "nb_NO", name: "Norsk (bokmål)" },
{ code: "pl" }, { code: "pl", name: "Polski" },
{ code: "pt_BR" }, { code: "pt_BR", name: "Português (Brasil)" },
{ code: "zh" }, { code: "zh", name: "中文" },
{ code: "fi" }, { code: "fi", name: "Suomi" },
{ code: "fr" }, { code: "fr", name: "Français" },
{ code: "sv" }, { code: "sv", name: "Svenska" },
{ code: "sq" }, { code: "sq", name: "Shqip" },
{ code: "sr_Latn" }, { code: "sr_Latn", name: "Српски" },
{ code: "th" }, { code: "th", name: "ไทย" },
{ code: "tr" }, { code: "tr", name: "Türkçe" },
{ code: "uk" }, { code: "uk", name: "Українська" },
{ code: "ru" }, { code: "ru", name: "Русский" },
{ code: "nl" }, { code: "nl", name: "Nederlands" },
{ code: "it" }, { code: "it", name: "Italiano" },
{ code: "bg" }, { code: "bg", name: "Български" },
{ code: "zh_Hant" }, { code: "zh_Hant", name: "文言" },
{ code: "cy" }, { code: "cy", name: "Cymraeg" },
{ code: "mnc" }, { code: "mnc", name: "ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ" },
{ code: "sk" }, { code: "sk", name: "Slovenčina" },
{ code: "vi" }, { code: "vi", name: "Tiếng Việt" },
{ code: "pt" }, { code: "pt", name: "Português" },
{ code: "ar" }, { code: "ar", name: "العربية" },
{ code: "bn" }, { code: "bn", name: "বাংলা" },
{ code: "ml" }, { code: "ml", name: "മലയാളം" },
{ code: "cs" }, { code: "cs", name: "Česky" },
{ code: "as" }, { code: "as", name: "অসমীয়া" },
{ code: "lt" }, { code: "lt", name: "Lietuvių" },
]; ];
export const themes = [ export const themes = [
@ -429,15 +428,7 @@ export function debounce(func: any, wait = 1000, immediate = false) {
} }
export function getNativeLanguageName(code: string): string { export function getNativeLanguageName(code: string): string {
let [isoCode, qualifier] = code.split("_"); return languages.filter(c => c.code === code).map(l => l.name)[0];
let native = ISO6391.getNativeName(isoCode) || code;
if (qualifier) {
return `${native}_${qualifier}`;
} else {
return native;
}
} }
// TODO // TODO

View file

@ -4464,11 +4464,6 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
iso-639-1@^2.1.10:
version "2.1.11"
resolved "https://registry.yarnpkg.com/iso-639-1/-/iso-639-1-2.1.11.tgz#a928a7c71025321258bd46e03ae85e49ded5dbdc"
integrity sha512-WDF2XWfw1GuPvjn3YEn1+gFGF+72ZltVcjNhaWwmgvveN+rTy3XzWYwgIp/Y8CSZYclNvJ4Vqeh5byubiXCzPw==
isobject@^3.0.1: isobject@^3.0.1:
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"