8000 [3.11] GH-101986: Support translation for Limited/Unstable API & Stab… · python/cpython@2f26683 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f26683

Browse files
hugovkAA-Turnerezio-melotti
authored
[3.11] GH-101986: Support translation for Limited/Unstable API & Stable ABI (GH-107680) (#112941)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
1 parent 95f5c8c commit 2f26683

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Doc/tools/extensions/c_annotations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,33 @@ def add_annotations(self, app, doctree):
126126
f"Object type mismatch in limited API annotation "
127127
f"for {name}: {record['role']!r} != {objtype!r}")
128128
stable_added = record['added']
129-
message = ' Part of the '
129+
message = sphinx_gettext(' Part of the ')
130130
emph_node = nodes.emphasis(message, message,
131131
classes=['stableabi'])
132132
ref_node = addnodes.pending_xref(
133133
'Stable ABI', refdomain="std", reftarget='stable',
134134
reftype='ref', refexplicit="False")
135135
struct_abi_kind = record['struct_abi_kind']
136136
if struct_abi_kind in {'opaque', 'members'}:
137-
ref_node += nodes.Text('Limited API')
137+
ref_node += nodes.Text(sphinx_gettext('Limited API'))
138138
else:
139-
ref_node += nodes.Text('Stable ABI')
139+
ref_node += nodes.Text(sphinx_gettext('Stable ABI'))
140140
emph_node += ref_node
141141
if struct_abi_kind == 'opaque':
142-
emph_node += nodes.Text(' (as an opaque struct)')
142+
emph_node += nodes.Text(sphinx_gettext(' (as an opaque struct)'))
143143
elif struct_abi_kind == 'full-abi':
144-
emph_node += nodes.Text(' (including all members)')
144+
emph_node += nodes.Text(sphinx_gettext(' (including all members)'))
145145
if record['ifdef_note']:
146146
emph_node += nodes.Text(' ' + record['ifdef_note'])
147147
if stable_added == '3.2':
148148
# Stable ABI was introduced in 3.2.
149149
pass
150150
else:
151-
emph_node += nodes.Text(f' since version {stable_added}')
151+
emph_node += nodes.Text(sphinx_gettext(' since version %s') % stable_added)
152152
emph_node += nodes.Text('.')
153153
if struct_abi_kind == 'members':
154154
emph_node += nodes.Text(
155-
' (Only some members are part of the stable ABI.)')
155+
sphinx_gettext(' (Only some members are part of the stable ABI.)'))
156156
node.insert(0, emph_node)
157157

158158
# Return value annotation

Doc/tools/templates/dummy.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
In extensions/c_annotations.py:
1111

12+
{% trans %} Part of the {% endtrans %}
13+
{% trans %}Limited API{% endtrans %}
14+
{% trans %}Stable ABI{% endtrans %}
15+
{% trans %} (as an opaque struct){% endtrans %}
16+
{% trans %} (including all members){% endtrans %}
17+
{% trans %} since version %s{% endtrans %}
18+
{% trans %} (Only some members are part of the stable ABI.){% endtrans %}
1219
{% trans %}Return value: Always NULL.{% endtrans %}
1320
{% trans %}Return value: New reference.{% endtrans %}
1421
{% trans %}Return value: Borrowed reference.{% endtrans %}

0 commit comments

Comments
 (0)
0