Add check that translation for a certain theme is complete, add a few missing dutch translations

This commit is contained in:
Pieter Vander Vennet 2021-10-01 04:49:19 +02:00
parent 4c2beb5334
commit 4fcd3523b7
7 changed files with 63 additions and 4 deletions

View file

@ -196,4 +196,22 @@ export class Translation extends BaseUIElement {
return allIcons.filter(icon => icon != undefined)
}
static ExtractAllTranslationsFrom(object: any, context = ""): { context: string, tr: Translation }[] {
const allTranslations: { context: string, tr: Translation }[] = []
for (const key in object) {
const v = object[key]
if (v === undefined || v === null) {
continue
}
if (v instanceof Translation) {
allTranslations.push({context: context +"." + key, tr: v})
continue
}
if (typeof v === "object") {
allTranslations.push(...Translation.ExtractAllTranslationsFrom(v, context + "." + key))
continue
}
}
return allTranslations
}
}