google / mdbook-i18n-helpers

Translation support for mdbook. The plugins here give you a structured way to maintain a translated book.
Apache License 2.0
126 stars 25 forks source link

Support recursing into `{{#include foo}}` directives #126

Closed mgeisler closed 3 months ago

mgeisler commented 9 months ago

Currently, we use mdbook-xgettext as a renderer, e.g., as an output format which sees the Markdown files after all of the preprocessors have run. To match this, we recommend installing the mdbook-gettext preprocessor with

[preprocessor.gettext]
after = ["links"]

This means that the mdbook-gettext preprocessor sees any files included via the built-in links preprocessor, just like the mdbook-xgettext renderer does.

This works well, and with #95 fixed, we even minimize the strings extracted this way. However, we could improve on this a bit by handling the include directives ourselves (hopefully by calling out to the links preprocessor). The advantage of this would be

To implement this, we should instead run mdbook-xgettext as a preprocessor, and run it before the links preprocessor.

This might of course not be worth it, especially as links.rs doesn't seem to expose it's functionality.

mgeisler commented 3 months ago

Having thought a bit more about this, it might not be as easy or important as I first thought.