From bcf3e63829245f86f6995527f6abcb91adbdfe95 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 10 Apr 2022 10:53:05 +0200 Subject: [PATCH] Detect core translations on error messages --- scripts/generateTranslations.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/generateTranslations.ts b/scripts/generateTranslations.ts index 6564ff92c..d94873d99 100644 --- a/scripts/generateTranslations.ts +++ b/scripts/generateTranslations.ts @@ -233,7 +233,12 @@ class TranslationPart { } subparts = subparts.map(p => p.split(/\(.*\)/)[0]) if (subparts.indexOf(part) < 0) { - const [_, __, weblatepart, lang] = key.split("/") + let [_, __, weblatepart, lang] = key.split("/") + if (lang === undefined) { + // This is a core translation, it has one less path segment + lang = weblatepart + weblatepart = "core" + } errors.push({ error: `The translation for ${key} does not have the required subpart ${part}. \tThe full translation is ${value}