From bc82b990bb5d184512daeeb8e369d17adbf23d79 Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Mon, 26 Sep 2022 09:57:17 -0700 Subject: [PATCH 1/2] Update prevent-translation-commits.js (#31145) --- script/prevent-translation-commits.js | 34 +++++++++------------------ 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/script/prevent-translation-commits.js b/script/prevent-translation-commits.js index 77486a03a0..72e0bae0fa 100755 --- a/script/prevent-translation-commits.js +++ b/script/prevent-translation-commits.js @@ -19,28 +19,16 @@ if (process.env.CI) process.exit() // Allow this hook to be overriden with an environment variable if (process.env.ALLOW_TRANSLATION_COMMITS) process.exit() -const filenames = execSync('git diff --cached --name-only').toString().trim().split('\n') -const localizedFilenames = filenames.filter((filename) => filename.startsWith('translations/')) - -if (localizedFilenames.length) { - console.error( - '\nāœ‹ Uh oh! Detected changes to the following files in the `/translations` directory:' - ) - console.table(localizedFilenames.join('\n')) - console.error( - 'The content in this directory is managed by our translation pipeline and should not be edited directly in the repo.' - ) - console.error( - 'For more information on how the localization process works, see translations/README.md' - ) - console.error( - '\nIf you have accidentally edited these files, you can unstage these changes on the command line using `git restore --staged translations`\n' - ) - console.error( - '\nIf you are performing a merge from `main`, you should bypass this hook by using ` git commit --no-verify`\n' - ) - console.error( - '\nIf you need to edit translated files often, you can set `ALLOW_TRANSLATION_COMMITS=true` in your .env file.`\n' - ) +try { + execSync('git diff --exit-code --quiet --cached -- translations') +} catch (err) { + console.error(` +āœ‹ Uh oh! Detected changes to the files in the \`/translations\` directory.' +The content in this directory is managed by our translation pipeline and should not be edited directly in the repo. +For more information on how the localization process works, see \`translations/README.md\`. +If you have accidentally edited these files, you can unstage these changes on the command line using \`git restore --staged translations\`. +If you are performing a merge from \`main\`, you should bypass this hook by using \`git commit --no-verify\`. +If you need to edit translated files often, you can set \`ALLOW_TRANSLATION_COMMITS=true\` in your .env file. +`) process.exit(1) } From 3a1b5f27755703b563f126084012d33fe9be51cd Mon Sep 17 00:00:00 2001 From: docubot <67483024+docubot@users.noreply.github.com> Date: Mon, 26 Sep 2022 12:02:29 -0500 Subject: [PATCH 2/2] New translation batch for pt (#31119) Co-authored-by: Grace Park