Open sachin-suresh-rapyuta opened 9 months ago
Actually, I'm not sure that it's meant to identify your custom targets. AFAICT, it says:
To specify names to enable gettext extracting and translation
applying for i18n additionally. You can specify below names:
Index:
index terms
Literal-block:
literal blocks (:: annotation and code-block directive)
Doctest-block:
doctest block
Raw:
raw content
Image:
image/figure uri
So I think we only support those names. If you want to add your custom blocks, you can make a PR out of it.
Thanks for the reply. Yes, I am trying to get translation strings for texts under the following directives:
.. if-builder:: html
.. panels::
@picnixz Can you help me with the core file that implements this? So I can try to override by adding my custom direcitves?
Technically, it is TRANSLATABLE_NODES
in sphinx/transforms/__init__.py
which could be extended but then you need to check the whole logic of i18n. I'm not entirely sure that you can just extend this mapping with your custom nodes but maybe you can try. However, you need the if-builder
and panels
directives to produce a node. The additional targets are not only roles/directives but they are nodes. So just adding 'panels' might not work. On the other hand, if those directives wrap their content in a docutils node, then you can add that specific node (this is the case for the 'image' node which is created by the .. image
directive).
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
andpanels
.How to Reproduce
I am using sphinx-panels extension: https://pypi.org/project/sphinx-panels/
index.rst
:conf.py
On running the commands below:
I don't see an entry in
index.po
for the line "This is a test HTML line"index.po
Expected output:
index.po
Environment Information
Sphinx extensions
Additional context
No response