PK eIBäÒÚwÝ4 Ý4 polib-1.0.0/index.html
This documentation covers the latest release of polib.
polib is a library 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.
polib is completely free and opensource, the license used is the MIT license. It was developed back in 2006 by David Jean Louis and it is still actively maintained.
To get up and running quickly, consult the quick-start guide, which describes all the necessary steps to install and use polib. For more detailed information about how to install and how to use polib, read through the documentation listed below.
Contents:
You are very welcome to contribute to the project! The bugtracker, wiki and mercurial repository can be found at the project’s page.
New releases are also published at the cheeseshop.
There are various possibilities to get involved, for example you can:
To run the tests, just type the following on a terminal:
$ cd /path/to/polib/
$ ./runtests.sh
If you want to generate coverage information:
$ pip install coverage
$ ./runtests.sh
$ coverage html
polib requires python 2.5 or higher.
There are several ways to install polib:
Several automatic package-installation tools are available for Python; the most popular are pip and easy_install . Either can be used to install polib.
Using pip, type:
pip install polib
Using easy_install, type:
easy_install polib
It is also possible that your operating system distributor provides a packaged version of polib. Consult your operating system’s package list for details, but be aware that third-party distributions may be providing older versions of polib, and so you should consult the documentation which comes with your operating system’s package.
If you prefer not to use an automated package installer, you can download a copy of polib and install it manually. The latest release package can be downloaded from polib’s page on the Python Package Index.
Once you’ve downloaded the package, unpack it, this will create the directory polib-X-Y-Z, which contains the setup.py installation script. From a command line in that directory, type:
python setup.py install
Note
On some systems you may need to execute this with administrative privileges (e.g., sudo python setup.py install).
If you’d like to try out the latest in-development code, you can obtain it from the polib repository, which is hosted at Bitbucket and uses Mercurial for version control.
To obtain the latest code and documentation, you’ll need to have Mercurial installed, at which point you can type:
hg clone http://bitbucket.org/izi/polib/
This will create a copy of the polib Mercurial repository on your computer; you can then add the polib.py file to your Python import path, or use the setup.py script to install as a package.
Please activate JavaScript to enable the search functionality.
From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.
Convenience function that parses the po or pot file pofile and returns a POFile instance.
Arguments:
Convenience function that parses the mo file mofile and returns a MOFile instance.
Arguments:
Try to detect the encoding used by the file. The file argument can be a PO or MO file path or a string containing the contents of the file. If the encoding cannot be detected, the function will return the value of default_encoding.
Arguments:
Po (or Pot) file reader/writer. This class inherits the _BaseFile class and, by extension, the python list type.
Convenience method that merges the current pofile with the pot file provided. It behaves exactly as the gettext msgmerge utility:
Keyword argument:
Convenience method that returns the percentage of translated messages.
Mo file reader/writer. This class inherits the _BaseFile class and, by extension, the python list type.
Saves the mofile to fpath.
Keyword argument: