Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 383f9a7

Browse files
committed
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.
1 parent ec1f6f5 commit 383f9a7

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
@@ -104,7 +104,7 @@ class ImplementationDetail(Directive):
104104
def run(self):
105105
self.assert_has_content()
106106
pnode = nodes.compound(classes=['impl-detail'])
107-
label = translators['sphinx'].gettext(self.label_text)
107+
label = sphinx_gettext(self.label_text)
108108
content = self.content
109109
add_text = nodes.strong(label, label)
110110
self.state.nested_parse(content, self.content_offset, pnode)
@@ -252,7 +252,7 @@ def run(self):
252252
else:
253253
args = []
254254

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

@@ -431,7 +431,7 @@ def run(self):
431431
else:
432432
label = self._removed_label
433433

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

0 commit comments

Comments
 (0)