Add gettext support to tools/extensions/c_annotations.py (GH-101989)

(cherry picked from commit d959bcd4a0)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
This commit is contained in:
Miss Islington (bot) 2023-03-06 13:53:47 -08:00 committed by GitHub
parent 58de2eb26b
commit 280b975c3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -24,6 +24,7 @@
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 @@ def add_annotations(self, app, doctree):
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']))