Skip to content

Commit 058e1da

Browse files
docs: fix pomerge overwrite bug on Windows by switching to powershell
1 parent 768bed3 commit 058e1da

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
@@ -487,38 +487,35 @@ with the commit hash from before the files were moved):
487487
git checkout HEAD -- .
488488
489489
# Merge translations from temporary dir back in
490-
shopt -s globstar
490+
shopt -s globstar # To find po files recursively, use the globstar option of bash, or your shell equivalent
491491
pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear
492492
493493
# Clean up temporary dir
494494
rm -rf /tmp/old-po-files
495495
496496
.. tab:: Windows
497497

498-
.. code-block:: dosbatch
498+
.. code-block:: powershell
499499
500-
rem These commands are to be run in the root of the translation repo
500+
# These commands are to be run in the root of the translation repo
501501
502-
rem Check out a commit before the move
502+
# Check out a commit before the move
503503
git checkout COMMIT_HASH -- .
504504
505-
rem Copy translations to a temporary dir
506-
xcopy . %TEMP%\old-po-files\ /E /I /Q /Y
505+
# Copy translations to a temporary dir
506+
Copy-Item -Path . -Destination $env:TEMP\old-po-files -Recurse -Force
507507
508-
rem Return to the current version
508+
# Return to the current version
509509
git checkout HEAD -- .
510510
511-
rem Learn translations from temporary dir
512-
for /R "%TEMP%\old-po-files" %F in (*.po) do pomerge --from "%F"
513-
514-
rem Apply translations to current files
515-
for /R . %F in (*.po) do pomerge --to "%F"
516-
517-
rem Clean up translation memory
518-
pomerge --clear
511+
# Merge translations from temporary dir back in
512+
# We use PowerShell's Get-ChildItem to expand wildcards correctly
513+
$old_files = (Get-ChildItem -Path $env:TEMP\old-po-files -Filter *.po -Recurse).FullName
514+
$new_files = (Get-ChildItem -Filter *.po -Recurse).FullName
515+
pomerge --from $old_files --to $new_files --clear
519516
520-
rem Clean up temporary dir
521-
rmdir /S /Q "%TEMP%\old-po-files"
517+
# Clean up temporary dir
518+
Remove-Item -Path $env:TEMP\old-po-files -Recurse -Force
522519
523520
After running ``pomerge``, review the changes and commit the updated files.
524521
You may also need to rewrap the lines (see :pypi:`powrap`).

0 commit comments

Comments
 (0)