Clone wiki

polib / Home


polib.svg polib.svg polib.svg

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 supports out of the box any version of python ranging from 2.4 to latest 3.X version.

polib is pretty stable now and is used by many opensource projects.

If you find polib useful, please consider giving a donation via paypal, any contribution will be greatly appreciated.



Note: chances are that polib is already packaged for your linux/bsd system, if so, we recommend you use your OS package system, if not then choose a method below:

Installing latest polib version with pip

$ pip install polib

Installing latest polib version from source tarball

Download latest version

$ tar xzfv polib-x.y.z.tar.gz
$ cd polib-x.y.z
$ python setup build
$ sudo python install

Installing the polib development version

Note: this is not recommended in a production environment.

$ hg clone
$ cd polib
$ python setup build
$ sudo python install

Basic usage example

import polib

# load an existing po file
po = polib.pofile('tests/test_utf8.po')

for entry in po:
    # do something with your entry like:
    print entry.msgid, entry.msgstr

# adding an entry
entry = polib.POEntry(msgid='Welcome', msgstr='Bienvenue')
entry.occurrences = [('', '12'), ('', '34')]

# saving the modified po file

# compile it to an mo file


polib is generously documented, you can browse the documentation online thanks to the amazing Read The Docs project.


Bugtracker, wiki and mercurial repository can be found at the project's page. New releases are also published on the official Python Package Index.


Author: David Jean Louis.