Skip to main content

Merge known translations between .po files.

Project description

https://img.shields.io/pypi/v/pomerge.svg

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 (.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 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 temporary file. So:

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

is strictly equivalent to:

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

One more option is --clear that make pomerge forgot what it learned, this can be useful to avoid mixing languages:

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

is equivalent to:

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

The wrapping of your .po files is not kept by pomerge, completely destroying the readability of git diffs, to fix this I use powrap.

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 hierarchy 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, useful 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 useful 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pomerge-0.2.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pomerge-0.2.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pomerge-0.2.1.tar.gz.

File metadata

  • Download URL: pomerge-0.2.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pomerge-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e78c6e55a9643f5b0ab105c952550c4783314de245b57ad428765515647322ee
MD5 4a51be24be56a35b63eb4ddb7b9580b2
BLAKE2b-256 a0ab1b1c80a42ca8a8411e1eff41cb68cf56d701f2eb984c208791fbf8ac8629

See more details on using hashes here.

File details

Details for the file pomerge-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pomerge-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pomerge-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f14f093ea7cdf5dbb9d8da8ed789e48b47f7f4073effd0820cb605013f46d692
MD5 e86cad76c4647542f47f161be8e72fbf
BLAKE2b-256 ec429403831307611e399fd0fb3f858088aca3905e970dfe9ca0e5aad7cf4806

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page