Skip to content

Commit 73448bb

Browse files
docs: fix pomerge overwrite bug on Windows by switching to powershell
1 parent 57bbb0b commit 73448bb

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
@@ -413,38 +413,35 @@ with the commit hash from before the files were moved):
413413
git checkout HEAD -- .
414414
415415
# Merge translations from temporary dir back in
416-
shopt -s globstar
416+
shopt -s globstar # To find po files recursively, use the globstar option of bash, or your shell equivalent
417417
pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear
418418
419419
# Clean up temporary dir
420420
rm -rf /tmp/old-po-files
421421
422422
.. tab:: Windows
423423

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

0 commit comments

Comments
 (0)