<commit_before>=====
polib
=====

Introduction
------------

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 is pretty stable now and is used by many `opensource projects <http://bitbucket.org/izi/polib/wiki/ProjectsUsingPolib>`_.


Installation
------------

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 setuptools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

$ easy_install polib

Installing latest polib version with pip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

$ pip install polib

Installing latest polib version from source tarball
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`Download latest version <http://bitbucket.org/izi/polib/downloads/>`_

::

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

Installing the polib development version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: this is **not recommended** in a production environment.

::

$ hg clone http://bitbucket.org/izi/polib/
$ cd polib
$ python setup build
$ sudo python setup.py install

Basic usage example
-------------------

::

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

Documentation
-------------

`A tutorial <http://bitbucket.org/izi/polib/wiki/Tutorial>`_ is available and
you can also browse the `complete api documentation <http://www.izimobil.org/polib/api/>`_.

Development
-----------

Bugtracker, wiki and mercurial repository can be found at the `project's page <http://bitbucket.org/izi/polib/>`_.
New releases are also published at the `cheeseshop <http://cheeseshop.python.org/pypi/polib/>`_.


Credits
-------

**Author:** `<NAME> <<EMAIL>>`_.

References
----------

* `Gettext Manual <http://www.gnu.org/software/gettext/manual/>`_
* `PO file format <http://www.gnu.org/software/gettext/manual/html_node/gettext_9.html>`_
* `MO file format <http://www.gnu.org/software/gettext/manual/html_node/gettext_136.html>`_

<commit_msg>Cosmetic changes in README file<commit_after>.. _readme:

polib
=====

Introduction
------------

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 is pretty stable now and is used by many 
`opensource projects <http://bitbucket.org/izi/polib/wiki/ProjectsUsingPolib>`_.


Installation
------------

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 setuptools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

$ easy_install polib

Installing latest polib version with pip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

$ pip install polib

Installing latest polib version from source tarball
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`Download latest version <http://bitbucket.org/izi/polib/downloads/>`_

::

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

Installing the polib development version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: this is **not recommended** in a production environment.

::

$ hg clone http://bitbucket.org/izi/polib/
$ cd polib
$ python setup build
$ sudo python setup.py install

Basic usage example
-------------------

::

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

Documentation
-------------

`A tutorial <http://bitbucket.org/izi/polib/wiki/Tutorial>`_ is available and
you can also browse the `complete api documentation <http://www.izimobil.org/polib/api/>`_.

Development
-----------

Bugtracker, wiki and mercurial repository can be found at the `project's page <http://bitbucket.org/izi/polib/>`_.
New releases are also published at the `cheeseshop <http://cheeseshop.python.org/pypi/polib/>`_.


Credits
-------

**Author:** `<NAME> <<EMAIL>>`_.

References
----------

* `Gettext Manual <http://www.gnu.org/software/gettext/manual/>`_
* `PO file format <http://www.gnu.org/software/gettext/manual/html_node/gettext_9.html>`_
* `MO file format <http://www.gnu.org/software/gettext/manual/html_node/gettext_136.html>`_


{'fraction_non_alphanumeric': 0.21614485099962277, 'fraction_numerical': 0.003772161448509996, 'mean_word_length': 4.026540284360189, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6359242', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1586, 'n_words': 496}