Skip to content

Commit 7ef583e

Browse files
StanFromIrelandlysnikolaourffontenellehugovk
authored
Note how to translate python-docs-theme (GH-1650)
Co-authored-by: Lysandros Nikolaou <[email protected]> Co-authored-by: Rafael Fontenelle <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 53d8804 commit 7ef583e

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

documentation/translations/coordinating.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ Translating Sphinx
175175
Some messages that appear in the docs must be translated in the
176176
`Sphinx project <https://www.sphinx-doc.org/en/master/internals/contributing.html#translations>`__
177177
(`sphinx-doc on Transifex <https://app.transifex.com/sphinx-doc/>`__) or in
178-
the `python-docs-theme <https://github.com/python/python-docs-theme>`_
179-
(currently this is not possible; see this
180-
`issue <https://github.com/python/python-docs-theme/issues/194>`__).
178+
the :ref:`Python Docs Sphinx Theme <python-docs-theme-i18n>`.
181179
Coordinators should direct some translators there, so that the documentation
182180
is fully translated.
183181

documentation/translations/translating.rst

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Some general guidelines for deciding on a translation:
209209
Dialects
210210
--------
211211

212-
Some translation receive contributions from people of several different dialects,
212+
Some translations receive contributions from people of several different dialects,
213213
understandably the language will differ. It is recommended however that
214214
translators try to keep files and sections consistent.
215215

@@ -234,14 +234,16 @@ is provided below:
234234
print(kw, ":", keywords[kw])
235235
236236
237+
.. _transifex-use:
238+
237239
Transifex
238240
=========
239241

240242
.. important::
241243

242244
There are many translations in the `python-doc organization on Transifex <tx_>`_,
243245
some of which, however, are not used or do not have a coordination team.
244-
Confirm this is not the case before you begin translating.
246+
Confirm that a coordination team exists before you begin translating.
245247

246248
Several language projects use Transifex as their translation interface.
247249
Translations on Transifex are carried out via a web interface, similar to Weblate.
@@ -258,6 +260,9 @@ through the following resources from the Transifex documentation:
258260
- `Starting with the basics <https://help.transifex.com/en/collections/3441044-starting-with-the-basics>`__:
259261
A group of documents with basic information.
260262

263+
Within the organization, a project for translating the
264+
:github:`Python Docs Sphinx Theme <python/python-docs-theme>` can also be
265+
found.
261266
For further information about Transifex see our `documentation <https://python-docs-transifex-automation.readthedocs.io/>`_.
262267

263268

@@ -287,6 +292,45 @@ be the latest non-alpha branch), the translations should then be propagated by
287292
your languages coordination team.
288293

289294

295+
.. _python-docs-theme-i18n:
296+
297+
How do I translate the Python Docs Sphinx Theme?
298+
------------------------------------------------
299+
300+
The Sphinx theme for the Python documentation supports localization.
301+
302+
You can translate either on
303+
`Transifex <https://explore.transifex.com/python-doc/python-docs-theme/>`_
304+
(see :ref:`translating on Transifex <transifex-use>` for more information)
305+
or locally by following the steps outlined below.
306+
307+
To translate locally, clone the :github:`Python Docs Sphinx Theme repository <python/python-docs-theme>` and run the following
308+
commands to generate the PO files. Replace ``LANG`` with the same language code
309+
that is used for the docs translation:
310+
311+
.. code-block:: bash
312+
313+
python babel_runner.py extract
314+
python babel_runner.py init -l LANG
315+
316+
The file can then be found at:
317+
318+
.. code-block:: text
319+
320+
python-docs-theme/locale/LANG/LC_MESSAGES/python-docs-theme.po
321+
322+
After translating, submit your PO file via a pull request to the
323+
:github:`repository <python/python-docs-theme>`.
324+
See our :ref:`git-boot-camp` for more information about using Git.
325+
326+
To update an existing translation after source changes, run:
327+
328+
.. code-block:: bash
329+
330+
python babel_runner.py update # To update source for all languages
331+
python babel_runner.py update -l LANG # To update source just for LANG
332+
333+
290334
The coordination team for my language is inactive, what do I do?
291335
----------------------------------------------------------------
292336

0 commit comments

Comments
 (0)