mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-28 15:21:18 +00:00
Remove languages less than 70% completed, merge language lists
This commit is contained in:
parent
b58dfee675
commit
0b863d1d56
3 changed files with 40 additions and 84 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit ebe80fa15d9f7d17979c317291834ab4021cb8eb
|
Subproject commit ef6a2d42a0c03e6e66f1670d828b738a72cb3880
|
|
@ -2,7 +2,7 @@ import { Component, ChangeEvent, linkEvent } from "inferno";
|
||||||
import { Link } from "inferno-router";
|
import { Link } from "inferno-router";
|
||||||
import { LinkLine } from "./link-line";
|
import { LinkLine } from "./link-line";
|
||||||
import { Icon } from "./icon";
|
import { Icon } from "./icon";
|
||||||
import { getLanguageName, i18n } from "../i18next";
|
import { i18n, languages } from "../i18next";
|
||||||
|
|
||||||
export class Navbar extends Component<any, any> {
|
export class Navbar extends Component<any, any> {
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
|
@ -43,7 +43,7 @@ export class Navbar extends Component<any, any> {
|
||||||
value={language}
|
value={language}
|
||||||
selected={i18n.language.startsWith(language)}
|
selected={i18n.language.startsWith(language)}
|
||||||
>
|
>
|
||||||
{getLanguageName(language)}
|
{languages.find(l => l.code.startsWith(language)).name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -1,94 +1,54 @@
|
||||||
import i18next, { i18nTyped } from "i18next";
|
import i18next, { i18nTyped, Resource } from "i18next";
|
||||||
|
|
||||||
// Languages
|
// Languages
|
||||||
|
import { bg } from "./translations/bg";
|
||||||
|
import { de } from "./translations/de";
|
||||||
|
import { el } from "./translations/el";
|
||||||
import { en } from "./translations/en";
|
import { en } from "./translations/en";
|
||||||
import { ru } from "./translations/ru";
|
|
||||||
import { zh } from "./translations/zh";
|
|
||||||
import { es } from "./translations/es";
|
import { es } from "./translations/es";
|
||||||
import { eu } from "./translations/eu";
|
import { eu } from "./translations/eu";
|
||||||
import { bg } from "./translations/bg";
|
import { fa } from "./translations/fa";
|
||||||
import { nl } from "./translations/nl";
|
|
||||||
import { fi } from "./translations/fi";
|
import { fi } from "./translations/fi";
|
||||||
import { fr } from "./translations/fr";
|
import { fr } from "./translations/fr";
|
||||||
import { el } from "./translations/el";
|
|
||||||
import { ko } from "./translations/ko";
|
|
||||||
import { pl } from "./translations/pl";
|
|
||||||
import { ar } from "./translations/ar";
|
|
||||||
import { eo } from "./translations/eo";
|
|
||||||
import { de } from "./translations/de";
|
|
||||||
import { gl } from "./translations/gl";
|
import { gl } from "./translations/gl";
|
||||||
|
import { id } from "./translations/id";
|
||||||
import { it } from "./translations/it";
|
import { it } from "./translations/it";
|
||||||
import { ja } from "./translations/ja";
|
import { ja } from "./translations/ja";
|
||||||
import { km } from "./translations/km";
|
import { ko } from "./translations/ko";
|
||||||
import { nb_NO } from "./translations/nb_NO";
|
import { nb_NO } from "./translations/nb_NO";
|
||||||
import { zh_Hant } from "./translations/zh_Hant";
|
import { nl } from "./translations/nl";
|
||||||
import { fa } from "./translations/fa";
|
import { pl } from "./translations/pl";
|
||||||
import { id } from "./translations/id";
|
|
||||||
import { mnc } from "./translations/mnc";
|
|
||||||
import { sv } from "./translations/sv";
|
|
||||||
import { vi } from "./translations/vi";
|
|
||||||
import { pt } from "./translations/pt";
|
import { pt } from "./translations/pt";
|
||||||
|
import { pt_BR } from "./translations/pt_BR";
|
||||||
|
import { ru } from "./translations/ru";
|
||||||
|
import { zh } from "./translations/zh";
|
||||||
|
|
||||||
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
|
export const languages = [
|
||||||
const resources = {
|
{ resource: bg, code: "bg", name: "Български" },
|
||||||
en,
|
{ resource: de, code: "de", name: "Deutsch" },
|
||||||
ru,
|
{ resource: el, code: "el", name: "Ελληνικά" },
|
||||||
zh,
|
{ resource: en, code: "en", name: "English" },
|
||||||
es,
|
{ resource: es, code: "es", name: "Español" },
|
||||||
eu,
|
{ resource: eu, code: "eu", name: "Euskara" },
|
||||||
bg,
|
{ resource: fa, code: "fa", name: "فارسی" },
|
||||||
nl,
|
{ resource: fi, code: "fi", name: "Suomi" },
|
||||||
fi,
|
{ resource: fr, code: "fr", name: "Français" },
|
||||||
fr,
|
{ resource: gl, code: "gl", name: "Galego" },
|
||||||
el,
|
{ resource: id, code: "id", name: "Bahasa Indonesia" },
|
||||||
ko,
|
{ resource: it, code: "it", name: "Italiano" },
|
||||||
pl,
|
{ resource: ja, code: "ja", name: "日本語" },
|
||||||
ar,
|
{ resource: ko, code: "ko", name: "한국어" },
|
||||||
eo,
|
{ resource: nb_NO, code: "nb_NO", name: "Norsk (bokmål)" },
|
||||||
de,
|
{ resource: nl, code: "nl", name: "Nederlands" },
|
||||||
gl,
|
{ resource: pl, code: "pl", name: "Polski" },
|
||||||
it,
|
{ resource: pt, code: "pt", name: "Português" },
|
||||||
ja,
|
{ resource: pt_BR, code: "pt_BR", name: "Português (Brasil)" },
|
||||||
km,
|
{ resource: ru, code: "ru", name: "Русский" },
|
||||||
nb_NO,
|
{ resource: zh, code: "zh", name: "中文" },
|
||||||
zh_Hant,
|
];
|
||||||
fa,
|
|
||||||
id,
|
|
||||||
mnc,
|
|
||||||
sv,
|
|
||||||
vi,
|
|
||||||
pt,
|
|
||||||
};
|
|
||||||
|
|
||||||
const languageNames = {
|
const resources: Resource = {};
|
||||||
en: "English",
|
languages.forEach(l => (resources[l.code] = l.resource));
|
||||||
ru: "Русский",
|
|
||||||
zh: "中文",
|
|
||||||
es: "Español",
|
|
||||||
eu: "Euskara",
|
|
||||||
bg: "Български",
|
|
||||||
nl: "Nederlands",
|
|
||||||
fi: "Suomi",
|
|
||||||
fr: "Français",
|
|
||||||
el: "Ελληνικά",
|
|
||||||
ko: "한국어",
|
|
||||||
pl: "Polski",
|
|
||||||
ar: "العربية",
|
|
||||||
eo: "Esperanto",
|
|
||||||
de: "Deutsch",
|
|
||||||
gl: "Galego",
|
|
||||||
it: "Italiano",
|
|
||||||
ja: "日本語",
|
|
||||||
km: "ភាសាខ្មែរ",
|
|
||||||
nb_NO: "Norsk (Bokmål)",
|
|
||||||
zh_Hant: "文言",
|
|
||||||
fa: "فارسی",
|
|
||||||
id: "Bahasa Indonesia",
|
|
||||||
mnc: "ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ",
|
|
||||||
sv: "Svenska",
|
|
||||||
vi: "Tiếng Việt",
|
|
||||||
pt: "Português",
|
|
||||||
};
|
|
||||||
|
|
||||||
function format(value: any, format: any): any {
|
function format(value: any, format: any): any {
|
||||||
return format === "uppercase" ? value.toUpperCase() : value;
|
return format === "uppercase" ? value.toUpperCase() : value;
|
||||||
|
@ -107,10 +67,6 @@ export const i18n = i18next as i18nTyped;
|
||||||
|
|
||||||
export { resources };
|
export { resources };
|
||||||
|
|
||||||
export function getLanguageName(key: string): string {
|
|
||||||
return languageNames[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://gist.github.com/hunan-rostomyan/28e8702c1cecff41f7fe64345b76f2ca
|
// https://gist.github.com/hunan-rostomyan/28e8702c1cecff41f7fe64345b76f2ca
|
||||||
export function getLanguageFromCookie(cookies?: string): string | null {
|
export function getLanguageFromCookie(cookies?: string): string | null {
|
||||||
if (cookies == null) {
|
if (cookies == null) {
|
||||||
|
|
Loading…
Reference in a new issue