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.

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.

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.

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.1.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pomerge-0.1.4-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pomerge-0.1.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4+

File hashes

Hashes for pomerge-0.1.4.tar.gz
Algorithm Hash digest
SHA256 03da3138f2cbfb4e48fafdd38a909823acc86baa39fff8efe05ec0548568e5ed
MD5 692a78a76cc6a34642902666b6b25e43
BLAKE2b-256 2c882d8e9b7b474fa34cbb7639577e964e0e0e471a28eee850d02bcb565a062e

See more details on using hashes here.

File details

Details for the file pomerge-0.1.4-py2.py3-none-any.whl.

File metadata

  • Download URL: pomerge-0.1.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4+

File hashes

Hashes for pomerge-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bb652fb1e13ae9ba536674df5490c488ecb75ba6a636f6c43394cb2952c96226
MD5 2717a776b7c4bf7a0cc69793d7b3b131
BLAKE2b-256 f65725f7ff330fc9e08d0770d91fbcb0f183f29be488a53c8aaefe2d8dfaa172

See more details on using hashes here.

Supported by

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