Skip to content

Commit 22700d1

Browse files
docs: fix pomerge overwrite bug on Windows by switching to powershell
1 parent 306e2d5 commit 22700d1

1 file changed

Lines changed: 14 additions & 17 deletions

File tree

documentation/translations/translating.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -416,38 +416,35 @@ with the commit hash from before the files were moved):
416416
git checkout HEAD -- .
417417
418418
# Merge translations from temporary dir back in
419-
shopt -s globstar
419+
shopt -s globstar # To find po files recursively, use the globstar option of bash, or your shell equivalent
420420
pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear
421421
422422
# Clean up temporary dir
423423
rm -rf /tmp/old-po-files
424424
425425
.. tab:: Windows
426426

427-
.. code-block:: dosbatch
427+
.. code-block:: powershell
428428
429-
rem These commands are to be run in the root of the translation repo
429+
# These commands are to be run in the root of the translation repo
430430
431-
rem Check out a commit before the move
431+
# Check out a commit before the move
432432
git checkout COMMIT_HASH -- .
433433
434-
rem Copy translations to a temporary dir
435-
xcopy . %TEMP%\old-po-files\ /E /I /Q /Y
434+
# Copy translations to a temporary dir
435+
Copy-Item -Path . -Destination $env:TEMP\old-po-files -Recurse -Force
436436
437-
rem Return to the current version
437+
# Return to the current version
438438
git checkout HEAD -- .
439439
440-
rem Learn translations from temporary dir
441-
for /R "%TEMP%\old-po-files" %F in (*.po) do pomerge --from "%F"
442-
443-
rem Apply translations to current files
444-
for /R . %F in (*.po) do pomerge --to "%F"
445-
446-
rem Clean up translation memory
447-
pomerge --clear
440+
# Merge translations from temporary dir back in
441+
# We use PowerShell's Get-ChildItem to expand wildcards correctly
442+
$old_files = (Get-ChildItem -Path $env:TEMP\old-po-files -Filter *.po -Recurse).FullName
443+
$new_files = (Get-ChildItem -Filter *.po -Recurse).FullName
444+
pomerge --from $old_files --to $new_files --clear
448445
449-
rem Clean up temporary dir
450-
rmdir /S /Q "%TEMP%\old-po-files"
446+
# Clean up temporary dir
447+
Remove-Item -Path $env:TEMP\old-po-files -Recurse -Force
451448
452449
After running ``pomerge``, review the changes and commit the updated files.
453450
You may also need to rewrap the lines (see :pypi:`powrap`).

0 commit comments

Comments
 (0)