Commit 2275318
committed
Preliminary support multilingual
mdBook does not natively support multilingual documentation. A common
approach is to use a third-party library like mdbook-i18n-helper, which
relies on a Gettext-based workflow to enable multilingual support.
However, I believe such a complex system is unnecessary for our case.
Therefore, this commit follows the approach suggested in the official
mdBook documentation: overriding the 'index.hbs' template to add a
button that redirects users to the corresponding documentation in
another language, thus achieving basic multilingual support.
This commit introduces the following three files under the theme
directory:
- 'index.hbs': Adds a redirect button for switching languages.
- 'lang-toggle.css': Defines the styling for the button and the dropdown
menu.
- 'lang-toggle.js': Implements the main logic behind the button's
behavior.
As a result, two separate books need to be built. However, since
mdBook’s 'book.toml' does not support multiple '[book]' sections in a
single configuration, this commit introduces a configuration template
and a CMake script that generates language-specific toml files for each
version, which are then built into their respective output folders.
Besides, since translations in other languages are expected to be placed
under 'src', all original guide content has been moved into 'src/en'.
[1]: https://github.com/google/mdbook-i18n-helpers1 parent 39884df commit 2275318
File tree
42 files changed
+478
-6
lines changed- guide
- src/en
- dear_imgui
- getting_started
- initialization
- pipeline
- rendering
- theme
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+478
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
This file was deleted.
File renamed without changes.
0 commit comments