Skip to content

Commit

Permalink
Fix i18n: messages in sphinx.directives.other are not translated
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Sep 12, 2021
1 parent fc2ca41 commit 5c4f741
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sphinx/directives/other.py
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -128,17 +128,17 @@ 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()
else:
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))
Expand Down Expand Up @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit 5c4f741

Please sign in to comment.