A library to manipulate gettext catalogs files (aka .po and .mo files).
Project description
polib allows you to manipulate, create, modify gettext catalogs (.pot, .po and binary .mo files). You can load existing files, iterate through it’s entries, add, modify entries, comments or metadata, etc… or create new po/pot files from scratch.
polib provides a simple and pythonic API, exporting only two convenience functions ‘pofile’ and ‘mofile’, and the 4 core classes: POFile, MOFile, POEntry and MOEntry for creating new files/entries.
A basic example
>>> import polib >>> # load an existing po file >>> po = polib.pofile('tests/test.po') >>> for entry in po: ... # do something with entry... ... print entry.msgid, entry.msgstr >>> # add an entry >>> entry = polib.POEntry() >>> entry.msgid = 'Welcome' >>> entry.msgstr = 'Bienvenue' >>> entry.occurences = [('welcome.py', '12'), ('anotherfile.py', '34')] >>> po.append(entry) >>> # save our modified po file >>> po.save()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file polib-0.1.0.tar.gz
.
File metadata
- Download URL: polib-0.1.0.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eacea6da138ea8fbadc36f4caf87bf28b916cf1ee68cfc0a05f93fbc104ad71c |
|
MD5 | 264010ffc02e516afe4907222d192dad |
|
BLAKE2b-256 | d8ac95a24910cc3eb2523cd1b0848a6fdb9ffcc0a776c04fb799111a8cb29bb0 |
File details
Details for the file polib-0.1.0.win32.exe
.
File metadata
- Download URL: polib-0.1.0.win32.exe
- Upload date:
- Size: 70.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf9612373d59bfa8a2037a0fa1668faa02bac1777374edbc409437329f0fd20b |
|
MD5 | fb244fa9a7c1f545ef851cc1b480d302 |
|
BLAKE2b-256 | 4eb88209087423a040170b924d9a8268ad3b4b2f34dc99052bdd84affdc897cd |
File details
Details for the file polib-0.1.0-1.noarch.rpm
.
File metadata
- Download URL: polib-0.1.0-1.noarch.rpm
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eb2f3835997a030b555851ed1557a8aa0f3ce16186b52f219f785e439daacc6 |
|
MD5 | e41f246c69857f151586521c548482df |
|
BLAKE2b-256 | d9814d8b59856c4b4004adaa9611668a9efb6bd0ec690a69cd03c2ffc80965a9 |