diff options
author | cocoatomo <cocoatomo77@gmail.com> | 2018-02-23 11:47:19 (GMT) |
---|---|---|
committer | INADA Naoki <methane@users.noreply.github.com> | 2018-02-23 11:47:19 (GMT) |
commit | 0febc053736112d7bb9081742b3ac0ece7b973e7 (patch) | |
tree | 02376db764b1d8e3e1860d81006149bfc571b36b /Doc/tools | |
parent | 58a10967619d0281adf346f227c254f1c3b3f32e (diff) | |
download | cpython-0febc053736112d7bb9081742b3ac0ece7b973e7.zip cpython-0febc053736112d7bb9081742b3ac0ece7b973e7.tar.gz cpython-0febc053736112d7bb9081742b3ac0ece7b973e7.tar.bz2 |
bpo-32087: Doc: Make "deprecated-removed" directive translatable (GH-4473)
Diffstat (limited to 'Doc/tools')
-rw-r--r-- | Doc/tools/extensions/pyspecific.py | 12 | ||||
-rw-r--r-- | Doc/tools/templates/dummy.html | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index 00acd4f..47d3823 100644 --- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -196,7 +196,7 @@ class DeprecatedRemoved(Directive): final_argument_whitespace = True option_spec = {} - _label = 'Deprecated since version %s, will be removed in version %s' + _label = 'Deprecated since version {deprecated}, will be removed in version {removed}' def run(self): node = addnodes.versionmodified() @@ -204,11 +204,12 @@ class DeprecatedRemoved(Directive): node['type'] = 'deprecated-removed' version = (self.arguments[0], self.arguments[1]) node['version'] = version - text = self._label % version + label = translators['sphinx'].gettext(self._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], self.lineno+1) - para = nodes.paragraph(self.arguments[2], '', *inodes) + para = nodes.paragraph(self.arguments[2], '', *inodes, translatable=False) node.append(para) else: messages = [] @@ -220,13 +221,14 @@ class DeprecatedRemoved(Directive): content.source = node[0].source content.line = node[0].line content += node[0].children - node[0].replace_self(nodes.paragraph('', '', content)) + node[0].replace_self(nodes.paragraph('', '', content, translatable=False)) node[0].insert(0, nodes.inline('', '%s: ' % text, classes=['versionmodified'])) else: para = nodes.paragraph('', '', nodes.inline('', '%s.' % text, - classes=['versionmodified'])) + classes=['versionmodified']), + translatable=False) node.append(para) env = self.state.document.settings.env env.note_versionchange('deprecated', version[0], node, self.lineno) diff --git a/Doc/tools/templates/dummy.html b/Doc/tools/templates/dummy.html index 6e43be2..8d94137 100644 --- a/Doc/tools/templates/dummy.html +++ b/Doc/tools/templates/dummy.html @@ -4,3 +4,4 @@ texts in extensions to sphinx.pot file. In extensions/pyspecific.py: {% trans %}CPython implementation detail:{% endtrans %} +{% trans %}Deprecated since version {deprecated}, will be removed in version {removed}{% endtrans %} |