mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6184 from tk0miya/6178_hidden_tocs
Fix #6178: i18n: Captions missing in translations for hidden TOCs
This commit is contained in:
commit
0af3012cb8
1
CHANGES
1
CHANGES
@ -35,6 +35,7 @@ Bugs fixed
|
|||||||
* #6172: AttributeError is raised for old styled index nodes
|
* #6172: AttributeError is raised for old styled index nodes
|
||||||
* #4872: inheritance_diagram: correctly describe behavior of ``parts`` option in
|
* #4872: inheritance_diagram: correctly describe behavior of ``parts`` option in
|
||||||
docs, allow negative values.
|
docs, allow negative values.
|
||||||
|
* #6178: i18n: Captions missing in translations for hidden TOCs
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -16,6 +16,7 @@ from os import path, walk, getenv
|
|||||||
from time import time
|
from time import time
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
from sphinx import addnodes
|
||||||
from sphinx.builders import Builder
|
from sphinx.builders import Builder
|
||||||
from sphinx.domains.python import pairindextypes
|
from sphinx.domains.python import pairindextypes
|
||||||
from sphinx.errors import ThemeError
|
from sphinx.errors import ThemeError
|
||||||
@ -142,6 +143,11 @@ class I18nBuilder(Builder):
|
|||||||
# type: (str, nodes.document) -> None
|
# type: (str, nodes.document) -> None
|
||||||
catalog = self.catalogs[find_catalog(docname, self.config.gettext_compact)]
|
catalog = self.catalogs[find_catalog(docname, self.config.gettext_compact)]
|
||||||
|
|
||||||
|
for toctree in self.env.tocs[docname].traverse(addnodes.toctree):
|
||||||
|
for node, msg in extract_messages(toctree):
|
||||||
|
node.uid = '' # type: ignore # Hack UUID model
|
||||||
|
catalog.add(msg, node)
|
||||||
|
|
||||||
for node, msg in extract_messages(doctree):
|
for node, msg in extract_messages(doctree):
|
||||||
catalog.add(msg, node)
|
catalog.add(msg, node)
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ msgstr ""
|
|||||||
msgid "Table of Contents"
|
msgid "Table of Contents"
|
||||||
msgstr "TABLE OF CONTENTS"
|
msgstr "TABLE OF CONTENTS"
|
||||||
|
|
||||||
|
msgid "Hidden Toc"
|
||||||
|
msgstr "HIDDEN TOC"
|
||||||
|
|
||||||
msgid "testdata for i18n"
|
msgid "testdata for i18n"
|
||||||
msgstr "TESTDATA FOR I18N"
|
msgstr "TESTDATA FOR I18N"
|
||||||
|
|
||||||
|
@ -30,3 +30,10 @@ CONTENTS
|
|||||||
refs
|
refs
|
||||||
section
|
section
|
||||||
topic
|
topic
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
:caption: Hidden Toc
|
||||||
|
:hidden:
|
||||||
|
|
||||||
|
only
|
||||||
|
@ -617,6 +617,8 @@ def test_html_meta(app):
|
|||||||
assert expected_expr in result
|
assert expected_expr in result
|
||||||
expected_expr = '<meta content="I18N, SPHINX, MARKUP" name="keywords" />'
|
expected_expr = '<meta content="I18N, SPHINX, MARKUP" name="keywords" />'
|
||||||
assert expected_expr in result
|
assert expected_expr in result
|
||||||
|
expected_expr = '<p class="caption"><span class="caption-text">HIDDEN TOC</span></p>'
|
||||||
|
assert expected_expr in result
|
||||||
|
|
||||||
|
|
||||||
@sphinx_intl
|
@sphinx_intl
|
||||||
|
Loading…
Reference in New Issue
Block a user