summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ©mi Lapeyre <remi.lapeyre@lenstra.fr>2023-03-06 21:20:52 (GMT)
committerGitHub <noreply@github.com>2023-03-06 21:20:52 (GMT)
commitd959bcd4a0393a120fa12c034de4041037d171c3 (patch)
tree15406b26ff1ef4db9ab47bec806f427d5ef6649a
parentf105fe4f0a704bedee21d95f1a08bc14a1fcea2a (diff)
downloadcpython-d959bcd4a0393a120fa12c034de4041037d171c3.zip
cpython-d959bcd4a0393a120fa12c034de4041037d171c3.tar.gz
cpython-d959bcd4a0393a120fa12c034de4041037d171c3.tar.bz2
Add gettext support to tools/extensions/c_annotations.py (#101989)
-rw-r--r--Doc/tools/extensions/c_annotations.py7
-rw-r--r--Doc/tools/templates/dummy.html5
2 files changed, 9 insertions, 3 deletions
diff --git a/Doc/tools/extensions/c_annotations.py b/Doc/tools/extensions/c_annotations.py
index e5dc82c..5af5643 100644
--- a/Doc/tools/extensions/c_annotations.py
+++ b/Doc/tools/extensions/c_annotations.py
@@ -24,6 +24,7 @@ from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst import Directive
from docutils.statemachine import StringList
+from sphinx.locale import _ as sphinx_gettext
import csv
from sphinx import addnodes
@@ -168,11 +169,11 @@ class Annotations:
elif not entry.result_type.endswith("Object*"):
continue
if entry.result_refs is None:
- rc = 'Return value: Always NULL.'
+ rc = sphinx_gettext('Return value: Always NULL.')
elif entry.result_refs:
- rc = 'Return value: New reference.'
+ rc = sphinx_gettext('Return value: New reference.')
else:
- rc = 'Return value: Borrowed reference.'
+ rc = sphinx_gettext('Return value: Borrowed reference.')
node.insert(0, nodes.emphasis(rc, rc, classes=['refcount']))
diff --git a/Doc/tools/templates/dummy.html b/Doc/tools/templates/dummy.html
index 3438b44..bab4aae 100644
--- a/Doc/tools/templates/dummy.html
+++ b/Doc/tools/templates/dummy.html
@@ -7,6 +7,11 @@ In extensions/pyspecific.py:
{% trans %}Deprecated since version {deprecated}, will be removed in version {removed}{% endtrans %}
{% trans %}Deprecated since version {deprecated}, removed in version {removed}{% endtrans %}
+In extensions/c_annotations.py:
+
+{% trans %}Return value: Always NULL.{% endtrans %}
+{% trans %}Return value: New reference.{% endtrans %}
+{% trans %}Return value: Borrowed reference.{% endtrans %}
In docsbuild-scripts, when rewriting indexsidebar.html with actual versions: