summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-08-06 14:17:45 (GMT)
committerGitHub <noreply@github.com>2023-08-06 14:17:45 (GMT)
commit6b02734af7849fd4da6215d7b4f8df2010e240bf (patch)
tree7af92ebdb814ad815f27c68adb9f970441d20c21
parentc80112906a406d2eecf63729caad129c3f920f87 (diff)
downloadcpython-6b02734af7849fd4da6215d7b4f8df2010e240bf.zip
cpython-6b02734af7849fd4da6215d7b4f8df2010e240bf.tar.gz
cpython-6b02734af7849fd4da6215d7b4f8df2010e240bf.tar.bz2
[3.12] GH-84435: Make pyspecific directives translatable (GH-19470) (#107681)
GH-84435: Make pyspecific directives translatable (GH-19470) (cherry picked from commit ecb05e0b9842ba03b42b4dec8767b1c18a4e28b3) Co-authored-by: cocoatomo <cocoatomo77@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
-rw-r--r--Doc/tools/extensions/pyspecific.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index 5ae7420..c286bcf 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -98,14 +98,13 @@ class ImplementationDetail(Directive):
final_argument_whitespace = True
# This text is copied to templates/dummy.html
- label_text = 'CPython implementation detail:'
+ label_text = sphinx_gettext('CPython implementation detail:')
def run(self):
self.assert_has_content()
pnode = nodes.compound(classes=['impl-detail'])
- label = sphinx_gettext(self.label_text)
content = self.content
- add_text = nodes.strong(label, label)
+ add_text = nodes.strong(self.label_text, self.label_text)
self.state.nested_parse(content, self.content_offset, pnode)
content = nodes.inline(pnode[0].rawsource, translatable=True)
content.source = pnode[0].source
@@ -234,9 +233,9 @@ class AuditEvent(Directive):
final_argument_whitespace = True
_label = [
- "Raises an :ref:`auditing event <auditing>` {name} with no arguments.",
- "Raises an :ref:`auditing event <auditing>` {name} with argument {args}.",
- "Raises an :ref:`auditing event <auditing>` {name} with arguments {args}.",
+ sphinx_gettext("Raises an :ref:`auditing event <auditing>` {name} with no arguments."),
+ sphinx_gettext("Raises an :ref:`auditing event <auditing>` {name} with argument {args}."),
+ sphinx_gettext("Raises an :ref:`auditing event <auditing>` {name} with arguments {args}."),
]
@property
@@ -252,7 +251,7 @@ class AuditEvent(Directive):
else:
args = []
- label = sphinx_gettext(self._label[min(2, len(args))])
+ label = self._label[min(2, len(args))]
text = label.format(name="``{}``".format(name),
args=", ".join("``{}``".format(a) for a in args if a))
@@ -414,8 +413,8 @@ class DeprecatedRemoved(Directive):
final_argument_whitespace = True
option_spec = {}
- _deprecated_label = 'Deprecated since version {deprecated}, will be removed in version {removed}'
- _removed_label = 'Deprecated since version {deprecated}, removed in version {removed}'
+ _deprecated_label = sphinx_gettext('Deprecated since version {deprecated}, will be removed in version {removed}')
+ _removed_label = sphinx_gettext('Deprecated since version {deprecated}, removed in version {removed}')
def run(self):
node = addnodes.versionmodified()
@@ -431,7 +430,6 @@ class DeprecatedRemoved(Directive):
else:
label = self._removed_label
- label = sphinx_gettext(label)
text = label.format(deprecated=self.arguments[0], removed=self.arguments[1])
if len(self.arguments) == 3:
inodes, messages = self.state.inline_text(self.arguments[2],