Add translation progress information (#11509)

Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
This commit is contained in:
Adam Turner
2023-07-24 20:19:31 +01:00
committed by GitHub
parent 0882914d5c
commit 066e0fabc6
13 changed files with 282 additions and 16 deletions

View File

@@ -340,6 +340,23 @@ There is a `sphinx translation page`_ for Sphinx (master) documentation.
Detail is here: https://docs.transifex.com/getting-started-1/translators
Translation progress and statistics
-----------------------------------
.. versionadded:: 7.1.0
During the rendering process,
Sphinx marks each translatable node with a ``translated`` attribute,
indicating if a translation was found for the text in that node.
The :confval:`translation_progress_classes` configuration value
can be used to add a class to each element,
depending on the value of the ``translated`` attribute.
The ``|translation progress|`` substitution can be used to display the
percentage of nodes that have been translated on a per-document basis.
.. rubric:: Footnotes
.. [1] See the `GNU gettext utilities

View File

@@ -1002,6 +1002,21 @@ documentation on :ref:`intl` for details.
.. versionchanged:: 3.2
Added ``{docpath}`` token.
.. confval:: translation_progress_classes
Control which, if any, classes are added to indicate translation progress.
This setting would likely only be used by translators of documentation,
in order to quickly indicate translated and untranslated content.
* ``True``: add ``translated`` and ``untranslated`` classes
to all nodes with translatable content.
* ``translated``: only add the ``translated`` class.
* ``untranslated``: only add the ``untranslated`` class.
* ``False``: do not add any classes to indicate translation progress.
Defaults to ``False``.
.. versionadded:: 7.1
.. _math-options:

View File

@@ -528,3 +528,9 @@ default. They are set in the build configuration file.
Replaced by either today's date (the date on which the document is read), or
the date set in the build configuration file. Normally has the format
``April 14, 2007``. Set by :confval:`today_fmt` and :confval:`today`.
.. describe:: |translation progress|
Replaced by the translation progress of the document.
This substitution is intented for use by document translators
as a marker for the translation progress of the document.