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
121 stars 25 forks source link

Integrate to the bootstrap process of rust-lang/rust #191

Closed dalance closed 1 month ago

dalance commented 2 months ago

The latest Rust by Example has a Japanese translation resource based on mdbook-i18n-helpers. But it is not built because rust-lang/rust has the original mdbook build process which doesn't contain mdbook-i18n-helpers.

In my investigation, I found that the following changes are required to build it.

error: hidden lifetime parameters in types are deprecated
  --> /home/hatta/work/repos/mdbook-i18n-helpers/i18n-helpers/src/lib.rs:95:34
   |
95 |     fn expand_shortcut_link(tag: Tag) -> Tag {
   |                                  ^^^ expected lifetime parameter
   |
   = note: `-D elided-lifetimes-in-paths` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(elided_lifetimes_in_paths)]`
help: indicate the anonymous lifetime
   |
95 |     fn expand_shortcut_link(tag: Tag<'_>) -> Tag {
   |                                     ++++

I opened https://github.com/rust-lang/rust/pull/124731. It refers my forked mdbook-i18n-helpers https://github.com/dalance/mdbook-i18n-helpers/tree/export_preprocessor now.

How about the above changes?

mgeisler commented 2 months ago

Hi @dalance,

Thanks for the descriptive issue!

  • Export Preprocessor struct for gettext The bootstrap process of rust-lang/rust uses the original rustbook binary to build docs. It uses mdbook crate as a library and the normal mdbook plugin system is not used. So exporting Preprocessor struct which can be integrated to rustbook at compile time is required.

So far, we have not paid much attention to the library interface of mdbook-i18n-helpers, but I'm not against making it usable as a library. @kdarkhan has been making similar changes to enable us to do fuzz testing against the binaries.