From 187d1bac897148ea8809191e9c664d2d5fce7565 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Mon, 17 Jul 2023 14:15:05 +0200 Subject: [PATCH] Merge pull request #13909 from overleaf/jpa-i18n-script-tweaks [web] scripts: translateLocales: tweaks GitOrigin-RevId: 79deb3ccae9c55ab71b0e8f44fe08f240c9f695f --- .../web/scripts/translations/translateLocales.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/services/web/scripts/translations/translateLocales.js b/services/web/scripts/translations/translateLocales.js index 88c441d2c9..1209c7ca2f 100644 --- a/services/web/scripts/translations/translateLocales.js +++ b/services/web/scripts/translations/translateLocales.js @@ -22,10 +22,14 @@ const argv = yargs(hideBin(process.argv)) description: 'Target 2-letter locale code', choices: VALID_LOCALES, }) + .option('skip-until', { + type: 'string', + description: 'Skip locales until after the provided key', + }) .parse() async function translateLocales() { - const { locale } = argv + let { locale, skip } = argv console.log(`Looking for missing [${locale}] translations...`) const keysToUploadFolder = Path.join(__dirname, `translated-keys-to-upload`) @@ -48,6 +52,10 @@ async function translateLocales() { ) for (const key of englishKeys) { + if (skip) { + if (key === skip) skip = '' + continue + } const translation = localeTranslations[key] if (!translation || translation.length === 0) { let value = await prompt( @@ -58,6 +66,10 @@ async function translateLocales() { `\nTranslations should not contain single-quote characters, please use curvy quotes (‘ or ’) instead:\n` ) } + if (!value) { + console.log(`Skipping ${key}`) + continue + } localeTranslations[key] = value const path = Path.join(LOCALES, `${locale}.json`)