8000 gh-98366: use sphinx.locale._ as gettext() in pyspecific.py (GH-98437) · python/cpython@edd92a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit edd92a1

Browse files
gh-98366: use sphinx.locale._ as gettext() in pyspecific.py (GH-98437)
fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py [why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue. (cherry picked from commit d26ee8a) Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
1 parent 17f1c0a commit edd92a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/tools/extensions/pyspecific.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from sphinx.errors import NoUri
2727
except ImportError:
2828
from sphinx.environment import NoUri
29-
from sphinx.locale import translators
29+
from sphinx.locale import _ as sphinx_gettext
3030
from sphinx.util import status_iterator, logging
3131
from sphinx.util.nodes import split_explicit_title
3232
from sphinx.writers.text import TextWriter, TextTranslator
@@ -109,7 +109,7 @@ class ImplementationDetail(Directive):
109109
def run(self):
110110
self.assert_has_content()
111111
pnode = nodes.compound(classes=['impl-detail'])
112-
label = translators['sphinx'].gettext(self.label_text)
112+
label = sphinx_gettext(self.label_text)
113113
content = self.content
114114
add_text = nodes.strong(label, label)
115115
self.state.nested_parse(content, self.content_offset, pnode)
@@ -257,7 +257,7 @@ def run(self):
257257
else:
258258
args = []
259259

260-
label = translators['sphinx'].gettext(self._label[min(2, len(args))])
260+
label = sphinx_gettext(self._label[min(2, len(args))])
261261
text = label.format(name="``{}``".format(name),
262262
args=", ".join("``{}``".format(a) for a in args if a))
263263

@@ -436,7 +436,7 @@ def run(self):
436436
else:
437437
label = self._removed_label
438438

439-
label = translators['sphinx'].gettext(label)
439+
label = sphinx_gettext(label)
440440
text = label.format(deprecated=self.arguments[0], removed=self.arguments[1])
441441
if len(self.arguments) == 3:
442442
inodes, messages = self.state.inline_text(self.arguments[2],

0 commit comments

Comments
 (0)
0