mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7467 from tk0miya/7466_make_autosummary_headings_translatable
Fix #7466: autosummary: headings in generated documents are not translated
This commit is contained in:
commit
503a7c1b22
1
CHANGES
1
CHANGES
@ -21,6 +21,7 @@ Features added
|
||||
:confval:`suppress_warnings`
|
||||
* C, added scope control directives, :rst:dir:`c:namespace`,
|
||||
:rst:dir:`c:namespace-push`, and :rst:dir:`c:namespace-pop`.
|
||||
* #7466: autosummary: headings in generated documents are not translated
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
@ -124,6 +124,11 @@ class AutosummaryRenderer:
|
||||
self.env.filters['e'] = rst.escape
|
||||
self.env.filters['underline'] = _underline
|
||||
|
||||
if builder:
|
||||
if builder.app.translator:
|
||||
self.env.add_extension("jinja2.ext.i18n")
|
||||
self.env.install_gettext_translations(builder.app.translator) # type: ignore
|
||||
|
||||
def exists(self, template_name: str) -> bool:
|
||||
"""Check if template file exists."""
|
||||
try:
|
||||
|
@ -8,7 +8,7 @@
|
||||
.. automethod:: __init__
|
||||
|
||||
{% if methods %}
|
||||
.. rubric:: Methods
|
||||
.. rubric:: {{ _('Methods') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in methods %}
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
{% block attributes %}
|
||||
{% if attributes %}
|
||||
.. rubric:: Attributes
|
||||
.. rubric:: {{ _('Attributes') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in attributes %}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{% block functions %}
|
||||
{% if functions %}
|
||||
.. rubric:: Functions
|
||||
.. rubric:: {{ _('Functions') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in functions %}
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
{% block classes %}
|
||||
{% if classes %}
|
||||
.. rubric:: Classes
|
||||
.. rubric:: {{ _('Classes') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in classes %}
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
{% block exceptions %}
|
||||
{% if exceptions %}
|
||||
.. rubric:: Exceptions
|
||||
.. rubric:: {{ _('Exceptions') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in exceptions %}
|
||||
|
Loading…
Reference in New Issue
Block a user