fix: improve language docs + string parsing

This commit is contained in:
ThetaDev 2023-05-11 17:00:01 +02:00
parent 86775ea95b
commit e184341625
6 changed files with 255 additions and 92 deletions

View file

@ -0,0 +1,16 @@
const fs = require("fs");
const dict = JSON.parse(fs.readFileSync("dictionary.json"));
const intl = new Intl.DisplayNames(["en"], { type: "language" });
let langs = Object.keys(dict);
Object.values(dict).forEach(entry => {
if (entry.equivalent) {
langs.push(...entry.equivalent);
}
});
langs.sort();
const res = Object.fromEntries(langs.map((l) => [l, intl.of(l)]));
fs.writeFileSync("lang_names.json", JSON.stringify(res, null, 2));