1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-26 09:30:52 +02:00
comprehensive-rust/book.toml

51 lines
1.3 KiB
TOML
Raw Normal View History

2022-12-21 17:36:30 +02:00
[book]
authors = ["Martin Geisler"]
language = "en"
multilingual = false
src = "src"
title = "Comprehensive Rust 🦀"
[rust]
edition = "2021"
[build]
extra-watch-dirs = ["po", "third_party"]
[preprocessor.gettext]
after = ["links"]
Add support for translations This implements a translation pipeline using the industry-standard Gettext[1] system. I picked Gettext for the reasons described in [2] and [3]: * It’s widely used in open source software. This means that there are graphical editors which will help you in editing the `.po` files. An example is Poedit[4], which is available for all major platforms. There are also many online systems for doing translations. An example is Pontoon[5], which is used for the Rust website itself. We can consider setting up such an instance ourselves. * It is a light-weight yet structured format. This means that nothing changes with regards to how you update the original English text. We can still accept fixes and PRs like normal. The structure means that translators can see exactly which part of the course they need to update after a change. This is completely lost if you simply copy over the original text and translate it in-place in the Markdown files. The code here only adds support for translations. They are not yet tested, published or used for anything. Next steps will be: * Add support for switching languages via a bit of JavaScript on each page. * Update the speaker notes feature to support translations (right now “Speaker Notes” is hard-coded into the generated HTML). I think we should turn it into a mdbook preprocessor instead. * Add testing: We should test that the `.po` files are well-formed. We should also run `mdbook test` on each language since the translations can alter the embedded code. Fixes #115. [1]: https://www.gnu.org/software/gettext/manual/html_node/index.html [2]: https://github.com/rust-lang/mdBook/pull/1864 [3]: https://github.com/rust-lang/mdBook/issues/5#issuecomment-1144887806 [4]: https://poedit.net/ [5]: https://pontoon.rust-lang.org/
2023-01-08 14:45:19 +02:00
2022-12-21 17:36:30 +02:00
[preprocessor.svgbob]
Add support for translations This implements a translation pipeline using the industry-standard Gettext[1] system. I picked Gettext for the reasons described in [2] and [3]: * It’s widely used in open source software. This means that there are graphical editors which will help you in editing the `.po` files. An example is Poedit[4], which is available for all major platforms. There are also many online systems for doing translations. An example is Pontoon[5], which is used for the Rust website itself. We can consider setting up such an instance ourselves. * It is a light-weight yet structured format. This means that nothing changes with regards to how you update the original English text. We can still accept fixes and PRs like normal. The structure means that translators can see exactly which part of the course they need to update after a change. This is completely lost if you simply copy over the original text and translate it in-place in the Markdown files. The code here only adds support for translations. They are not yet tested, published or used for anything. Next steps will be: * Add support for switching languages via a bit of JavaScript on each page. * Update the speaker notes feature to support translations (right now “Speaker Notes” is hard-coded into the generated HTML). I think we should turn it into a mdbook preprocessor instead. * Add testing: We should test that the `.po` files are well-formed. We should also run `mdbook test` on each language since the translations can alter the embedded code. Fixes #115. [1]: https://www.gnu.org/software/gettext/manual/html_node/index.html [2]: https://github.com/rust-lang/mdBook/pull/1864 [3]: https://github.com/rust-lang/mdBook/issues/5#issuecomment-1144887806 [4]: https://poedit.net/ [5]: https://pontoon.rust-lang.org/
2023-01-08 14:45:19 +02:00
renderers = ["html"]
after = ["gettext"]
2022-12-21 17:36:30 +02:00
class = "bob"
# Enable this preprocessor to overlay a large red rectangle on the
# pages. This will show you an estimate of what the course
# participants can see during the presentation.
#
# [preprocessor.aspect-ratio-helper]
# command = "./aspect-ratio-helper.py"
2022-12-21 17:36:30 +02:00
[output.html]
curly-quotes = true
additional-js = ["speaker-notes.js"]
additional-css = ["svgbob.css", "speaker-notes.css", "language-picker.css"]
site-url = "/comprehensive-rust/"
git-repository-url = "https://github.com/google/comprehensive-rust"
edit-url-template = "https://github.com/google/comprehensive-rust/edit/main/{path}"
2022-12-21 17:36:30 +02:00
[output.html.fold]
enable = true
level = 0
[output.html.playground]
editable = true
[output.html.redirect]
"structure.html" = "running-the-course/course-structure.html"
"exercises/day-4/afternoon.html" = "exercises/day-4/android.html"
"unsafe/unsafe-functions.html" = "calling-unsafe-functions.html"
"generics/closures.html" = "traits/closures.html"
"generics/impl-trait.html" = "traits/impl-trait.html"
"generics/trait-bounds.html" = "traits/trait-bounds.html"