Skip to content

Commit db9df08

Browse files
Add FAQ entry on merging
1 parent 4512ced commit db9df08

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

documentation/translations/translating.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,5 +361,51 @@ If you would like to coordinate, open a pull request in the
361361
at the top of this page, and ping ``@python/editorial-board``.
362362

363363

364+
How do I merge translations back in after docs are moved?
365+
---------------------------------------------------------
366+
367+
When docs are moved in the CPython repository, translated messages are not
368+
moved automatically and will be lost.
369+
They can be recovered by merging them into the new locations.
370+
Note that this is not necessary for Transifex-based translations, as Transifex's
371+
translation memory will automatically copy them over.
372+
373+
The :pypi:`pomerge` tool merges translations between PO files by matching
374+
message, regardless of file paths. To use it, first install the package:
375+
376+
.. code-block:: bash
377+
378+
pip install pomerge
379+
380+
Then, merge translations from a specific commit (replace :samp:`{COMMIT_HASH}`
381+
with the commit hash from before the files were moved):
382+
383+
.. TODO: Provide Windows instructions.
384+
385+
.. tab:: Unix
386+
387+
.. code-block:: bash
388+
389+
# These commands are to be run in the root of the translation repo
390+
391+
# Check out a commit before the move
392+
git checkout COMMIT_HASH -- .
393+
394+
# Copy translations to a temporary dir
395+
cp -r . /tmp/old-po-files
396+
397+
# Return to the current version
398+
git checkout HEAD -- .
399+
400+
# Merge translations from temporary dir back in
401+
pomerge --from /tmp/old-po-files/**/*.po --to **/*.po --clear
402+
403+
# Clean up temporary dir
404+
rm -rf /tmp/old-po-files
405+
406+
After running ``pomerge``, review the changes and commit the updated files.
407+
You may also need to rewrap the lines (see :pypi:`powrap`).
408+
409+
364410
.. _discourse: https://discuss.python.org/c/documentation/translations/
365411
.. _tx: https://explore.transifex.com/python-doc/python-newest/

0 commit comments

Comments
 (0)