From 7ba6a82b354ded009351080775661e6f87e1659c Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 10 Jul 2021 19:18:51 +0200 Subject: [PATCH] Remove translation completeness check from layer overview generation --- scripts/generateLayerOverview.ts | 62 -------------------------------- 1 file changed, 62 deletions(-) diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index b83b28be9b..7da47f21c4 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -77,63 +77,6 @@ class LayerOverviewUtils { return errorCount } - validateTranslationCompletenessOfObject(object: any, expectedLanguages: string[], context: string) { - const missingTranlations = [] - const translations: { tr: Translation, context: string }[] = []; - const queue: { object: any, context: string }[] = [{object: object, context: context}] - - while (queue.length > 0) { - const item = queue.pop(); - const o = item.object - for (const key in o) { - const v = o[key]; - if (v === undefined) { - continue; - } - if (v instanceof Translation || v?.translations !== undefined) { - translations.push({tr: v, context: item.context}); - } else if ( - ["string", "function", "boolean", "number"].indexOf(typeof (v)) < 0) { - queue.push({object: v, context: item.context + "." + key}) - } - } - } - - const missing = {} - const present = {} - for (const ln of expectedLanguages) { - missing[ln] = 0; - present[ln] = 0; - for (const translation of translations) { - if (translation.tr.translations["*"] !== undefined) { - continue; - } - const txt = translation.tr.translations[ln]; - const isMissing = txt === undefined || txt === "" || txt.toLowerCase().indexOf("todo") >= 0; - if (isMissing) { - missingTranlations.push(`${translation.context},${ln},${translation.tr.txt}`) - missing[ln]++ - } else { - present[ln]++; - } - } - } - - let message = `Translation completeness for ${context}` - let isComplete = true; - for (const ln of expectedLanguages) { - const amiss = missing[ln]; - const ok = present[ln]; - const total = amiss + ok; - message += ` ${ln}: ${ok}/${total}` - if (ok !== total) { - isComplete = false; - } - } - return missingTranlations - - } - main(args: string[]) { const lt = this.loadThemesAndLayers(); @@ -198,11 +141,6 @@ class LayerOverviewUtils { } } - if (missingTranslations.length > 0) { - console.log(missingTranslations.length, "missing translations") - writeFileSync("missing_translations.txt", missingTranslations.join("\n")) - } - if (layerErrorCount.length + themeErrorCount.length == 0) { console.log("All good!")