You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Through trial and error, I was able to figure out, that sphinx-intl can cope with mermaid graphs, if you include them as files and then use the same naming convention as for figure translations. I.e. you include the mermaid-graph as file, then translate it and save it to a new file, following the naming convention. In that case, the rightly translated graph will be picked up.
In the Sphinx options for internationalization, you can set the figure_language_filename to enable internationalization for figures. By default, this is {root}.{language}{ext}.
Let me give you an example:
First, in the base.rst file of the original language, you include your mermaid graph. The graph is stored in a separate file called mermaid.mmd
After this paragraph follows a mermaid graph:
.. mermaid:: mermaid.mmd:align: center
In the mermaid.mmd file, you have your mermaid graph, i.e.:
In a separate file, you store your translated mermaid graph with the right language specifier. Suppose, we want to translate our mermaid graph to german, we'd save it in a separate file named mermaid.de.mmd like so.
flowchart TD
S(((Anfang)))
T[Ende]
S--bis-->T
Now, in the file structure, you put them side by side in the same directory, i.e.
./
+ base.rst
+ mermaid.mmd
+ mermaid.de.mmd
With this structure, sphinx-intl will pick up the rightly translated mermaid graph for internationalization in your documentation.
However, there are some culprits: In particular, if you are using captions, these are not being caught, when running sphinx-build -M gettext. In other words, the following will show show the english caption in all of your translations and I reckon, that this is part of sphinxcontrib-mermaid.
.. mermaid:: mermaid.mmd:align: center
:caption: What a beautiful mermaid graph!
Hey,
it would be great if
sphinx-mermaid
would have internationalization support so that you can render diagrams in several languages.The text was updated successfully, but these errors were encountered: