It's impossible. Sphinx will have to understand comments in every language.

If you want to translate comments in code-block (and literal blocks after
::), you must translate them all. Add gettext_additional_targets =
["literal-block"] to your conf.py and re-run POT/PO update.

Matt

On Sun, May 3, 2020 at 2:25 PM Yaroslav Nikitenko <[email protected]> wrote:

> Hello,
>
> I have code examples in the documentation (defined as code-blocks,
> both literally included and just typed inline). In these code examples
> there are comments, but when I produce documentation translation, they
> are not extracted into .po files, and obviously are not translated.
>
> How can I translate these comments in code examples?
>
> I asked this on stackoverflow, there is an example of a code block if
> really needed (
> https://stackoverflow.com/questions/61248191/how-to-translate-comments-in-code-blocks-using-sphinx
> ).
>
> Many thanks.
>
> Best regards,
> Yaroslav Nikitenko
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/CA%2BRLzGAzko4FA2VJ6qHioU-uV%3D4kxisgRYhOPCUapqJX8cZ8ww%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAOGNDW_CwLjTh-LC9mAh5a3M6Cf-QXRkE-7aJKtuu%3D%2B7%2B%3DyMQg%40mail.gmail.com.

Reply via email to