Commit Graph
6 Commits
Author SHA1 Message Date
Jean Abou-SamraandAdam Turner b7345ad066 Split up logic in `sphinx.transforms.i18n.Locale.apply` (#11166)
Before, the apply method was one big 400-line chunk. This just splits it
up into more manageable chunks by introducing a ``_NodeUpdater`` auxiliary
class holding logic for updating various types of references.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-03-15 22:52:18 +00:00
Jean Abou-Samra 216a0c849e Get docname from env in `sphinx.transforms.i18n` (#11160) 2023-03-05 19:19:31 +00:00
Jean Abou-Samra ecfd08d325 Skip sphinx.locale.init_console when running tests (#11159)
Tests for Sphinx's CLIs, like test_apidoc, indirectly init_console to
initialize translations for Sphinx's console domain, the one with
Sphinx's log messages. This bleeds over subsequent tests by making
warnings translated. Fix this by skipping init_console when running
Sphinx's test suite.
2023-01-31 22:10:48 +00:00
Jean Abou Samra 94d78d8747 Close #3985: Implement #noqa for i18n
When cross-references in the original paragraph and the translated
paragraph do not match, a warning is emitted.  It is useful, because
it allows to catch mistakes, but it can also be an annoyance since
sometimes it is expected that the cross-references will not match.
For example, a reference that is repeated in the original text may
need to be factored out for good style in the target language.
Another example: if the translator needs to translate a universally
understood term in the source language into a term that not everyone
knows is the translation of this original term, adding a reference to
the glossary can be warranted.  This allows the translated message to
start with '#noqa' in order to disable the warning.
2022-02-15 19:51:06 +01:00
Jean Abou Samra dfcb5d2f4c Categorize warnings for inconsistent references in i18n
This allows suppressing them using the suppress_warnings configuration
variable.
2022-02-15 14:32:22 +01:00
Jean Abou Samra 0269bec1ed In translated docs, sort glossaries by translated terms
This is done by moving the sorting from the glossary directive to a
transform operating after the i18n transform.

Closes #9827
2022-01-12 16:47:40 +01:00