Multiple translations in a single reStructuredtext file
Asked Answered
M

1

6

Is there a way to achieve the following?

  • Source is a single .rst file where the translation in multiple languages coexist
  • Generate web page renditions per language (in .html files preferably).
    • This can be either a single file where readers can switch between languages, or multiple separate .html files
  • Preferably web page generation can be done by rst2html but other common tools are welcomed as well

Usecase I have in mind. In foo.rst (I don't mean I want exactly tags like these):

..lang_en:

  She likes spinach the best.

..lang_de:

  Sie mag am besten Spinat.

Result would be, as I mentioned, either a single foo.html, or a set of foo_en.html and foo_de.html.

Matthew answered 2/4, 2014 at 22:14 Comment(1)
funny I am looking into exact the same thing. I looked into pelican but it can not handle translations in one file out of the box. Looks like I have to write a plugin for this. Currently I am looking into docutils and I believe I can use its Node-Interface to implement this. Please let me know if you found a solution already.Beeck
M
2

I figured out by using sphinx-intl; it creates folders per language, and update the translations based on the change in the master file take a few steps (which requires careful operation), but I'm satisfied.

If you need a concrete example, in this project holds I'm maintaining English and Japanese renditions.

Matthew answered 8/7, 2014 at 6:55 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.