From 5c4f741fffa0d698e82d31b3dd76c34982d313b5 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 12 Sep 2021 18:58:16 +0900 Subject: [PATCH] Fix i18n: messages in sphinx.directives.other are not translated --- sphinx/directives/other.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index 78890b14c9a..f04526f939c 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -18,7 +18,7 @@ from sphinx import addnodes from sphinx.domains.changeset import VersionChange # NOQA # for compatibility -from sphinx.locale import _ +from sphinx.locale import _, __ from sphinx.util import docname_join, logging, url_re from sphinx.util.docutils import SphinxDirective from sphinx.util.matching import Matcher, patfilter @@ -107,7 +107,7 @@ def parse_content(self, toctree: addnodes.toctree) -> List[Node]: toctree['entries'].append((None, docname)) toctree['includefiles'].append(docname) if not docnames: - logger.warning('toctree glob pattern %r didn\'t match any documents', + logger.warning(__('toctree glob pattern %r didn\'t match any documents'), entry, location=toctree) else: if explicit: @@ -128,9 +128,9 @@ def parse_content(self, toctree: addnodes.toctree) -> List[Node]: toctree['entries'].append((title, ref)) elif docname not in self.env.found_docs: if excluded(self.env.doc2path(docname, None)): - message = 'toctree contains reference to excluded document %r' + message = __('toctree contains reference to excluded document %r') else: - message = 'toctree contains reference to nonexisting document %r' + message = __('toctree contains reference to nonexisting document %r') logger.warning(message, docname, location=toctree) self.env.note_reread() @@ -138,7 +138,7 @@ def parse_content(self, toctree: addnodes.toctree) -> List[Node]: if docname in all_docnames: all_docnames.remove(docname) else: - logger.warning('duplicated entry found in toctree: %s', docname, + logger.warning(__('duplicated entry found in toctree: %s'), docname, location=toctree) toctree['entries'].append((title, docname)) @@ -248,7 +248,7 @@ def run(self) -> List[Node]: self.state.nested_parse(self.content, self.content_offset, node) if len(node.children) != 1 or not isinstance(node.children[0], nodes.bullet_list): - logger.warning('.. acks content is not a list', + logger.warning(__('.. acks content is not a list'), location=(self.env.docname, self.lineno)) return [] return [node] @@ -273,7 +273,7 @@ def run(self) -> List[Node]: self.state.nested_parse(self.content, self.content_offset, node) if len(node.children) != 1 or not isinstance(node.children[0], nodes.bullet_list): - logger.warning('.. hlist content is not a list', + logger.warning(__('.. hlist content is not a list'), location=(self.env.docname, self.lineno)) return [] fulllist = node.children[0]