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