***************
z3c.recipe.i18n
***************
This Zope 3 recipes offers different tools which allows to extract i18n
translation messages from egg based packages.
=======
CHANGES
=======
2.1 (2024-11-12)
----------------
- Add support for Python 3.13.
- Add support for Python 3.12.
- Drop support for Python 3.7.
2.0 (2023-02-08)
----------------
- Add support for Python 3.9, 3.10, 3.11.
- Drop support for Python 2.7, 3.5, 3.6.
1.2 (2019-06-25)
----------------
- Fix extraction on Python 3 by requiring a more recent version of
`zope.app.locales`.
- Add support for Python 3.8.
- Drop support for Python 3.4.
1.1 (2019-01-27)
----------------
- Require zope.app.locales >= 4.0 to get rid of code copied from there.
- Add support for Python 3.7.
1.0.0 (2018-01-10)
------------------
- Python 3 compatibility.
0.9.0 (2013-11-02)
------------------
- Depend on zc.buildout 2.0+. Features introduced with zc.buildout 1.5 are removed (don't work with the 2.x branch).
- Update trove classifiers to show that this package is currently only
compatible with Python 2.7.
0.8.1 (2012-01-06)
------------------
- Exit with a non-zero status code when one or more msgmerge calls fail.
- Use subprocess instead of os.system.
0.8.0 (2010-10-07)
------------------
- Depend on and use the new features of the zc.buildout 1.5 line. At the same
time support for zc.buildout <= 1.5.1 has been dropped.
- Fixed test setup to run with current zopetoolkit packages.
Made sure tests still run on older platforms, particularly Zope 2.12.
- Using python's `doctest` module instead of deprecated
`zope.testing.doctest`.
- Typo change in configuration: exludeDirNames becomes excludeDirNames (old
name is still supported for backward compatibility).
0.7.0 (2010-02-18)
------------------
- Fixed test setup to run with current packages.
- Added buildout option `verify_domain`. When set to ``true``
i18nextract only retrives the message ids of specified domain from
python files. Otherwise (default and previous behavior) all messages
ids in all domains in python files are retrieved.
0.6.0 (2009-12-02)
------------------
- Feature: Added new 'headerTemplate' option that allows to specify the path
of a customized pot header template.
- Feature: Added new 'extraPaths` option that is included in the PYTHONPATH.
This allows for instance the use with Zope 2.11.
- Makers are now called with additional keyword arguments.
- Fixed dependencies: The 'extract' extra of zope.app.locales is required.
0.5.4 (2009-06-08)
------------------
- Fix bug where zcml_strings collect the same path more then once because it
follows the configuration zcml for each package.
- Fix bug where i18ncompile miscalculated domains containing ".", everything
after the "." was ignored.
- The ``excludeDefaultDomain`` option actually works now.
0.5.3 (2009-03-12)
------------------
- Fix bug where i18nmerge miscalculated domains containing ".", everything
after the "." was ignored.
0.5.2 (2009-03-10)
------------------
- Feature: Generate ``*.po`` file based on ``*.pot`` file if non exists in
i18nmerge script
- Feature: Implemented i18ncompile script which uses ``msgfmt -o moPath poPath``
0.5.1 (2009-02-22)
------------------
- fix tests
- Updated docs to render nicely when fed to docutils. [ulif]
- Added `zip_safe` flag in `setup.py` to avoid meaningless warnings
when used with buildout. [ulif]
0.5.0 (2009-09-09)
------------------
- Implemented environment section argument support for i18nextract.py script.
This is a name of a section which defines a set of environment variables that
should be exported before starting the extraction.
- Initial Release
**********************
Detailed Documentation
**********************
=============================
Translation domain extraction
=============================
z3c.recipe.i18n
---------------
This Zope 3 recipes offers different tools which allows to extract i18n
translation messages from egg based packages.
The 'i18n' recipe can be used to generate the required scripts for extract
message ids from egg based packages. The i18nmerge allows to merge them into
a .po file. And the i18nstats script gives you an overview about the state
of the translated files.
Note
----
This i18nextract.py file uses different semantic for the arguments. The script
offers to define egg packages instead of one package path. This makes it easy
to define eggs as source where we extract the messages from.
Options
*******
The i18n recipe accepts the following options:
eggs
The names of one or more eggs, with their dependencies that should
be included in the Python path of the generated scripts.
packages
The names of one or more eggs which the messages should get extracted from.
Note, this is different to the original zope.app.locales implementation.
The original implementation uses one path as -d argument which assumes a
specific zope.* package structure with an old style trunk setup.
domain
The translation domain.
output
The path of the output file relative to the package root.
maker
One or more module name which can get used as additional maker. This module
must be located in the python path because it get resolved by
zope.configuration.name.resolve. For a sample maker see
z3c.csvvocabulary.csvStrings.
Makers are called with these arguments: 'path', 'base_path', 'exclude_dirs',
'domain', 'include_default_domain' and 'site_zcml'. The return value has to
be a catalog dictionary.
zcml (required)
The contents of configuration used for extraction. Normaly used for load meta
configuration. Note: To include a ZCML file outside package, you can use,
``include`` directive with ``file`` option. For example: ``<include
file="${buildout:directory}/etc/site.zcml" />``
excludeDefaultDomain (optional, default=False)
Exclude all messages found as part of the default domain. Messages are in
this domain, if their domain could not be determined. This usually happens
in page template snippets. (False if not used)
pythonOnly (optional, default=False)
Only extract message ids from Python (False if not used)
verify_domain (optional, default=False)
Retrieve all the messages in all the domains in python files when
verify_domain is False otherwise only retrive the messages of the
specified domain. (False if not used)
excludeDirectoryName (optional, default=[])
Allows to specify one or more directory name, relative to the package, to
exclude. (None if not used)
headerTemplate (optional, default=None)
The path of the pot header template relative to the buildout directory.
environment
A section name defining a set of environment variables that should be
exported before starting the tests. Can be used for set product
configuration enviroment.
extraPaths
A new line separated list of directories which are added to the PYTHONPATH.
Test
****
Lets define some (bogus) eggs that we can use in our application:
>>> mkdir('outputDir')
>>> mkdir('demo1')
>>> write('demo1', 'setup.py',
... '''
... from setuptools import setup
... setup(name = 'demo1')
... ''')
>>> mkdir('demo2')
>>> write('demo2', 'setup.py',
... '''
... from setuptools import setup
... setup(name = 'demo2', install_requires='demo1')
... ''')
Now check if the setup was correct:
>>> ls('bin')
- buildout
Lets create a minimal `buildout.cfg` file:
>>> write('buildout.cfg',
... '''
... [buildout]
... parts = i18n
... offline = true
...
... [i18n]
... recipe = z3c.recipe.i18n:i18n
... eggs = z3c.recipe.i18n
... packages = demo1
... domain = recipe
... output = outputDir
... zcml = <include package="z3c.recipe.tests" file="extract.zcml" />"
... ''' % globals())
Now, Let's run the buildout and see what we get:
>>> print(system(join('bin', 'buildout')))
Installing i18n.
i18n: setting up i18n tools
Generated script '/sample-buildout/bin/i18nextract'.
Generated script '/sample-buildout/bin/i18nmergeall'.
Generated script '/sample-buildout/bin/i18nstats'.
Generated script '/sample-buildout/bin/i18ncompile'...
After running buildout, the bin folder contains the different i18n script:
>>> ls('bin')
- buildout
- i18ncompile
- i18nextract
- i18nmergeall
- i18nstats
Raw data
{
"_id": null,
"home_page": "https://github.com/zopefoundation/z3c.recipe.i18n",
"name": "z3c.recipe.i18n",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "zope3 z3c i18n locales extraction recipe",
"author": "Roger Ineichen and the Zope Community",
"author_email": "zope-dev@zope.dev",
"download_url": "https://files.pythonhosted.org/packages/89/52/0e1e41d103d09329eeb32a65d2fac468360dc8f70da86fbf4946418a2e4b/z3c_recipe_i18n-2.1.tar.gz",
"platform": null,
"description": "***************\nz3c.recipe.i18n\n***************\n\nThis Zope 3 recipes offers different tools which allows to extract i18n \ntranslation messages from egg based packages.\n\n\n=======\nCHANGES\n=======\n\n2.1 (2024-11-12)\n----------------\n\n- Add support for Python 3.13.\n\n- Add support for Python 3.12.\n\n- Drop support for Python 3.7.\n\n\n2.0 (2023-02-08)\n----------------\n\n- Add support for Python 3.9, 3.10, 3.11.\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n1.2 (2019-06-25)\n----------------\n\n- Fix extraction on Python 3 by requiring a more recent version of\n `zope.app.locales`.\n\n- Add support for Python 3.8.\n\n- Drop support for Python 3.4.\n\n\n1.1 (2019-01-27)\n----------------\n\n- Require zope.app.locales >= 4.0 to get rid of code copied from there.\n\n- Add support for Python 3.7.\n\n\n1.0.0 (2018-01-10)\n------------------\n\n- Python 3 compatibility.\n\n0.9.0 (2013-11-02)\n------------------\n\n- Depend on zc.buildout 2.0+. Features introduced with zc.buildout 1.5 are removed (don't work with the 2.x branch).\n\n- Update trove classifiers to show that this package is currently only\n compatible with Python 2.7.\n\n0.8.1 (2012-01-06)\n------------------\n\n- Exit with a non-zero status code when one or more msgmerge calls fail.\n\n- Use subprocess instead of os.system.\n\n\n0.8.0 (2010-10-07)\n------------------\n\n- Depend on and use the new features of the zc.buildout 1.5 line. At the same\n time support for zc.buildout <= 1.5.1 has been dropped.\n\n- Fixed test setup to run with current zopetoolkit packages.\n Made sure tests still run on older platforms, particularly Zope 2.12.\n\n- Using python's `doctest` module instead of deprecated\n `zope.testing.doctest`.\n\n- Typo change in configuration: exludeDirNames becomes excludeDirNames (old\n name is still supported for backward compatibility).\n\n0.7.0 (2010-02-18)\n------------------\n\n- Fixed test setup to run with current packages.\n\n- Added buildout option `verify_domain`. When set to ``true``\n i18nextract only retrives the message ids of specified domain from\n python files. Otherwise (default and previous behavior) all messages\n ids in all domains in python files are retrieved.\n\n\n0.6.0 (2009-12-02)\n------------------\n\n- Feature: Added new 'headerTemplate' option that allows to specify the path\n of a customized pot header template.\n\n- Feature: Added new 'extraPaths` option that is included in the PYTHONPATH.\n This allows for instance the use with Zope 2.11.\n\n- Makers are now called with additional keyword arguments.\n\n- Fixed dependencies: The 'extract' extra of zope.app.locales is required.\n\n0.5.4 (2009-06-08)\n------------------\n\n- Fix bug where zcml_strings collect the same path more then once because it\n follows the configuration zcml for each package.\n\n- Fix bug where i18ncompile miscalculated domains containing \".\", everything\n after the \".\" was ignored.\n\n- The ``excludeDefaultDomain`` option actually works now.\n\n0.5.3 (2009-03-12)\n------------------\n\n- Fix bug where i18nmerge miscalculated domains containing \".\", everything\n after the \".\" was ignored.\n\n\n0.5.2 (2009-03-10)\n------------------\n\n- Feature: Generate ``*.po`` file based on ``*.pot`` file if non exists in\n i18nmerge script\n\n- Feature: Implemented i18ncompile script which uses ``msgfmt -o moPath poPath``\n\n\n0.5.1 (2009-02-22)\n------------------\n\n- fix tests\n\n- Updated docs to render nicely when fed to docutils. [ulif]\n\n- Added `zip_safe` flag in `setup.py` to avoid meaningless warnings\n when used with buildout. [ulif]\n\n\n0.5.0 (2009-09-09)\n------------------\n\n- Implemented environment section argument support for i18nextract.py script.\n This is a name of a section which defines a set of environment variables that\n should be exported before starting the extraction.\n\n- Initial Release\n\n\n**********************\nDetailed Documentation\n**********************\n\n=============================\nTranslation domain extraction\n=============================\n\nz3c.recipe.i18n\n---------------\n\nThis Zope 3 recipes offers different tools which allows to extract i18n\ntranslation messages from egg based packages.\n\nThe 'i18n' recipe can be used to generate the required scripts for extract\nmessage ids from egg based packages. The i18nmerge allows to merge them into\na .po file. And the i18nstats script gives you an overview about the state\nof the translated files.\n\nNote\n----\n\nThis i18nextract.py file uses different semantic for the arguments. The script\noffers to define egg packages instead of one package path. This makes it easy\nto define eggs as source where we extract the messages from.\n\n\nOptions\n*******\n\nThe i18n recipe accepts the following options:\n\neggs\n The names of one or more eggs, with their dependencies that should\n be included in the Python path of the generated scripts.\n\npackages\n The names of one or more eggs which the messages should get extracted from.\n Note, this is different to the original zope.app.locales implementation.\n The original implementation uses one path as -d argument which assumes a\n specific zope.* package structure with an old style trunk setup.\n\ndomain\n The translation domain.\n\noutput\n The path of the output file relative to the package root.\n\nmaker\n One or more module name which can get used as additional maker. This module\n must be located in the python path because it get resolved by\n zope.configuration.name.resolve. For a sample maker see\n z3c.csvvocabulary.csvStrings.\n Makers are called with these arguments: 'path', 'base_path', 'exclude_dirs',\n 'domain', 'include_default_domain' and 'site_zcml'. The return value has to\n be a catalog dictionary.\n\nzcml (required)\n The contents of configuration used for extraction. Normaly used for load meta\n configuration. Note: To include a ZCML file outside package, you can use,\n ``include`` directive with ``file`` option. For example: ``<include\n file=\"${buildout:directory}/etc/site.zcml\" />``\n\nexcludeDefaultDomain (optional, default=False)\n Exclude all messages found as part of the default domain. Messages are in\n this domain, if their domain could not be determined. This usually happens\n in page template snippets. (False if not used)\n\npythonOnly (optional, default=False)\n Only extract message ids from Python (False if not used)\n\nverify_domain (optional, default=False)\n Retrieve all the messages in all the domains in python files when\n verify_domain is False otherwise only retrive the messages of the\n specified domain. (False if not used)\n\nexcludeDirectoryName (optional, default=[])\n Allows to specify one or more directory name, relative to the package, to\n exclude. (None if not used)\n\nheaderTemplate (optional, default=None)\n The path of the pot header template relative to the buildout directory.\n\nenvironment\n A section name defining a set of environment variables that should be\n exported before starting the tests. Can be used for set product\n configuration enviroment.\n\nextraPaths\n A new line separated list of directories which are added to the PYTHONPATH.\n\nTest\n****\n\nLets define some (bogus) eggs that we can use in our application:\n\n >>> mkdir('outputDir')\n >>> mkdir('demo1')\n >>> write('demo1', 'setup.py',\n ... '''\n ... from setuptools import setup\n ... setup(name = 'demo1')\n ... ''')\n\n >>> mkdir('demo2')\n >>> write('demo2', 'setup.py',\n ... '''\n ... from setuptools import setup\n ... setup(name = 'demo2', install_requires='demo1')\n ... ''')\n\nNow check if the setup was correct:\n\n >>> ls('bin')\n - buildout\n\nLets create a minimal `buildout.cfg` file:\n\n >>> write('buildout.cfg',\n ... '''\n ... [buildout]\n ... parts = i18n\n ... offline = true\n ...\n ... [i18n]\n ... recipe = z3c.recipe.i18n:i18n\n ... eggs = z3c.recipe.i18n\n ... packages = demo1\n ... domain = recipe\n ... output = outputDir\n ... zcml = <include package=\"z3c.recipe.tests\" file=\"extract.zcml\" />\"\n ... ''' % globals())\n\nNow, Let's run the buildout and see what we get:\n\n >>> print(system(join('bin', 'buildout')))\n Installing i18n.\n i18n: setting up i18n tools\n Generated script '/sample-buildout/bin/i18nextract'.\n Generated script '/sample-buildout/bin/i18nmergeall'.\n Generated script '/sample-buildout/bin/i18nstats'.\n Generated script '/sample-buildout/bin/i18ncompile'...\n\nAfter running buildout, the bin folder contains the different i18n script:\n\n >>> ls('bin')\n - buildout\n - i18ncompile\n - i18nextract\n - i18nmergeall\n - i18nstats\n\n",
"bugtrack_url": null,
"license": "ZPL 2.1",
"summary": "Zope3 egg based i18n locales extraction recipes",
"version": "2.1",
"project_urls": {
"Homepage": "https://github.com/zopefoundation/z3c.recipe.i18n"
},
"split_keywords": [
"zope3",
"z3c",
"i18n",
"locales",
"extraction",
"recipe"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9bd337649df3dc2e711ef3a20e7bf9b44b89fa3a19237e53d1c02c493f277860",
"md5": "8bea880de864c2bc7201ec4db89c4c23",
"sha256": "9e7db735e6357aa991fb7dfea4966894e6f5f6137da1adce1c3199e554881615"
},
"downloads": -1,
"filename": "z3c.recipe.i18n-2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8bea880de864c2bc7201ec4db89c4c23",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19935,
"upload_time": "2024-11-12T08:15:46",
"upload_time_iso_8601": "2024-11-12T08:15:46.369139Z",
"url": "https://files.pythonhosted.org/packages/9b/d3/37649df3dc2e711ef3a20e7bf9b44b89fa3a19237e53d1c02c493f277860/z3c.recipe.i18n-2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "89520e1e41d103d09329eeb32a65d2fac468360dc8f70da86fbf4946418a2e4b",
"md5": "b42df782e6af821ca4acdd8ee3f1823a",
"sha256": "84c883a0599e42362bafc93f7633f4f7e4242de2145934c0e64857cd41c542f1"
},
"downloads": -1,
"filename": "z3c_recipe_i18n-2.1.tar.gz",
"has_sig": false,
"md5_digest": "b42df782e6af821ca4acdd8ee3f1823a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 18190,
"upload_time": "2024-11-12T08:15:48",
"upload_time_iso_8601": "2024-11-12T08:15:48.495734Z",
"url": "https://files.pythonhosted.org/packages/89/52/0e1e41d103d09329eeb32a65d2fac468360dc8f70da86fbf4946418a2e4b/z3c_recipe_i18n-2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-12 08:15:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zopefoundation",
"github_project": "z3c.recipe.i18n",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "z3c.recipe.i18n"
}