Translation building script modification, for Weblate integration:

When pluggin Weblate to the repo, its first commits replaced `false` by
`true` in JSON files. See PR #184.
So i modified the build-language.js script to remove all translations
that are not strings. Should do the trick.
This commit is contained in:
John Livingston 2023-06-09 15:06:25 +02:00
parent 8f66ea4032
commit dd1662c3cf
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC

View File

@ -67,6 +67,10 @@ class BuildLanguages {
if (k in translationsStrings[l]) {
throw new Error(`Duplicate translation for key ${k} in lang ${l}.`)
}
if ((typeof v) !== 'string') {
// ignoring untranslated strings.
continue
}
translationsStrings[l][k] = v
}
}
@ -90,6 +94,10 @@ class BuildLanguages {
if (!(k in reference)) {
throw new Error(`File ${filePath} contains unknown keys. Key=${k}.`)
}
if ((typeof o[k]) !== 'string') {
// ignoring untranslated strings.
continue
}
const newKey = reference[k]
this.translationsStrings[l][newKey] = o[k]
}