Reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2022-09-08 21:40:48 +02:00
parent e22d189376
commit b541d3eab4
382 changed files with 50893 additions and 35566 deletions

View file

@ -1,14 +1,12 @@
export default class WikidataUtils {
/**
* Mapping from wikidata-codes to weblate-codes. The wikidata-code is the key, mapcomplete/weblate is the value
*/
public static readonly languageRemapping = {
"nb":"nb_NO",
"zh-hant":"zh_Hant",
"zh-hans":"zh_Hans",
"pt-br":"pt_BR"
nb: "nb_NO",
"zh-hant": "zh_Hant",
"zh-hans": "zh_Hans",
"pt-br": "pt_BR",
}
/**
@ -17,23 +15,25 @@ export default class WikidataUtils {
* @param data
* @param remapLanguages
*/
public static extractLanguageData(data: {lang: {value:string}, code: {value: string}, label: {value: string}} [], remapLanguages: Record<string, string>): Map<string, Map<string, string>>{
console.log("Got "+data.length+" entries")
const perId = new Map<string, Map<string, string>>();
public static extractLanguageData(
data: { lang: { value: string }; code: { value: string }; label: { value: string } }[],
remapLanguages: Record<string, string>
): Map<string, Map<string, string>> {
console.log("Got " + data.length + " entries")
const perId = new Map<string, Map<string, string>>()
for (const element of data) {
let id = element.code.value
id = remapLanguages[id] ?? id
let labelLang = element.label["xml:lang"]
labelLang = remapLanguages[labelLang] ?? labelLang
const value = element.label.value
if(!perId.has(id)){
if (!perId.has(id)) {
perId.set(id, new Map<string, string>())
}
perId.get(id).set(labelLang, value)
}
console.log("Got "+perId.size+" languages")
console.log("Got " + perId.size + " languages")
return perId
}
}
}