From 03d87023e07f037fce4755eaf6866c1b4e338acb Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 31 May 2021 12:51:29 +0200 Subject: [PATCH] Add option to ignore weblate --- scripts/generateTranslations.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/generateTranslations.ts b/scripts/generateTranslations.ts index 9f0e38fe0..d322ad071 100644 --- a/scripts/generateTranslations.ts +++ b/scripts/generateTranslations.ts @@ -181,7 +181,7 @@ function compileTranslationsFromWeblate() { } -// Get all the strings out of the layers +// Get all the strings out of the layers; writes them onto the weblate paths function generateTranslationsObjectFrom(objects: { path: string, parsed: { id: string } }[], target: string) { const tr = new TranslationPart(); @@ -275,7 +275,7 @@ function loadTranslationFilesFrom(target: string): Map { } /** - * Load the translations back into the layers + * Load the translations from the weblate files back into the layers */ function mergeLayerTranslations() { @@ -306,11 +306,17 @@ function mergeThemeTranslations() { } -mergeLayerTranslations(); -mergeThemeTranslations(); +const themeOverwritesWeblate = process.argv[0] === "--ignore-weblate" + +if(!themeOverwritesWeblate) { + mergeLayerTranslations(); + mergeThemeTranslations(); +} generateTranslationsObjectFrom(ScriptUtils.getLayerFiles(), "layers") generateTranslationsObjectFrom(ScriptUtils.getThemeFiles(), "themes") - -compileTranslationsFromWeblate(); +if(!themeOverwritesWeblate) { +// Generates the core translations + compileTranslationsFromWeblate(); +} genTranslations() \ No newline at end of file