Update python project setup instructions

We don't need babel.cfg and instructions in setup.cfg anymore, see
http://lists.openstack.org/pipermail/openstack-discuss/2020-April/014233.html

Update docs for this.

Change-Id: Ibf9fdcddddf616fc9386b44ef33917421804238c
This commit is contained in:
Andreas Jaeger 2020-04-27 18:22:56 +02:00
parent 40a1f1f4f9
commit 775319ae15
1 changed files with 10 additions and 25 deletions

View File

@ -31,30 +31,22 @@ Django project, a Python project or a ReactJS project.
Python Projects
---------------
Update your ``setup.cfg`` file to include support for translation. It
should contain the ``compile_catalog``, ``update_catalog``, and
``extract_messages`` sections as well as a ``packages`` entry in the
``files`` section:
For translation of strings in Python files, only a few changes are
needed inside a project.
.. note::
Previously ``setup.cfg`` needed sections ``compile_catalog``,
``update_catalog``, and ``extract_messages`` and a ``babel.cfg``
file. These are not needed anymore and can be removed.
Update your ``setup.cfg`` file. It should contain a ``packages`` entry
in the ``files`` section:
.. code-block:: ini
[files]
packages = ${MODULENAME}
[compile_catalog]
directory = ${MODULENAME}/locale
domain = ${MODULENAME}
[update_catalog]
domain = ${MODULENAME}
output_dir = ${MODULENAME}/locale
input_file = ${MODULENAME}/locale/${MODULENAME}.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = ${MODULENAME}/locale/${MODULENAME}.pot
Replace ``${MODULENAME}`` with the name of your main module like
``nova`` or ``novaclient``. Your i18n setup file, normally named
@ -64,13 +56,6 @@ Replace ``${MODULENAME}`` with the name of your main module like
_translators = oslo_i18n.TranslatorFactory(domain='${MODULENAME}')
Create file ``babel.cfg`` with the following content:
.. code-block:: ini
[python: **.py]
Django Projects
---------------