Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captions missing in translations for hidden TOCs #6178

Closed
wjsi opened this issue Mar 15, 2019 · 1 comment
Closed

Captions missing in translations for hidden TOCs #6178

wjsi opened this issue Mar 15, 2019 · 1 comment

Comments

@wjsi
Copy link

wjsi commented Mar 15, 2019

Describe the bug
#2880 adds captions of toctrees into translations and it works well for visible toctrees. However, when toctrees are hidden, captions can still be seen in templates like sphinx_rtd_theme, however, no texts are added to po files and thus we cannot translate those captions.

To Reproduce
The index.rst is

.. test_toc documentation master file, created by
   sphinx-quickstart on Fri Mar 15 13:44:35 2019.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to test_toc's documentation!
====================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:
   :hidden:

   content



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

After executing make gettext, the corresponding pot file is generated:

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2019, Wenjun Si
# This file is distributed under the same license as the test_toc package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: test_toc \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-15 13:46+0800\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"

#: ../../source/index.rst:7
msgid "Welcome to test_toc's documentation!"
msgstr ""

#: ../../source/index.rst:19
msgid "Indices and tables"
msgstr ""

#: ../../source/index.rst:21
msgid ":ref:`genindex`"
msgstr ""

#: ../../source/index.rst:22
msgid ":ref:`modindex`"
msgstr ""

#: ../../source/index.rst:23
msgid ":ref:`search`"
msgstr ""

which does not include the string Contents:. However, the generated HTML page does include this string in navigation div, and it cannot be translated:

image

Environment info

  • OS: MacOS
  • Python version: 3.7.2 (Miniconda)
  • Sphinx version: 1.8.5

Additional context

I dive into the code of sphinx and discover that I18nBuilder ignores hidden tocs when writing pots. I will submit a PR to solve this.

@wjsi wjsi added the type:bug label Mar 15, 2019
@wjsi wjsi changed the title <what happen when you do on which document project> Captions missing in translations for hidden TOCs Mar 15, 2019
tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 17, 2019
tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 17, 2019
@tk0miya tk0miya added this to the 2.0.0 milestone Mar 17, 2019
tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 17, 2019
tk0miya added a commit that referenced this issue Mar 18, 2019
Fix #6178: i18n: Captions missing in translations for hidden TOCs
@tk0miya
Copy link
Member

tk0miya commented Mar 18, 2019

Fixed by #6184. Thank you for your contribution!

@tk0miya tk0miya closed this as completed Mar 18, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants