diff --git a/sphinx/builders/intl.py b/sphinx/builders/intl.py index de147c821..41943b9be 100644 --- a/sphinx/builders/intl.py +++ b/sphinx/builders/intl.py @@ -13,8 +13,6 @@ import collections from datetime import datetime from os import path -from docutils import nodes - from sphinx.builders import Builder from sphinx.util.nodes import extract_messages from sphinx.util.osutil import SEP diff --git a/sphinx/environment.py b/sphinx/environment.py index 6339675b5..f5d77a1e6 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -184,6 +184,7 @@ class CitationReferences(Transform): refnode += nodes.Text('[' + cittext + ']') citnode.parent.replace(citnode, refnode) + class Locale(Transform): """ Replace translatable nodes with their translated doctree. @@ -207,10 +208,11 @@ class Locale(Transform): parser = RSTParser() for node, msg in extract_messages(self.document): - ctx = node.parent + # XXX ctx not used + #ctx = node.parent patch = new_document(source, settings) msgstr = catalog.ugettext(msg) - #XXX add marker to untranslated parts + # XXX add marker to untranslated parts if not msgstr or msgstr == msg: # as-of-yet untranslated continue parser.parse(msgstr, patch) @@ -221,7 +223,6 @@ class Locale(Transform): node.children = patch.children - class SphinxStandaloneReader(standalone.Reader): """ Add our own transforms. @@ -792,7 +793,6 @@ class BuildEnvironment: if node['level'] < filterlevel: node.parent.remove(node) - def process_dependencies(self, docname, doctree): """ Process docutils-generated dependency info. diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index 682fdc6f0..472fbed61 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -191,9 +191,9 @@ else: def init(locale_dirs, language, catalog='sphinx'): """ Look for message catalogs in `locale_dirs` and *ensure* that there is at - least a NullTranslations catalog set in `translators`. If called multiple - times or several ``.mo`` files are found their contents are merged - together (thus making `init` reentrable). + least a NullTranslations catalog set in `translators`. If called multiple + times or if several ``.mo`` files are found, their contents are merged + together (thus making ``init`` reentrable). """ global translators translator = translators.get(catalog) diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index c2f96f078..9ecf0d4ab 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -28,6 +28,7 @@ def extract_messages(doctree): if isinstance(node, (nodes.Invisible, nodes.Inline)): continue # orphan + # XXX ignore all metadata (== docinfo) if isinstance(node, nodes.field_name) and node.children[0] == 'orphan': continue msg = node.rawsource.replace('\n', ' ').strip()