diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-03-06 21:53:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-06 21:53:47 (GMT) |
commit | 280b975c3f18674eca1dfbed33fc13330535b241 (patch) | |
tree | 28ce80ecdca73426cdc97e7f83c9cc451e3e3dc3 | |
parent | 58de2eb26bb53d6447741de5f232940ec1555115 (diff) | |
download | cpython-280b975c3f18674eca1dfbed33fc13330535b241.zip cpython-280b975c3f18674eca1dfbed33fc13330535b241.tar.gz cpython-280b975c3f18674eca1dfbed33fc13330535b241.tar.bz2 |
Add gettext support to tools/extensions/c_annotations.py (GH-101989)
(cherry picked from commit d959bcd4a0393a120fa12c034de4041037d171c3)
Co-authored-by: RĂ©mi Lapeyre <remi.lapeyre@lenstra.fr>
-rw-r--r-- | Doc/tools/extensions/c_annotations.py | 7 | ||||
-rw-r--r-- | Doc/tools/templates/dummy.html | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Doc/tools/extensions/c_annotations.py b/Doc/tools/extensions/c_annotations.py index 9defb24..a845ef4 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 @@ -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'])) 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: |