Skip to content

Commit 280b975

Browse files
Add gettext support to tools/extensions/c_annotations.py (GH-101989)
(cherry picked from commit d959bcd) Co-authored-by: Rémi Lapeyre <[email protected]>
1 parent 58de2eb commit 280b975

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Doc/tools/extensions/c_annotations.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from docutils.parsers.rst import directives
2525
from docutils.parsers.rst import Directive
2626
from docutils.statemachine import StringList
27+
from sphinx.locale import _ as sphinx_gettext
2728
import csv
2829

2930
from sphinx import addnodes
@@ -152,11 +153,11 @@ def add_annotations(self, app, doctree):
152153
elif not entry.result_type.endswith("Object*"):
153154
continue
154155
if entry.result_refs is None:
155-
rc = 'Return value: Always NULL.'
156+
rc = sphinx_gettext('Return value: Always NULL.')
156157
elif entry.result_refs:
157-
rc = 'Return value: New reference.'
158+
rc = sphinx_gettext('Return value: New reference.')
158159
else:
159-
rc = 'Return value: Borrowed reference.'
160+
rc = sphinx_gettext('Return value: Borrowed reference.')
160161
node.insert(0, nodes.emphasis(rc, rc, classes=['refcount']))
161162

162163

Doc/tools/templates/dummy.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
{% trans %}Deprecated since version {deprecated}, will be removed in version {removed}{% endtrans %}
88
{% trans %}Deprecated since version {deprecated}, removed in version {removed}{% endtrans %}
99

10+
In extensions/c_annotations.py:
11+
12+
{% trans %}Return value: Always NULL.{% endtrans %}
13+
{% trans %}Return value: New reference.{% endtrans %}
14+
{% trans %}Return value: Borrowed reference.{% endtrans %}
1015

1116
In docsbuild-scripts, when rewriting indexsidebar.html with actual versions:
1217

0 commit comments

Comments
 (0)