zope.app.locales


Namezope.app.locales JSON
Version 5.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/zope.app.locales/
SummaryZope locale extraction and management utilities
upload_time2025-08-08 06:32:59
maintainerNone
docs_urlNone
authorZope Foundation and Contributors
requires_python>=3.9
licenseZPL-2.1
keywords zope3 i18n l10n translation gettext
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ================
zope.app.locales
================

This package provides some facilities for extracting and managing i18n
messages that occur in Zope software.  More specifically, i18n
messages can occur in Python code, in Page Templates and in ZCML
declarations.  ``zope.app.locales`` provides a utility that can
extract messages from all three and write them to a standard gettext
template (``pot`` file).

Usage
-----

Version 4.2 does not contain any ``*.mo`` files. They are the compiled
translation files (``*.po``). (Future versions will contain them again.)

To generate or update ``*.mo`` files on the fly set the following environment
variable::

    zope_i18n_compile_mo_files=True

To restrict the allowed languages set ``zope_i18n_allowed_languages`` to a list
of languages. Example::

    zope_i18n_allowed_languages=de,en,es,fr


Detailed Documentation
----------------------

===================================================
Internationalization (I18n) and Localization (L10n)
===================================================

This document assumes that you have a Zope 3 checkout and the gettext
utilities installed.


Creating/Updating Message Catalog Template (POT) Files
------------------------------------------------------

Whenever you've made a change to Zope that affects the i18n messages,
you need to re-extract i18n messages from the code.  To do that,
execute ``i18nextract.py`` from the ``utilities`` directory of your
Zope 3 checkout:

  $ python utilities/i18nextract.py -d zope -p src/zope -o app/locales

This will update the ``zope.pot`` file.  Make sure that the checkout's
``src`` directory is part of your ``PYTHONPATH`` environment variable.

After that, you need to merge those changes to all existing
translations.  You can do that by executing the ``i18nmergeall.py``
script from the ``utilities`` directory of your Zope 3 checkout:

  $ python utilities/i18nmergeall.py -l src/zope/app/locales


Translating
-----------

To translate messages you need to do the following steps:

1. If a translation for your language is already present and you just
   want to update, skip ahead to step 2.  If you want to start
   translation on a new language, you need to

   a) create a directory

        src/zope/app/locales/<lang_code>/LC_MESSAGES

      with the appropriate code for your language as <lang_code>.
      Note that the two letters specifying the language should always
      be lower case (e.g. 'pt'); if you additionally specify a region,
      those letters should be upper case (e.g. 'pt_BR').

   b) copy the ``zope.pot`` template file to
      ``<lang_code>/LC_MESSAGES/zope.po``.

   c) edit the PO header of the newly created ``zope.po`` file and
      fill in all the necessary information.

2. Translate messages within the PO file.  Make sure the gettext
   syntax stays intact.  Tools like poEdit and KBabel can help you.

3. Finally, when you're done translating, compile the PO file to its
   binary equivalent using the ``msgfmt`` tool:

   $ cd <lang_code>/LC_MESSAGES
   $ msgfmt -o zope.mo zope.po


=======
CHANGES
=======

5.1 (2025-08-08)
----------------

- Add support for Python 3.12, 3.13.

- Drop support for Python 3.7, 3.8.

- Fix one pt_BR translation.
  (`#21 <https://github.com/zopefoundation/zope.app.locales/pull/21>`_)


5.0 (2023-08-28)
----------------

- Add support for Python 3.11.

- Drop support for Python 2.7, 3.5, 3.6.


4.3 (2022-09-12)
----------------

- Remove ``*.mo`` files from the repository and document in the README how to
  generate them on the fly.
  (`#7 <https://github.com/zopefoundation/zope.app.locales/issues/7>`_)

- Automatically create ``*.mo`` files during the release process so this
  release will again contain ``*.mo`` files.

4.2 (2022-06-10)
----------------

- Add support for Python 3.9, 3.10.

- Make path in ZCML extraction relative.

- This release does not contain any ``*.mo`` files.


4.1 (2019-06-24)
----------------

- Flake8 the code.

- Add support for Python 3.7, 3.8b1 and PyPy3.

- Port usage of custom POT file header template here from `z3c.recipe.i18n`.
  (`#11 <https://github.com/zopefoundation/zope.app.locales/pull/11>`_)

- Prevent POT files from collecting duplicate location specifiers over time.
  (`#12 <https://github.com/zopefoundation/zope.app.locales/pull/12>`_)


4.0.1 (2018-06-29)
------------------

- Recompile the `*.mo` translation files.


4.0.0 (2017-05-02)
------------------

- Add support for Python 3.5 and 3.6 and PyPy.


3.7.5 (2016-03-28)
------------------

- Add a test for the zcml_extraction.

- Remove zope.app.applicationcontrol and zope.app.appsetup dependencies.

- Add list of supported Python versions to Trove classifiers.


3.7.4 (2012-05-14)
------------------

- In version 3.7.2 msgids and default values were forced to be
  ``unicode``. This was too strict because at least the TAL extractor returns
  UTF-8 encoded default values. Fixed this by allowing the default value to
  be a string again.


3.7.3 (2012-01-06)
------------------

- i18nextract bugfix: _("msgid", mapping={...}) does not have a default, just
  like _("msgid").  Previously it would get a ``#. Default: ""`` annotation in
  the .pot file.


3.7.2 (2011-12-12)
------------------

- Handle Unicode msgids and default values.

- Consistent sorting of source filenames for each msgid.  Also sort line
  numbers numerically, not lexicographically.


3.7.1 (2011-12-07)
------------------

- Fix nl translations.

- Updated Brazilian Portuguese translation [erico_andrei]

3.7.0 (2011-03-02)
------------------

- Include zcml dependencies in ``configure.zcml``, require the necessary
  packages via a `zcml` extra, added tests for zcml.

- Using Python's ``doctest`` module instead of depreacted
  ``zope.testing.doctest``.


3.6.2 (2010-07-31)
------------------

- Updated copyright to `Zope Foundation`, even in pot template.

- Updated e-mail address in pot template to current address of zope
  mailing list.

- Added missing test dependency on `zope.i18n`.


3.6.1 (2010-05-17)
------------------

- Updated Dutch and German translations.

3.6.0 (2009-12-28)
------------------

- Added `configure.zcml` which registers the translations in the
  package. So the package contains its configuration. (Till now it was
  done in `zope.app.zcmlfiles`.)

3.5.2 (2009-12-22)
------------------

- Updated tests to handle Unicode correctly.

- Update Japanese Translation (thanks Takeshi Yamamoto).

3.5.1 (2009-01-27)
------------------

* Added missing dependency (zope.tal) for tests.

3.5.0 (2009-01-26)
------------------

* Moved the dependencies of the extract console script into an `extract`
  extras_require to avoid runtime dependencies.

* Fixed bug #227582 (bad size in zh_CN locale)

3.4.5 (2008-07-16)
------------------

* added filePattern parameter for tal_strings to be able to not only parse
  `.pt` files.

* Updated Dutch translation

3.4.4 (2008-03-05)
------------------

* Updated Spanish translation

3.4.3 (2008-02-20)
------------------

* Updated Spanish translation

* Updated Japanese translation

3.4.2 (2008-02-06)
------------------

* Fixed and updated Russian translation. Fixed issue #186628 (Typos and errors
  in russian translation)

3.4.1 (2007-12-12)
------------------

* Fixed and updated the french translation

3.4.0 (2007-10-25)
------------------

* Folded the i18nextract script into ``zope.app.locales.extract`` and
  exposed it as a console script entry point.

3.4.0a1 (2007-04-22)
--------------------

* Initial release as a separate project, corresponds to ``zope.app.locales``
  from Zope 3.4.0a1

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/zope.app.locales/",
    "name": "zope.app.locales",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "zope3 i18n l10n translation gettext",
    "author": "Zope Foundation and Contributors",
    "author_email": "zope-dev@zope.dev",
    "download_url": "https://files.pythonhosted.org/packages/2a/de/b16a59de8a31702a6a98961c0196ec6ad4ac03c2837751ad5041b317c4bc/zope_app_locales-5.1.tar.gz",
    "platform": null,
    "description": "================\nzope.app.locales\n================\n\nThis package provides some facilities for extracting and managing i18n\nmessages that occur in Zope software.  More specifically, i18n\nmessages can occur in Python code, in Page Templates and in ZCML\ndeclarations.  ``zope.app.locales`` provides a utility that can\nextract messages from all three and write them to a standard gettext\ntemplate (``pot`` file).\n\nUsage\n-----\n\nVersion 4.2 does not contain any ``*.mo`` files. They are the compiled\ntranslation files (``*.po``). (Future versions will contain them again.)\n\nTo generate or update ``*.mo`` files on the fly set the following environment\nvariable::\n\n    zope_i18n_compile_mo_files=True\n\nTo restrict the allowed languages set ``zope_i18n_allowed_languages`` to a list\nof languages. Example::\n\n    zope_i18n_allowed_languages=de,en,es,fr\n\n\nDetailed Documentation\n----------------------\n\n===================================================\nInternationalization (I18n) and Localization (L10n)\n===================================================\n\nThis document assumes that you have a Zope 3 checkout and the gettext\nutilities installed.\n\n\nCreating/Updating Message Catalog Template (POT) Files\n------------------------------------------------------\n\nWhenever you've made a change to Zope that affects the i18n messages,\nyou need to re-extract i18n messages from the code.  To do that,\nexecute ``i18nextract.py`` from the ``utilities`` directory of your\nZope 3 checkout:\n\n  $ python utilities/i18nextract.py -d zope -p src/zope -o app/locales\n\nThis will update the ``zope.pot`` file.  Make sure that the checkout's\n``src`` directory is part of your ``PYTHONPATH`` environment variable.\n\nAfter that, you need to merge those changes to all existing\ntranslations.  You can do that by executing the ``i18nmergeall.py``\nscript from the ``utilities`` directory of your Zope 3 checkout:\n\n  $ python utilities/i18nmergeall.py -l src/zope/app/locales\n\n\nTranslating\n-----------\n\nTo translate messages you need to do the following steps:\n\n1. If a translation for your language is already present and you just\n   want to update, skip ahead to step 2.  If you want to start\n   translation on a new language, you need to\n\n   a) create a directory\n\n        src/zope/app/locales/<lang_code>/LC_MESSAGES\n\n      with the appropriate code for your language as <lang_code>.\n      Note that the two letters specifying the language should always\n      be lower case (e.g. 'pt'); if you additionally specify a region,\n      those letters should be upper case (e.g. 'pt_BR').\n\n   b) copy the ``zope.pot`` template file to\n      ``<lang_code>/LC_MESSAGES/zope.po``.\n\n   c) edit the PO header of the newly created ``zope.po`` file and\n      fill in all the necessary information.\n\n2. Translate messages within the PO file.  Make sure the gettext\n   syntax stays intact.  Tools like poEdit and KBabel can help you.\n\n3. Finally, when you're done translating, compile the PO file to its\n   binary equivalent using the ``msgfmt`` tool:\n\n   $ cd <lang_code>/LC_MESSAGES\n   $ msgfmt -o zope.mo zope.po\n\n\n=======\nCHANGES\n=======\n\n5.1 (2025-08-08)\n----------------\n\n- Add support for Python 3.12, 3.13.\n\n- Drop support for Python 3.7, 3.8.\n\n- Fix one pt_BR translation.\n  (`#21 <https://github.com/zopefoundation/zope.app.locales/pull/21>`_)\n\n\n5.0 (2023-08-28)\n----------------\n\n- Add support for Python 3.11.\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n4.3 (2022-09-12)\n----------------\n\n- Remove ``*.mo`` files from the repository and document in the README how to\n  generate them on the fly.\n  (`#7 <https://github.com/zopefoundation/zope.app.locales/issues/7>`_)\n\n- Automatically create ``*.mo`` files during the release process so this\n  release will again contain ``*.mo`` files.\n\n4.2 (2022-06-10)\n----------------\n\n- Add support for Python 3.9, 3.10.\n\n- Make path in ZCML extraction relative.\n\n- This release does not contain any ``*.mo`` files.\n\n\n4.1 (2019-06-24)\n----------------\n\n- Flake8 the code.\n\n- Add support for Python 3.7, 3.8b1 and PyPy3.\n\n- Port usage of custom POT file header template here from `z3c.recipe.i18n`.\n  (`#11 <https://github.com/zopefoundation/zope.app.locales/pull/11>`_)\n\n- Prevent POT files from collecting duplicate location specifiers over time.\n  (`#12 <https://github.com/zopefoundation/zope.app.locales/pull/12>`_)\n\n\n4.0.1 (2018-06-29)\n------------------\n\n- Recompile the `*.mo` translation files.\n\n\n4.0.0 (2017-05-02)\n------------------\n\n- Add support for Python 3.5 and 3.6 and PyPy.\n\n\n3.7.5 (2016-03-28)\n------------------\n\n- Add a test for the zcml_extraction.\n\n- Remove zope.app.applicationcontrol and zope.app.appsetup dependencies.\n\n- Add list of supported Python versions to Trove classifiers.\n\n\n3.7.4 (2012-05-14)\n------------------\n\n- In version 3.7.2 msgids and default values were forced to be\n  ``unicode``. This was too strict because at least the TAL extractor returns\n  UTF-8 encoded default values. Fixed this by allowing the default value to\n  be a string again.\n\n\n3.7.3 (2012-01-06)\n------------------\n\n- i18nextract bugfix: _(\"msgid\", mapping={...}) does not have a default, just\n  like _(\"msgid\").  Previously it would get a ``#. Default: \"\"`` annotation in\n  the .pot file.\n\n\n3.7.2 (2011-12-12)\n------------------\n\n- Handle Unicode msgids and default values.\n\n- Consistent sorting of source filenames for each msgid.  Also sort line\n  numbers numerically, not lexicographically.\n\n\n3.7.1 (2011-12-07)\n------------------\n\n- Fix nl translations.\n\n- Updated Brazilian Portuguese translation [erico_andrei]\n\n3.7.0 (2011-03-02)\n------------------\n\n- Include zcml dependencies in ``configure.zcml``, require the necessary\n  packages via a `zcml` extra, added tests for zcml.\n\n- Using Python's ``doctest`` module instead of depreacted\n  ``zope.testing.doctest``.\n\n\n3.6.2 (2010-07-31)\n------------------\n\n- Updated copyright to `Zope Foundation`, even in pot template.\n\n- Updated e-mail address in pot template to current address of zope\n  mailing list.\n\n- Added missing test dependency on `zope.i18n`.\n\n\n3.6.1 (2010-05-17)\n------------------\n\n- Updated Dutch and German translations.\n\n3.6.0 (2009-12-28)\n------------------\n\n- Added `configure.zcml` which registers the translations in the\n  package. So the package contains its configuration. (Till now it was\n  done in `zope.app.zcmlfiles`.)\n\n3.5.2 (2009-12-22)\n------------------\n\n- Updated tests to handle Unicode correctly.\n\n- Update Japanese Translation (thanks Takeshi Yamamoto).\n\n3.5.1 (2009-01-27)\n------------------\n\n* Added missing dependency (zope.tal) for tests.\n\n3.5.0 (2009-01-26)\n------------------\n\n* Moved the dependencies of the extract console script into an `extract`\n  extras_require to avoid runtime dependencies.\n\n* Fixed bug #227582 (bad size in zh_CN locale)\n\n3.4.5 (2008-07-16)\n------------------\n\n* added filePattern parameter for tal_strings to be able to not only parse\n  `.pt` files.\n\n* Updated Dutch translation\n\n3.4.4 (2008-03-05)\n------------------\n\n* Updated Spanish translation\n\n3.4.3 (2008-02-20)\n------------------\n\n* Updated Spanish translation\n\n* Updated Japanese translation\n\n3.4.2 (2008-02-06)\n------------------\n\n* Fixed and updated Russian translation. Fixed issue #186628 (Typos and errors\n  in russian translation)\n\n3.4.1 (2007-12-12)\n------------------\n\n* Fixed and updated the french translation\n\n3.4.0 (2007-10-25)\n------------------\n\n* Folded the i18nextract script into ``zope.app.locales.extract`` and\n  exposed it as a console script entry point.\n\n3.4.0a1 (2007-04-22)\n--------------------\n\n* Initial release as a separate project, corresponds to ``zope.app.locales``\n  from Zope 3.4.0a1\n",
    "bugtrack_url": null,
    "license": "ZPL-2.1",
    "summary": "Zope locale extraction and management utilities",
    "version": "5.1",
    "project_urls": {
        "Homepage": "https://pypi.org/project/zope.app.locales/"
    },
    "split_keywords": [
        "zope3",
        "i18n",
        "l10n",
        "translation",
        "gettext"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "95c0ce6df1b4ca8deb7cd82164eed050f9d1cd0d3501428a7d6374614d118fb2",
                "md5": "bab4eed053278cb1d494b94f6f60cb59",
                "sha256": "6dc1807335266a7de8ac6b036daaa4e6b8de3532ca3ab4ca418d05d15f9304c8"
            },
            "downloads": -1,
            "filename": "zope_app_locales-5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bab4eed053278cb1d494b94f6f60cb59",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 1188001,
            "upload_time": "2025-08-08T06:32:57",
            "upload_time_iso_8601": "2025-08-08T06:32:57.458693Z",
            "url": "https://files.pythonhosted.org/packages/95/c0/ce6df1b4ca8deb7cd82164eed050f9d1cd0d3501428a7d6374614d118fb2/zope_app_locales-5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2adeb16a59de8a31702a6a98961c0196ec6ad4ac03c2837751ad5041b317c4bc",
                "md5": "69ad08d94f24c819cd498254f30919fc",
                "sha256": "1e99165486659d331836f180593332dd58122a0a066aa9af929995e7ece271f0"
            },
            "downloads": -1,
            "filename": "zope_app_locales-5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "69ad08d94f24c819cd498254f30919fc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1170072,
            "upload_time": "2025-08-08T06:32:59",
            "upload_time_iso_8601": "2025-08-08T06:32:59.467210Z",
            "url": "https://files.pythonhosted.org/packages/2a/de/b16a59de8a31702a6a98961c0196ec6ad4ac03c2837751ad5041b317c4bc/zope_app_locales-5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-08 06:32:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "zope.app.locales"
}
        
Elapsed time: 1.83661s