polib /

Filename Size Date modified Message
1.6 KB
1.0 KB
77 B
2.4 KB
44.9 KB
1.8 KB

:Author: David JEAN LOUIS <izimobil@gmail>
:Title: polib
:Version: 0.3.1
:License: MIT License
:Date: 11 dec. 2007

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

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

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.


Download latest version from: http://cheeseshop.python.org/pypi/polib/

On unix systems


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

If your system support the rpm format you can alternatively download the
binary rpm (polib-x.y.z-k.rpm) and install it as usual.

On windows systems

We recommend you download and install the binary package provided

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()


A complete tutorial is available here:

The api docs can be found here:


Bugtracker, wiki and svn repository can be found at:

New released are published at python cheeseshop:


Original author

David JEAN LOUIS <izimobil@gmail.com>


* Yuri Baburov <burchik@gmail.com>
* Anders Quist


* Gettext manual: http://www.gnu.org/software/gettext/manual/
* PO file format:
* MO file format:

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.