[frontend] use ISO639 library for language selection (#909)

This commit is contained in:
f0x52 2022-10-12 19:18:41 +02:00 committed by GitHub
parent 80c2833d83
commit 30aaedb0a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 75 deletions

View file

@ -26,6 +26,7 @@
"is-plain-object": "^5.0.0",
"is-valid-domain": "^0.1.6",
"js-file-download": "^0.4.12",
"langs": "^2.0.0",
"livereload-js": "^3.4.1",
"modern-normalize": "^1.1.0",
"photoswipe": "^5.3.0",

View file

@ -19,80 +19,17 @@
"use strict";
const React = require("react");
const langs = require("langs");
const asElements = langs.all().map((l) => {
let code = l["1"].toUpperCase();
let name = l.name;
if (l.name != l.local) {
name = `${name} - ${l.local}`;
}
return <option key={code} value={code}>{name}</option>;
});
module.exports = function Languages() {
return <React.Fragment>
<option value="AF">Afrikaans</option>
<option value="SQ">Albanian</option>
<option value="AR">Arabic</option>
<option value="HY">Armenian</option>
<option value="EU">Basque</option>
<option value="BN">Bengali</option>
<option value="BG">Bulgarian</option>
<option value="CA">Catalan</option>
<option value="KM">Cambodian</option>
<option value="ZH">Chinese (Mandarin)</option>
<option value="HR">Croatian</option>
<option value="CS">Czech</option>
<option value="DA">Danish</option>
<option value="NL">Dutch</option>
<option value="EN">English</option>
<option value="ET">Estonian</option>
<option value="FJ">Fiji</option>
<option value="FI">Finnish</option>
<option value="FR">French</option>
<option value="KA">Georgian</option>
<option value="DE">German</option>
<option value="EL">Greek</option>
<option value="GU">Gujarati</option>
<option value="HE">Hebrew</option>
<option value="HI">Hindi</option>
<option value="HU">Hungarian</option>
<option value="IS">Icelandic</option>
<option value="ID">Indonesian</option>
<option value="GA">Irish</option>
<option value="IT">Italian</option>
<option value="JA">Japanese</option>
<option value="JW">Javanese</option>
<option value="KO">Korean</option>
<option value="LA">Latin</option>
<option value="LV">Latvian</option>
<option value="LT">Lithuanian</option>
<option value="MK">Macedonian</option>
<option value="MS">Malay</option>
<option value="ML">Malayalam</option>
<option value="MT">Maltese</option>
<option value="MI">Maori</option>
<option value="MR">Marathi</option>
<option value="MN">Mongolian</option>
<option value="NE">Nepali</option>
<option value="NO">Norwegian</option>
<option value="FA">Persian</option>
<option value="PL">Polish</option>
<option value="PT">Portuguese</option>
<option value="PA">Punjabi</option>
<option value="QU">Quechua</option>
<option value="RO">Romanian</option>
<option value="RU">Russian</option>
<option value="SM">Samoan</option>
<option value="SR">Serbian</option>
<option value="SK">Slovak</option>
<option value="SL">Slovenian</option>
<option value="ES">Spanish</option>
<option value="SW">Swahili</option>
<option value="SV">Swedish </option>
<option value="TA">Tamil</option>
<option value="TT">Tatar</option>
<option value="TE">Telugu</option>
<option value="TH">Thai</option>
<option value="BO">Tibetan</option>
<option value="TO">Tonga</option>
<option value="TR">Turkish</option>
<option value="UK">Ukrainian</option>
<option value="UR">Urdu</option>
<option value="UZ">Uzbek</option>
<option value="VI">Vietnamese</option>
<option value="CY">Welsh</option>
<option value="XH">Xhosa</option>
</React.Fragment>;
};
return asElements;
};

View file

@ -3719,6 +3719,11 @@ labeled-stream-splicer@^2.0.0:
inherits "^2.0.1"
stream-splicer "^2.0.0"
langs@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/langs/-/langs-2.0.0.tgz#00c32ce48152a49a614450b9ba2632ab58a0a364"
integrity sha512-v4pxOBEQVN1WBTfB1crhTtxzNLZU9HPWgadlwzWKISJtt6Ku/CnpBrwVy+jFv8StjxsPfwPFzO0CMwdZLJ0/BA==
levn@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"