Skip to main content

A library to manipulate gettext files (po and mo files).

Project description

polib allows you to manipulate, create, modify gettext files (pot, po and mo files). You can load existing files, iterate through it’s entries, add, modify entries, comments or metadata, etc… or create new po files from scratch.

polib provides a simple and pythonic API, exporting only three convenience functions pofile, mofile and detect_encoding, and the 4 core classes: POFile, MOFile, POEntry and MOEntry for creating new files/entries.

What’s new in version 0.3

  • polib can compile mo files now,

  • full unicode support,

  • performance improvements,

  • bugfixes and code improvements

Basic usage example

>>> import polib
>>> # load an existing po file
>>> po = polib.pofile('tests/test_utf8.po')
>>> for entry in po:
...     # do something with entry...
...     print entry.msgid, entry.msgstr
>>> # add an entry
>>> entry = polib.POEntry(msgid='Welcome', msgstr='Bienvenue')
>>> entry.occurences = [('welcome.py', '12'), ('anotherfile.py', '34')]
>>> po.append(entry)
>>> # save our modified po file
>>> po.save()
>>> # compile it to a mo file
>>> po.save_as_mofile('tests/test_utf8.mo')

Download it from here and visit: http://code.google.com/p/polib/

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

polib-0.3.0.tar.gz (199.8 kB view details)

Uploaded Source

Built Distributions

polib-0.3.0.win32.exe (71.9 kB view details)

Uploaded Source

polib-0.3.0-1.noarch.rpm (22.6 kB view details)

Uploaded Source

File details

Details for the file polib-0.3.0.tar.gz.

File metadata

  • Download URL: polib-0.3.0.tar.gz
  • Upload date:
  • Size: 199.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for polib-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cc8cf53bc8e189edbd6642b6e051460918817157acd44785cc5c748fec12bfd1
MD5 351596871500a50733cd0179f8197416
BLAKE2b-256 4fad1994e0f397b84ab2a61cbe7e619d01284b782e9b932c5b3962cb5d3be943

See more details on using hashes here.

File details

Details for the file polib-0.3.0.win32.exe.

File metadata

  • Download URL: polib-0.3.0.win32.exe
  • Upload date:
  • Size: 71.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for polib-0.3.0.win32.exe
Algorithm Hash digest
SHA256 6afe122f4103e1e448982ce27eabbdc973dace1dd356e4aa0009665a28d445a4
MD5 3e6c4f7314082dffbc1525f2874f5fc2
BLAKE2b-256 6e99fb7740cc3a991759d2fa390c1274767a785b2be8f5fa51e71cb21ffb9192

See more details on using hashes here.

File details

Details for the file polib-0.3.0-1.noarch.rpm.

File metadata

  • Download URL: polib-0.3.0-1.noarch.rpm
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for polib-0.3.0-1.noarch.rpm
Algorithm Hash digest
SHA256 2b3e0fda9756a8ed70b5048d0ebde43c3fc0cd4b1a3bf0538e0ba7cadcd1d30f
MD5 c75174241897ef65fccdab92b37d4d92
BLAKE2b-256 bea3da63d8da14d05e27f437f54d1c70c4efa31e270a98d0c46aea8ca140c5f2

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