From a8ea9c6eff8b2ee912a8eb67a2ba828e2a89b83a Mon Sep 17 00:00:00 2001 From: pranavchoudhary-tech Date: Sat, 18 Jul 2026 08:59:23 +0530 Subject: [PATCH 1/4] docs: add Windows instructions for pomerge in translating guide --- documentation/translations/translating.rst | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/documentation/translations/translating.rst b/documentation/translations/translating.rst index 8f7ebe92d..72905d943 100644 --- a/documentation/translations/translating.rst +++ b/documentation/translations/translating.rst @@ -469,8 +469,6 @@ messages, regardless of file paths. To use it, first install the package: Then, merge translations from a specific commit (replace :samp:`{COMMIT_HASH}` with the commit hash from before the files were moved): -.. TODO: Provide Windows instructions. - .. tab:: Unix .. code-block:: bash @@ -492,6 +490,27 @@ with the commit hash from before the files were moved): # Clean up temporary dir rm -rf /tmp/old-po-files +.. tab:: Windows + + .. code-block:: dosbatch + + rem These commands are to be run in the root of the translation repo + + rem Check out a commit before the move + git checkout COMMIT_HASH -- . + + rem Copy translations to a temporary dir + xcopy . %TEMP%\old-po-files\ /E /I /Q /Y + + rem Return to the current version + git checkout HEAD -- . + + rem Merge translations from temporary dir back in + pomerge --from "%TEMP%\old-po-files\**\*.po" --to "**\*.po" --clear + + rem Clean up temporary dir + rmdir /S /Q %TEMP%\old-po-files + After running ``pomerge``, review the changes and commit the updated files. You may also need to rewrap the lines (see :pypi:`powrap`). From f56a02b6a44d72fc206bcd8d26de065a3147e604 Mon Sep 17 00:00:00 2001 From: pranavchoudhary-tech Date: Sat, 18 Jul 2026 22:16:14 +0530 Subject: [PATCH 2/4] docs: add activate-tab include to translating guide --- documentation/translations/translating.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/translations/translating.rst b/documentation/translations/translating.rst index 72905d943..137565fe1 100644 --- a/documentation/translations/translating.rst +++ b/documentation/translations/translating.rst @@ -4,6 +4,8 @@ Translating =========== +.. include:: /include/activate-tab.rst + .. highlight:: rest Several documentation translations are already in production and can be found From 768bed3607d0ea506039e72aac10b57c030bc333 Mon Sep 17 00:00:00 2001 From: pranavchoudhary-tech Date: Sun, 19 Jul 2026 08:10:13 +0530 Subject: [PATCH 3/4] docs: fix globbing commands for pomerge on Windows and Unix --- documentation/translations/translating.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/documentation/translations/translating.rst b/documentation/translations/translating.rst index 137565fe1..7c3ef790c 100644 --- a/documentation/translations/translating.rst +++ b/documentation/translations/translating.rst @@ -487,6 +487,7 @@ with the commit hash from before the files were moved): git checkout HEAD -- . # Merge translations from temporary dir back in + shopt -s globstar pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear # Clean up temporary dir @@ -507,11 +508,17 @@ with the commit hash from before the files were moved): rem Return to the current version git checkout HEAD -- . - rem Merge translations from temporary dir back in - pomerge --from "%TEMP%\old-po-files\**\*.po" --to "**\*.po" --clear + rem Learn translations from temporary dir + for /R "%TEMP%\old-po-files" %F in (*.po) do pomerge --from "%F" + + rem Apply translations to current files + for /R . %F in (*.po) do pomerge --to "%F" + + rem Clean up translation memory + pomerge --clear rem Clean up temporary dir - rmdir /S /Q %TEMP%\old-po-files + rmdir /S /Q "%TEMP%\old-po-files" After running ``pomerge``, review the changes and commit the updated files. You may also need to rewrap the lines (see :pypi:`powrap`). From 058e1da6b104df2c97f8420d22449709456a40ff Mon Sep 17 00:00:00 2001 From: pranavchoudhary-tech Date: Sun, 19 Jul 2026 14:37:24 +0530 Subject: [PATCH 4/4] docs: fix pomerge overwrite bug on Windows by switching to powershell --- documentation/translations/translating.rst | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/documentation/translations/translating.rst b/documentation/translations/translating.rst index 7c3ef790c..e4e0acab3 100644 --- a/documentation/translations/translating.rst +++ b/documentation/translations/translating.rst @@ -487,7 +487,7 @@ with the commit hash from before the files were moved): git checkout HEAD -- . # Merge translations from temporary dir back in - shopt -s globstar + shopt -s globstar # To find po files recursively, use the globstar option of bash, or your shell equivalent pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear # Clean up temporary dir @@ -495,30 +495,27 @@ with the commit hash from before the files were moved): .. tab:: Windows - .. code-block:: dosbatch + .. code-block:: powershell - rem These commands are to be run in the root of the translation repo + # These commands are to be run in the root of the translation repo - rem Check out a commit before the move + # Check out a commit before the move git checkout COMMIT_HASH -- . - rem Copy translations to a temporary dir - xcopy . %TEMP%\old-po-files\ /E /I /Q /Y + # Copy translations to a temporary dir + Copy-Item -Path . -Destination $env:TEMP\old-po-files -Recurse -Force - rem Return to the current version + # Return to the current version git checkout HEAD -- . - rem Learn translations from temporary dir - for /R "%TEMP%\old-po-files" %F in (*.po) do pomerge --from "%F" - - rem Apply translations to current files - for /R . %F in (*.po) do pomerge --to "%F" - - rem Clean up translation memory - pomerge --clear + # Merge translations from temporary dir back in + # We use PowerShell's Get-ChildItem to expand wildcards correctly + $old_files = (Get-ChildItem -Path $env:TEMP\old-po-files -Filter *.po -Recurse).FullName + $new_files = (Get-ChildItem -Filter *.po -Recurse).FullName + pomerge --from $old_files --to $new_files --clear - rem Clean up temporary dir - rmdir /S /Q "%TEMP%\old-po-files" + # Clean up temporary dir + Remove-Item -Path $env:TEMP\old-po-files -Recurse -Force After running ``pomerge``, review the changes and commit the updated files. You may also need to rewrap the lines (see :pypi:`powrap`).