Close #4683: i18n: make explicit titles in toctree translatable

This commit is contained in:
Takeshi KOMIYA
2019-11-01 22:00:11 +09:00
parent 8dbb799cb1
commit 5aee836dc1
5 changed files with 87 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
i18n with toctree
=================
.. toctree::
:caption: caption
figure <figure>
table
https://www.sphinx-doc.org/
self

View File

@@ -0,0 +1,31 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C)
# This file is distributed under the same license as the Sphinx intl <Tests> package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Sphinx intl <Tests> 2013.120\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-01 10:24+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../toctree.txt:4
msgid "figure"
msgstr "FIGURE"
#: ../../toctree.txt:4
#: ../../toctree.txt:4
msgid "caption"
msgstr "CAPTION"
#: ../../toctree.txt:2
msgid "i18n with toctree"
msgstr "I18N WITH TOCTREE"

View File

@@ -465,6 +465,30 @@ def test_text_table(app):
assert expect_msg.string in result
@sphinx_intl
@pytest.mark.sphinx('gettext')
@pytest.mark.test_params(shared_result='test_intl_gettext')
def test_gettext_toctree(app):
app.build()
# --- toctree
expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'toctree.po')
actual = read_po(app.outdir / 'toctree.pot')
for expect_msg in [m for m in expect if m.id]:
assert expect_msg.id in [m.id for m in actual if m.id]
@sphinx_intl
@pytest.mark.sphinx('text')
@pytest.mark.test_params(shared_result='test_intl_basic')
def test_text_toctree(app):
app.build()
# --- toctree
result = (app.outdir / 'toctree.txt').text()
expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'toctree.po')
for expect_msg in [m for m in expect if m.id]:
assert expect_msg.string in result
@sphinx_intl
@pytest.mark.sphinx('gettext')
@pytest.mark.test_params(shared_result='test_intl_gettext')