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

gettext doesnt recognize/translate the argument of directive #8857

Open
xSitu opened this issue Feb 9, 2021 · 1 comment
Open

gettext doesnt recognize/translate the argument of directive #8857

xSitu opened this issue Feb 9, 2021 · 1 comment

Comments

@xSitu
Copy link

xSitu commented Feb 9, 2021

Not really sure if its a bug or just an issue in my case.

When using gettext, the argument of a directive is not recognized which has to be translated (in my case).

I am using the sphinx-panels extensions Github , ExampleSite especially to use the dropdowns.

Example:

.. dropdown:: english should be translated to .. dropdown:: german since the argument "english" refers to the dropdown_title

PoEdit ist recognizing the content of the toggle-able container but not the dropdown_title.

I was looking for a workaround and after i saw this post gettext Substitution i tried to use substitutions like this:

.. dropdown:: |SubstitutionTest|

   abc

.. |SubstitutionTest| replace:: German

I was hoping that gettext would recognize "German" in line .. |SubstitutionTest| replace:: German so i could adjust it in PoEdit but it also didnt work.
Is there any way to work around/fix it?

@xSitu xSitu added the type:bug label Feb 9, 2021
@tk0miya
Copy link
Member

tk0miya commented Feb 10, 2021

The i18n feature of Sphinx extracts translation messages from doctrees that are intermediate data on building Sphinx project. In other words, it does not read the source mark-up files directly. To translate it, you need to modify the extension to support translations.

To support translations, please make your node class to a subclass of sphinx.addnodes.translatable class and overrides their methods for translations.
https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/addnodes.py#L51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants