sphinx-doc/sphinx

gettext_additional_targets not identifying custom directive

Open

#11,956 创建于 2024年2月6日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Python (5,625 star) (1,985 fork)batch import
help wantedtype:proposal

描述

Describe the bug

As per the documentation, gettext_additional_targets should allow you to specify additional targets for translation. But, it is not identifying directives like if-builder and panels.

How to Reproduce

I am using sphinx-panels extension: https://pypi.org/project/sphinx-panels/

index.rst:

Documentation
============

.. if-builder:: html

   .. panels::
      :container: container-lg pb-3
      :column: col-lg-4 col-md-4 col-sm-6 col-xs-12 p-2

      This is a test HTML line

conf.py

# -- Localization configuration
locale_dirs = ['locale/']   # path is example but recommended.
gettext_compact = False     # optional
gettext_additional_targets = ['literal-block', 'panels', 'if-builder']

On running the commands below:

make gettext
sphinx-intl update -p build/gettext -l ja

I don't see an entry in index.po for the line "This is a test HTML line"

index.po

#: ../../index.rst:2
msgid "Documentation"
msgstr ""

Expected output:

index.po

#: ../../index.rst:2
msgid "Documentation"
msgstr ""

#: ../../index.rst:5
msgid "This is a test HTML line"
msgstr ""

Environment Information

Platform:              linux; (Linux-5.15.0-92-generic-x86_64-with-glibc2.29)
Python version:        3.8.10 (default, Nov 22 2023, 10:22:35) 
[GCC 9.4.0])
Python implementation: CPython
Sphinx version:        6.2.1
Docutils version:      0.18.1
Jinja2 version:        3.1.2
Pygments version:      2.15.1

Sphinx extensions

extensions = [
    'sphinxcontrib.httpdomain',
    'sphinxcontrib.httpexample',
    'sphinx.ext.doctest',
    'sphinx.ext.autodoc',
    'sphinx.ext.intersphinx',
    'sphinx.ext.autosectionlabel',
    'linuxdoc.rstFlatTable',
    'sphinx_design',
    'sphinx_panels'
]

Additional context

No response

贡献者指南