async function wikidataTranslations()

in scripts/wikidata-labels.js [10:19]


async function wikidataTranslations(id) {
    const res = await fetch(`https://www.wikidata.org/wiki/Special:EntityData/${id}`);
    const json = await res.json();
    const labels = json.entities[id].labels;
    const translations = {};
    for (const key of Object.keys(labels).sort()) {
      translations[key] = labels[key].value;
    }
    return translations;
}