Detect core translations on error messages

This commit is contained in:
Pieter Vander Vennet 2022-04-10 10:53:05 +02:00 committed by GitHub
parent 39a2c3dd86
commit bcf3e63829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}