sphinx-doc/sphinx

gettext_additional_targets not identifying custom directive

Open

#11 956 ouverte le 6 févr. 2024

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)Python (1 985 forks)batch import
help wantedtype:proposal

Métriques du dépôt

Stars
 (5 625 stars)
Métriques de merge PR
 (Merge moyen 13j 10h) (8 PRs mergées en 30 j)

Description

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

Guide contributeur