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:
parent
40a1f1f4f9
commit
775319ae15
|
@ -31,30 +31,22 @@ Django project, a Python project or a ReactJS project.
|
||||||
Python Projects
|
Python Projects
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Update your ``setup.cfg`` file to include support for translation. It
|
For translation of strings in Python files, only a few changes are
|
||||||
should contain the ``compile_catalog``, ``update_catalog``, and
|
needed inside a project.
|
||||||
``extract_messages`` sections as well as a ``packages`` entry in the
|
|
||||||
``files`` section:
|
.. 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
|
.. code-block:: ini
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages = ${MODULENAME}
|
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
|
Replace ``${MODULENAME}`` with the name of your main module like
|
||||||
``nova`` or ``novaclient``. Your i18n setup file, normally named
|
``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}')
|
_translators = oslo_i18n.TranslatorFactory(domain='${MODULENAME}')
|
||||||
|
|
||||||
Create file ``babel.cfg`` with the following content:
|
|
||||||
|
|
||||||
.. code-block:: ini
|
|
||||||
|
|
||||||
[python: **.py]
|
|
||||||
|
|
||||||
|
|
||||||
Django Projects
|
Django Projects
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue