]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add gettext support to tools/extensions/c_annotations.py (GH-101989)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 6 Mar 2023 21:53:24 +0000 (13:53 -0800)
committerGitHub <noreply@github.com>
Mon, 6 Mar 2023 21:53:24 +0000 (13:53 -0800)
(cherry picked from commit d959bcd4a0393a120fa12c034de4041037d171c3)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
Doc/tools/extensions/c_annotations.py
Doc/tools/templates/dummy.html

index 9defb24a0331ef53cfb980d16c21ffd2d60c1cce..a845ef46c0ba940f0342654a7ed12798579c74cd 100644 (file)
@@ -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
@@ -152,11 +153,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']))
 
 
index 3438b44377fcb96d8bc2e3c7cbc4eec77acf0501..bab4aaeb4604b8f934b09ea4ae9d54e6f3d1bfa3 100644 (file)
@@ -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: