From dd1662c3cf4d7898117250a645e8570adfa55593 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Fri, 9 Jun 2023 15:06:25 +0200 Subject: [PATCH] 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. --- build-languages.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-languages.js b/build-languages.js index 53a9d3b7..26e31364 100644 --- a/build-languages.js +++ b/build-languages.js @@ -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] }