GitXplorerGitXplorer
J

pomerge

public
10 stars
3 forks
0 issues

Commits

List of commits on branch master.
Verified
fa83920923983ea0fe9cef347fb1be7fb429a2d8

Merge pull request #5 from JulienPalard/dependabot/add-v2-config-file

JJulienPalard committed 4 years ago
Verified
a7458faedec00ce50c71cbcd647cc921cc4ba670

Upgrade to GitHub-native Dependabot

ddependabot-preview[bot] committed 4 years ago
Verified
1efd5c25f10e4970413c5c643d8ecc220d8fdca1

Merge pull request #4 from Seluj78/patch-1

JJulienPalard committed 4 years ago
Verified
91f523dae0d53f7c78c664d2e1fb8026c5a86fc3

Update README.rst

SSeluj78 committed 4 years ago
Verified
ab5dafa549098ceb8e31351260527cdf146ffc1b

Added poutils section to README

SSeluj78 committed 4 years ago
Unverified
1c7a26cc0b1c9d68f0dd86a63c0489b69a0bdc8a

Bump version: 0.1.3 → 0.1.4

JJulienPalard committed 5 years ago

README

The README file for this repository.

======= pomerge

.. image:: https://img.shields.io/pypi/v/pomerge.svg :target: https://pypi.python.org/pypi/pomerge

Script to merge translations from a set of po files to other set of po files.

pomerge does not care about .po file names, a translation from one file can land in another as long as their msgid are identical.

Pomerge is part of poutils!

Poutils <https://pypi.org/project/poutils>_ (.po utils) is a metapackage to easily install useful Python tools to use with po files and pomerge is a part of it! Go check out Poutils <https://pypi.org/project/poutils>_ to discover the other tools!

Usage

Basic usage is pomerge --from source.po --to dest.po, see pomerge --help for more.

--from and --to are optional, when not given, pomerge will use a temporay file. So::

pomerge --from a/**/*.po --to b/**/*.po

is strictly equivalent to::

pomerge --from a/**/*.po
pomerge --to b/**/*.po

The wrapping of your .po files is not kept by pomerge, completly destroying the readability of git diffs, to fix this I use poindent <https://pypi.python.org/pypi/poindent>_.

Recipes

Propagating translations from a directory to another ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When you're having two directories with .po files and want to copy translations (msgstr) from one to another, even if the hiearchy is not the same, run::

pomerge --from ../contributors/**/*.po --to **/*.po

In this case, two options can be useful:

  • --no-overwrite: Avoid touching already translated strings.
  • --mark-as-fuzzy: Mark all new translations as fuzzy, usefull when you know you'll have to proofread the translations.

Propagating known translations ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In big projects, there may be multiple occurrences of the same string in different .po files, to automatically fill blanks with already translated ones, use::

pomerge --no-overwrite --from **/*.po --to **/*.po

The --no-overwrite is usefull if the same msgstr has already been translated twice, but differently (depending on the context maybe), the --no-overwrite will prevent one to be overwritten by the other.

Synchronizing translation between git branches ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you're having multiple branches of your documentation to track multiple branches of your project, you may want to synchronize known translations between branches, you can do it like this::

git checkout master  # The place where your contributors work
pomerge --from **/*.po  # Make pomerge "learn" this set of translations
git checkout old_version  # The translation for an old branch
pomerge --to **/*.po

This way you can still make old translation progress a bit while focusing only on the current master.