1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-15 14:27:50 +02:00
comprehensive-rust/book.toml

95 lines
3.4 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"
[preprocessor.course]
# 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 = ["theme/speaker-notes.js"]
additional-css = [
"theme/css/svgbob.css",
"theme/css/speaker-notes.css",
"theme/css/language-picker.css",
"theme/css/frontmatter.css",
"theme/css/rtl.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
line-numbers = true
[output.html.redirect]
# Redirects in the form of "old-path" = "new-path", where the new path
# is relative to the old path.
"async/concurrency/channels.html" = "../channels.html"
"async/pitfall/async-traits.html" = "../pitfalls/async-traits.html"
"control-flow/while-let-expression.html" = "while-let-expressions.html"
"exercises/day-1/soluções-tarde.html" = "solutions-afternoon.html"
"exercises/day-2/soluções-tarde.html" = "solutions-afternoon.html"
"exercises/day-3/soluções-tarde.html" = "solutions-afternoon.html"
"exercises/day-3/simples-gui.html" = "simple-gui.html"
"exercises/day-4/afternoon.html" = "../android/morning.html"
"exercises/day-4/android.html" = "../android/morning.html"
"exercises/day-4/dining-philosophers.html" = "../concurrency/dining-philosophers.html"
"exercises/day-4/elevator.html" = "../concurrency/elevator.html"
"exercises/day-4/link-checker.html" = "../concurrency/link-checker.html"
"exercises/day-4/morning.html" = "../concurrency/morning.html"
"exercises/day-4/solutions-morning.html" = "../concurrency/solutions-morning.html"
"exercises/concurrency/elevator.html" = "chat-app.html"
"generics/closures.html" = "../traits/closures.html"
"generics/impl-trait.html" = "../traits/impl-trait.html"
"generics/trait-bounds.html" = "../traits/trait-bounds.html"
"generics/trait-objects.html" = "../traits/trait-objects.html"
"outros-recursos.html" = "other-resources.html"
"running-the-course/day-4.html" = "course-structure.html"
"sintaxe-básica/funções-interlude.html" = "../basic-syntax/functions-interlude.html"
"structure.html" = "running-the-course/course-structure.html"
"unsafe/mutable-static-variables.md" = "mutable-static-variables.html"
"unsafe/unsafe-functions.html" = "calling-unsafe-functions.html"
"welcome-bare-metal.html" = "bare-metal.html"
"welcome-day-4.html" = "concurrency.html"
# Moving exercises between days
"exercises/day-2/luhn.html" = "../day-1/luhn.html"
"exercises/day-2/points-polygons.html" = "../day-3/points-polygons.html"
"exercises/day-1/book-library.html" = "../day-2/book-library.html"
"exercises/day-1/iterators-and-ownership.html" = "../day-2/iterators-and-ownership.html"
# Send people to canonical URL instead of index.html
"welcome.html" = "./"
2023-04-03 17:18:32 +02:00
[output.html.search]
use-boolean-and = true
2023-04-03 17:18:32 +02:00
[output.exerciser]
output-directory = "comprehensive-rust-exercises"