mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-22 12:21:16 +00:00
Using countries library instead.
This commit is contained in:
parent
62535b925f
commit
ce386d57f8
3 changed files with 16 additions and 9 deletions
|
@ -42,11 +42,11 @@
|
||||||
"babel-plugin-inferno": "^6",
|
"babel-plugin-inferno": "^6",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"copy-webpack-plugin": "^8.0.0",
|
"copy-webpack-plugin": "^8.0.0",
|
||||||
|
"countries-list": "^2.6.1",
|
||||||
"css-loader": "^5.1.3",
|
"css-loader": "^5.1.3",
|
||||||
"eslint": "^7.20.0",
|
"eslint": "^7.20.0",
|
||||||
"eslint-plugin-prettier": "^3.3.1",
|
"eslint-plugin-prettier": "^3.3.1",
|
||||||
"husky": "^5.2.0",
|
"husky": "^5.2.0",
|
||||||
"iso-639-1": "^2.1.9",
|
|
||||||
"lint-staged": "^10.5.4",
|
"lint-staged": "^10.5.4",
|
||||||
"mini-css-extract-plugin": "^1.3.8",
|
"mini-css-extract-plugin": "^1.3.8",
|
||||||
"node-sass": "^5.0.0",
|
"node-sass": "^5.0.0",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { DonateLines } from "./donate-lines";
|
||||||
import { i18n } from "../i18next";
|
import { i18n } from "../i18next";
|
||||||
import { T } from "inferno-i18next";
|
import { T } from "inferno-i18next";
|
||||||
import { translators } from "../translations/translators";
|
import { translators } from "../translations/translators";
|
||||||
import ISO6391 from "iso-639-1";
|
import { languagesAll, countries } from "countries-list";
|
||||||
|
|
||||||
const title = i18n.t("support_title");
|
const title = i18n.t("support_title");
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ let coders: Coder[] = [
|
||||||
|
|
||||||
export interface Translation {
|
export interface Translation {
|
||||||
lang: string;
|
lang: string;
|
||||||
|
country?: string;
|
||||||
translators: Translator[];
|
translators: Translator[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +148,8 @@ export class Support extends Component<any, any> {
|
||||||
<span>{i18n.t("thanks_translators")}</span>
|
<span>{i18n.t("thanks_translators")}</span>
|
||||||
{convertTranslators().map(t => (
|
{convertTranslators().map(t => (
|
||||||
<span>
|
<span>
|
||||||
<code>{ISO6391.getNativeName(t.lang) || t.lang}</code>
|
<b>{languagesAll[t.lang].native}</b>
|
||||||
|
{t.country && <b> {countries[t.country].native}</b>}
|
||||||
<span>: </span>
|
<span>: </span>
|
||||||
{t.translators.map((translator, i) => (
|
{t.translators.map((translator, i) => (
|
||||||
<span>
|
<span>
|
||||||
|
@ -195,8 +197,13 @@ export class Support extends Component<any, any> {
|
||||||
function convertTranslators(): Translation[] {
|
function convertTranslators(): Translation[] {
|
||||||
let trans: Translation[] = [];
|
let trans: Translation[] = [];
|
||||||
for (const [key, value] of Object.entries(translators)) {
|
for (const [key, value] of Object.entries(translators)) {
|
||||||
|
let split = key.split("_");
|
||||||
|
let lang = split[0];
|
||||||
|
let country = split[1] !== undefined ? split[1].toUpperCase() : undefined;
|
||||||
|
|
||||||
let t: Translation = {
|
let t: Translation = {
|
||||||
lang: key,
|
lang,
|
||||||
|
country,
|
||||||
translators: value,
|
translators: value,
|
||||||
};
|
};
|
||||||
trans.push(t);
|
trans.push(t);
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -2443,6 +2443,11 @@ cosmiconfig@^7.0.0:
|
||||||
path-type "^4.0.0"
|
path-type "^4.0.0"
|
||||||
yaml "^1.10.0"
|
yaml "^1.10.0"
|
||||||
|
|
||||||
|
countries-list@^2.6.1:
|
||||||
|
version "2.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-2.6.1.tgz#d479757ac873b1e596ccea0a925962d20396c0cb"
|
||||||
|
integrity sha512-jXM1Nv3U56dPQ1DsUSsEaGmLHburo4fnB7m+1yhWDUVvx5gXCd1ok/y3gXCjXzhqyawG+igcPYcAl4qjkvopaQ==
|
||||||
|
|
||||||
create-error-class@^3.0.0:
|
create-error-class@^3.0.0:
|
||||||
version "3.0.2"
|
version "3.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6"
|
resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6"
|
||||||
|
@ -4588,11 +4593,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.9:
|
|
||||||
version "2.1.9"
|
|
||||||
resolved "https://registry.yarnpkg.com/iso-639-1/-/iso-639-1-2.1.9.tgz#e41b11d4f1808e5316d0252c3fa16eeb9b37bb58"
|
|
||||||
integrity sha512-owRu9up+Cpx/hwSzm83j6G8PtC7U99UCtPVItsafefNfEgMl+pi8KBwhXwJkJfp6IouyYWFxj8n24SvCWpKZEQ==
|
|
||||||
|
|
||||||
isobject@^2.0.0:
|
isobject@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
|
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
|
||||||
|
|
Loading…
Reference in a new issue