Sphinx's i18n feature needs "node.source" and "node.line" value for translation process.
(see also: https://sourceforge.net/p/docutils/patches/100/)
Sphinx extract translation target message from parsed doctree. Sphinx uses nodes that are instance of nodes.TextElement and have source information as translation target messages:
https://bitbucket.org/birkenfeld/sphinx/src/776565367102/sphinx/util/nodes.py#cl-63
Docutils parses admonition directive as nodes.admonition. nodes.admonition has child node as nodes.title but it doesn't have source/line information.
Could you set source information to term node? I attach a patch to do it.
I applied a simplified patch:
I don't think adding the document to an admonition node is the right thing.
(Provide arguments if/why this is really required.)
Replaced the newline-escaping backslash with parentheses.
The goal is to set the line and source to the nodes.title instance.
admonition_node.__add__(child)
need admonition.document to set source and line to child.If I just order to achieve the object, I set source and line attribute to nodes.title instance directly (new docutils-admonition-title2.patch did).
Last edit: Shimizukawa Takayuki 2013-07-03
The second patch is better.
Alternatively, you can store .source and .line in the admonition node
and let the translator look up node.parent.source/line.
Applied patch version 2. Please check out and test.
It's OK!
I tested with docutils-0.11. Sorry for late reply.