Sphinx: Building another locale with a non-captioned toctree produces `None` captions

Created on 17 Dec 2016  路  3Comments  路  Source: sphinx-doc/sphinx

Problem

Rendering the directives in a toctree with internationalization and when not providing a caption option returns None on the translated output.

Procedure to reproduce the problem

  • Given using an index.rst with the following content:
.. toctree::
   :maxdepth: 2
   :numbered:

   1_page
  • And a 1_page.rst with the following content:
Page1
=====

Subtitle
--------

Lorem ipsum
  • When using make html, the resulting html exists:
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="1_page.html">1. Page1</a><ul>
<li class="toctree-l2"><a class="reference internal" href="1_page.html#subtitle">1.1. Subtitle</a></li>
</ul>
</li>
</ul>
</div>

This is the expected behavior, and accurate so far.

Running a localization command to render .po files with string translations:

make -e SPHINXOPTS="-D language='es'" html

Produces the following HTML:

<div class="toctree-wrapper compound">
<p class="caption"><span class="caption-text">None</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="1_page.html">1. Page1</a><ul>
<li class="toctree-l2"><a class="reference internal" href="1_page.html#subtitle">1.1. Subtitle</a></li>
</ul>
</li>
</ul>
</div>

Note the addition of caption class with some text, this is not expected.

If the toctree contains :caption: Contents: or such, then the None is replaced with Contents: or the localized string.

Environment info

  • OS: Mac 10.11.6
  • Python version: 2.7.12
  • Sphinx version: 1.5.1
bug i18n

All 3 comments

Thanks for your reporting. I confirmed by official doc :-( http://www.sphinx-doc.org/ja/stable/contents.html
I'll take a look.

The problem will happen only with Py2.
Fixed.

Wonderful, thanks for your speed on this!

Was this page helpful?
0 / 5 - 0 ratings