Skip to content

Commit 84bd6c5

Browse files
docs: add Windows instructions for pomerge in translating guide (fixes #1783)
1 parent 1d71f45 commit 84bd6c5

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

‎documentation/translations/translating.rst‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Translating
55
===========
66

7+
.. include:: /include/activate-tab.rst
8+
79
.. highlight:: rest
810

911
Several documentation translations are already in production and can be found
@@ -469,8 +471,6 @@ messages, regardless of file paths. To use it, first install the package:
469471
Then, merge translations from a specific commit (replace :samp:`{COMMIT_HASH}`
470472
with the commit hash from before the files were moved):
471473

472-
.. TODO: Provide Windows instructions.
473-
474474
.. tab:: Unix
475475

476476
.. code-block:: bash
@@ -487,11 +487,36 @@ 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 # To find po files recursively, use the globstar option of bash, or your shell equivalent
490491
pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear
491492
492493
# Clean up temporary dir
493494
rm -rf /tmp/old-po-files
494495
496+
.. tab:: Windows
497+
498+
.. code-block:: powershell
499+
500+
# These commands are to be run in the root of the translation repo
501+
502+
# Check out a commit before the move
503+
git checkout COMMIT_HASH -- .
504+
505+
# Copy translations to a temporary dir
506+
Copy-Item -Path . -Destination $env:TEMP\old-po-files -Recurse -Force
507+
508+
# Return to the current version
509+
git checkout HEAD -- .
510+
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
516+
517+
# Clean up temporary dir
518+
Remove-Item -Path $env:TEMP\old-po-files -Recurse -Force
519+
495520
After running ``pomerge``, review the changes and commit the updated files.
496521
You may also need to rewrap the lines (see :pypi:`powrap`).
497522

0 commit comments

Comments
 (0)