<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>iwm.recipe.i18n</name>
<shortdesc>ZC Buildout recipe for creating i18n utilities</shortdesc>
<description>***********
I18n recipe
***********

.. contents::

This recipe generate calls of zope3 i18n utilities i18nextract and i18nmaergeall
for collecting and merging msgstr from packages.

Detailed Documentation
**********************

I18n Recipe
===========

Parameter
---------

This recipe generate calls of zope3 i18n utilities i18nextract and i18nmaergeall
for collecting and merging msgstr from packages.

The recipe has two options:

eggs
    The eggs option specified a list of eggs to test given as one ore
    more setuptools requirement strings.  Each string must be given on
    a separate line.

extra-paths
    One or more extra paths to include in the generated i18nextract script.


Example
-------

In Bebop the name of the domain is 'bebop', the package is 'src/bebop',
the output relative to the package is locales, and the location of site.zcml
is parts/instance/etc/site.zcml. The buildout snippet looks like:

::

    [i18n]
    recipe = iwm.recipe.i18n
    eggs = ${testinstance:eggs}
           iwm.recipe.i18n
    extra-paths = parts/zope3/src
                  parts/zope3/utilities

To re-extract i18n messages from the code execute ``bin/i18nextract``
from your buildout directory:

::

  $ bin/i18nextract -d &lt;domain&gt; -p &lt;path&gt; -o &lt;locales&gt; -s &lt;site.zcml&gt;

This will update the ``&lt;domain&gt;.pot`` file.

To merge those changes to all existing translations you can do that by
executing the ``bin/i18nmergeall`` script from your buildout directory:

::

  $ bin/i18nmergeall -l &lt;path&gt;/&lt;locales&gt;


Details
-------

The following text is partly lend from zc.recipe.testrunner.README.txt.

To illustrate this, we'll create a pair of projects in our sample
buildout::

    &gt;&gt;&gt; mkdir(sample_buildout, 'demo')
    &gt;&gt;&gt; mkdir(sample_buildout, 'demo', 'demo')
    &gt;&gt;&gt; write(sample_buildout, 'demo', 'demo', '__init__.py', '')
    &gt;&gt;&gt; write(sample_buildout, 'demo', 'setup.py',
    ... """
    ... from setuptools import setup
    ... 
    ... setup(name = "demo")
    ... """)

    &gt;&gt;&gt; mkdir(sample_buildout, 'demo2')
    &gt;&gt;&gt; mkdir(sample_buildout, 'demo2', 'demo2')
    &gt;&gt;&gt; write(sample_buildout, 'demo2', 'demo2', '__init__.py', '')
    &gt;&gt;&gt; write(sample_buildout, 'demo2', 'setup.py',
    ... """
    ... from setuptools import setup
    ... 
    ... setup(name = "demo2", install_requires= ['demoneeded'])
    ... """)

Demo 2 depends on demoneeded::

    &gt;&gt;&gt; mkdir(sample_buildout, 'demoneeded')
    &gt;&gt;&gt; mkdir(sample_buildout, 'demoneeded', 'demoneeded')
    &gt;&gt;&gt; write(sample_buildout, 'demoneeded', 'demoneeded', '__init__.py', '')
    &gt;&gt;&gt; write(sample_buildout, 'demoneeded', 'setup.py',
    ... """
    ... from setuptools import setup
    ... 
    ... setup(name = "demoneeded")
    ... """)

We'll update our buildout to install the demo project as a
develop egg and to create the test script::

    &gt;&gt;&gt; write(sample_buildout, 'buildout.cfg',
    ... """
    ... [buildout]
    ... develop = demo demoneeded demo2
    ... parts = i18n
    ... offline = true
    ...
    ... [i18n]
    ... recipe = iwm.recipe.i18n
    ... eggs = 
    ...    demo
    ...    demo2
    ... extra-paths = parts/zope3/src
    ...               parts/zope3/utilities
    ... """)

Note that we specified both demo and demo2 in the eggs
option and that we put them on separate lines.

We also specified the offline option to run the buildout in offline mode.

Now when we run the buildout::

    &gt;&gt;&gt; import os
    &gt;&gt;&gt; os.chdir(sample_buildout)
    &gt;&gt;&gt; print system(os.path.join(sample_buildout, 'bin', 'buildout') + ' -q'),

We get a i18n script installed in our bin directory::

    &gt;&gt;&gt; ls(sample_buildout, 'bin')
    -  buildout
    -  i18nextract
    -  i18nmergeall

We take a look of the content of i18nextract::

    &gt;&gt;&gt; cat(sample_buildout, 'bin', 'i18nextract') # doctest:
    #!python
    &lt;BLANKLINE&gt;
    import sys
    sys.path[0:0] = [
      '/sample-buildout/demo',
      '/sample-buildout/demo2',
      '/sample-buildout/eggs/zope.testing-X-pyN.N.egg',
      '/sample-buildout/eggs/setuptools-X-pyN.N.egg',
      '/sample-buildout/demoneeded',
      '/sample-buildout/parts/zope3/src',
      '/sample-buildout/parts/zope3/utilities',
      ]
    &lt;BLANKLINE&gt;
    import os
    sys.argv[0] = os.path.abspath(sys.argv[0])
    &lt;BLANKLINE&gt;
    &lt;BLANKLINE&gt;
    import i18nextract
    &lt;BLANKLINE&gt;
    if __name__ == '__main__':
        i18nextract.main()

And the content of i18nmergeall::

    &gt;&gt;&gt; cat(sample_buildout, 'bin', 'i18nmergeall') # doctest:
    #!python
    &lt;BLANKLINE&gt;
    import sys
    sys.path[0:0] = [
      '/sample-buildout/demo',
      '/sample-buildout/demo2',
      '/sample-buildout/eggs/zope.testing-X-pyN.N.egg',
      '/sample-buildout/eggs/setuptools-X-pyN.N.egg',
      '/sample-buildout/demoneeded',
      '/sample-buildout/parts/zope3/src',
      '/sample-buildout/parts/zope3/utilities',
      ]
    &lt;BLANKLINE&gt;
    import os
    sys.argv[0] = os.path.abspath(sys.argv[0])
    &lt;BLANKLINE&gt;
    &lt;BLANKLINE&gt;
    import iwm.recipe.i18n.ctl
    &lt;BLANKLINE&gt;
    if __name__ == '__main__':
        iwm.recipe.i18n.ctl.main_i18nmergeall()

Download
**********************</description>
<homepage rdf:resource="http://svn.kmrc.de/projects/devel/iwm.recipe.i18n" />
<maintainer><foaf:Person><foaf:name>Stefan Martin</foaf:name>
<foaf:mbox_sha1sum>3325cc9a7dc3c5cac2221c442afc7eb74c41d0e4</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.0.1</revision></Version></release>
</Project></rdf:RDF>