mirror of https://github.com/python/cpython
Add gettext support to tools/extensions/c_annotations.py (#101989)
This commit is contained in:
parent
f105fe4f0a
commit
d959bcd4a0
|
@ -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']))
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Reference in New Issue