mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-12-22 19:01:28 +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",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"copy-webpack-plugin": "^8.0.0",
|
||||
"countries-list": "^2.6.1",
|
||||
"css-loader": "^5.1.3",
|
||||
"eslint": "^7.20.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"husky": "^5.2.0",
|
||||
"iso-639-1": "^2.1.9",
|
||||
"lint-staged": "^10.5.4",
|
||||
"mini-css-extract-plugin": "^1.3.8",
|
||||
"node-sass": "^5.0.0",
|
||||
|
|
|
@ -4,7 +4,7 @@ import { DonateLines } from "./donate-lines";
|
|||
import { i18n } from "../i18next";
|
||||
import { T } from "inferno-i18next";
|
||||
import { translators } from "../translations/translators";
|
||||
import ISO6391 from "iso-639-1";
|
||||
import { languagesAll, countries } from "countries-list";
|
||||
|
||||
const title = i18n.t("support_title");
|
||||
|
||||
|
@ -52,6 +52,7 @@ let coders: Coder[] = [
|
|||
|
||||
export interface Translation {
|
||||
lang: string;
|
||||
country?: string;
|
||||
translators: Translator[];
|
||||
}
|
||||
|
||||
|
@ -147,7 +148,8 @@ export class Support extends Component<any, any> {
|
|||
<span>{i18n.t("thanks_translators")}</span>
|
||||
{convertTranslators().map(t => (
|
||||
<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>
|
||||
{t.translators.map((translator, i) => (
|
||||
<span>
|
||||
|
@ -195,8 +197,13 @@ export class Support extends Component<any, any> {
|
|||
function convertTranslators(): Translation[] {
|
||||
let trans: Translation[] = [];
|
||||
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 = {
|
||||
lang: key,
|
||||
lang,
|
||||
country,
|
||||
translators: value,
|
||||
};
|
||||
trans.push(t);
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -2443,6 +2443,11 @@ cosmiconfig@^7.0.0:
|
|||
path-type "^4.0.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:
|
||||
version "3.0.2"
|
||||
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"
|
||||
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:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
|
||||
|
|
Loading…
Reference in a new issue