Internationalization support via mdbook-i18n-helper
* include links to the github sources * prepare hint on howto create other language versions
This commit is contained in:
43
README.md
43
README.md
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
![Welcome to the element-call book.][element_call_book]
|
![Welcome to the element-call book.][element_call_book]
|
||||||
|
|
||||||
This repository contains the text source for `The Element-Call` book.
|
This repository contains the text source for "The Element-Call" book.
|
||||||
We will further reference to it as the `Element-Call Book`.
|
We will further reference to it as the `Element-Call Book`.
|
||||||
|
|
||||||
[element_call_book]: https://gitea.networkx.de/rzerres/element-call-book/src/branch/main/src/img/element-call-1.png
|
[element_call_book]: https://gitea.networkx.de/rzerres/element-call-book/src/branch/main/src/img/element-call-webui.png
|
||||||
<!--
|
<!--
|
||||||
WIP: once it is ready to be shipped
|
WIP: once it is ready to be shipped
|
||||||
[The book is available in dead-tree form from No Starch Press][nostarch].
|
[The book is available in dead-tree form from No Starch Press][nostarch].
|
||||||
@@ -46,22 +46,35 @@ some process flows.
|
|||||||
|
|
||||||
[crates.io]: https://crates.io/crates/cargo-readme
|
[crates.io]: https://crates.io/crates/cargo-readme
|
||||||
|
|
||||||
##### Multilingual version of mdBook
|
If you need a given version of `mdbook`, you may force it's
|
||||||
The `Element-Call` book aims to make translations as flawless as
|
installation the following call:
|
||||||
possible. We are using v0.4.12 that will do the job. There is a
|
|
||||||
patch available that adds the needed salt to organize a book as a
|
|
||||||
multilingual structure: All sources stored in a single hirachical
|
|
||||||
code tree. This work isn't finished yet, but good enough to make
|
|
||||||
use of this branch for our productive needs. Thank you [Nutomic
|
|
||||||
and Ruin0x11][mdbook localization].
|
|
||||||
|
|
||||||
You can force the installation of a given version number
|
|
||||||
with:
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
console $ cargo install mdbook --vers 0.4.12 mdbook-linkchecker mdbook-mermaid
|
console $ cargo install mdbook --vers 0.4.40 mdbook-linkchecker mdbook-mermaid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Multilingual version of mdBook
|
||||||
|
|
||||||
|
The `Element-Call` book aims to make translations as flawless as
|
||||||
|
possible. With [`mdbook-i18n-helpers`][mdbook_i18n_helpers] you gain
|
||||||
|
`Gettext Translation Support` with three extensions.
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ cargo install mdbook-i18n-helpers
|
||||||
|
```
|
||||||
|
|
||||||
|
It will install three binaries:
|
||||||
|
|
||||||
|
* mdbook-xgettext: This program extracts the source text. It is an mdbook renderer.
|
||||||
|
* mdbook-gettext: This program translates the book into a target language.
|
||||||
|
It is an mdbook preprocessor.
|
||||||
|
* mdbook-i18n-normalize: This program normalizs a PO file. Use it after breaking changes.
|
||||||
|
|
||||||
|
Please have a look to the online documentation on howto actually use the Gettext subsystem.
|
||||||
|
|
||||||
|
[mdbook_i18n_helpers]: https://github.com/google/mdbook-i18n-helpers?tab=readme-ov-file
|
||||||
|
[mdbook_i18n_helpers_usage]: https://github.com/google/mdbook-i18n-helpers/blob/main/i18n-helpers/USAGE.md
|
||||||
|
|
||||||
##### Cargo handled README
|
##### Cargo handled README
|
||||||
|
|
||||||
We do make uses of the crate [cargo-readme]. It resolves rust `doc
|
We do make uses of the crate [cargo-readme]. It resolves rust `doc
|
||||||
@@ -125,6 +138,7 @@ To run the tests:
|
|||||||
$ mdbook test
|
$ mdbook test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<!--
|
||||||
##### Building a language variant of the book
|
##### Building a language variant of the book
|
||||||
|
|
||||||
Translated version of the book will be placed inside the code tree
|
Translated version of the book will be placed inside the code tree
|
||||||
@@ -139,6 +153,7 @@ $ MDBOOK_BOOK__src=src/de mdbook build --dest-dir book/de --open
|
|||||||
|
|
||||||
The rendered HTML output will be placed underneath the
|
The rendered HTML output will be placed underneath the
|
||||||
`book/de` subdirectory. Since we appended the `--open` parameter, your default browser should be fired up and ... tada!
|
`book/de` subdirectory. Since we appended the `--open` parameter, your default browser should be fired up and ... tada!
|
||||||
|
!-->
|
||||||
|
|
||||||
#### 🛠️ Development
|
#### 🛠️ Development
|
||||||
==================
|
==================
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ The intention of `Element-Call` book is to help interested developers and admini
|
|||||||
|
|
||||||
The source files of the book are maintained as a git submodule found at [`Element-Call book`][element_call_book].
|
The source files of the book are maintained as a git submodule found at [`Element-Call book`][element_call_book].
|
||||||
|
|
||||||
[element_call_book]: https://gitea.networkx.de/rzerres/element-call-book/book-en
|
[element_call_book]: https://gitea.networkx.de/rzerres/element-call-book/book_en
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
[element-call_book_en_stable]: https://element.io/element-call/stable/book/
|
[element-call_book_en_stable]: https://element.io/element-call/stable/book/
|
||||||
|
|||||||
60
src/lib.rs
60
src/lib.rs
@@ -47,22 +47,35 @@
|
|||||||
//!
|
//!
|
||||||
//! [crates.io]: https://crates.io/crates/cargo-readme
|
//! [crates.io]: https://crates.io/crates/cargo-readme
|
||||||
//!
|
//!
|
||||||
//! #### Multilingual version of mdBook
|
//! If you need a given version of `mdbook`, you may force it's
|
||||||
//! The `Element-Call` book aims to make translations as flawless as
|
//! installation the following call:
|
||||||
//! possible. We are using v0.4.12 that will do the job. There is a
|
|
||||||
//! patch available that adds the needed salt to organize a book as a
|
|
||||||
//! multilingual structure: All sources stored in a single hirachical
|
|
||||||
//! code tree. This work isn't finished yet, but good enough to make
|
|
||||||
//! use of this branch for our productive needs. Thank you [Nutomic
|
|
||||||
//! and Ruin0x11][mdbook localization].
|
|
||||||
//!
|
|
||||||
//! You can force the installation of a given version number
|
|
||||||
//! with:
|
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! console $ cargo install mdbook --vers 0.4.12 mdbook-linkchecker mdbook-mermaid
|
//! console $ cargo install mdbook --vers 0.4.40 mdbook-linkchecker mdbook-mermaid
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! #### Multilingual version of mdBook
|
||||||
|
//!
|
||||||
|
//! The `Element-Call` book aims to make translations as flawless as
|
||||||
|
//! possible. With [`mdbook-i18n-helpers`][mdbook_i18n_helpers] you gain
|
||||||
|
//! `Gettext Translation Support` with three extensions.
|
||||||
|
//!
|
||||||
|
//! ```console
|
||||||
|
//! $ cargo install mdbook-i18n-helpers
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! It will install three binaries:
|
||||||
|
//!
|
||||||
|
//! * mdbook-xgettext: This program extracts the source text. It is an mdbook renderer.
|
||||||
|
//! * mdbook-gettext: This program translates the book into a target language.
|
||||||
|
//! It is an mdbook preprocessor.
|
||||||
|
//! * mdbook-i18n-normalize: This program normalizs a PO file. Use it after breaking changes.
|
||||||
|
//!
|
||||||
|
//! Please have a look to the online documentation on howto actually use the Gettext subsystem.
|
||||||
|
//!
|
||||||
|
//! [mdbook_i18n_helpers]: https://github.com/google/mdbook-i18n-helpers?tab=readme-ov-file
|
||||||
|
//! [mdbook_i18n_helpers_usage]: https://github.com/google/mdbook-i18n-helpers/blob/main/i18n-helpers/USAGE.md
|
||||||
|
//!
|
||||||
//! #### Cargo handled README
|
//! #### Cargo handled README
|
||||||
//!
|
//!
|
||||||
//! We do make uses of the crate [cargo-readme]. It resolves rust `doc
|
//! We do make uses of the crate [cargo-readme]. It resolves rust `doc
|
||||||
@@ -94,27 +107,27 @@
|
|||||||
//! into the root directory of the element-call submodule and type:
|
//! into the root directory of the element-call submodule and type:
|
||||||
//!
|
//!
|
||||||
//! ```console
|
//! ```console
|
||||||
//! $ mdbook build --dest-dir book/en
|
//! $ mdbook build --dest-dir book_en
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! The rendered HTML output will be placed underneath the
|
//! The rendered HTML output will be placed underneath the
|
||||||
//! `book/en` subdirectory. To check it out, open it in your web
|
//! `book_en` subdirectory. To check it out, open it in your web
|
||||||
//! browser.
|
//! browser.
|
||||||
//!
|
//!
|
||||||
//! _Firefox:_
|
//! _Firefox:_
|
||||||
//! ```console
|
//! ```console
|
||||||
//! $ firefox book/en/html/index.html # Linux
|
//! $ firefox book/en/html/index.html # Linux
|
||||||
//! $ open -a "Firefox" book/en/html/index.html # OS X
|
//! $ open -a "Firefox" book_en/html/index.html # OS X
|
||||||
//! $ Start-Process "firefox.exe" .\book\en\html\index.html # Windows (PowerShell)
|
//! $ Start-Process "firefox.exe" .\book_en\html\index.html # Windows (PowerShell)
|
||||||
//! $ start firefox.exe .\book\en\html\index.html # Windows (Cmd)
|
//! $ start firefox.exe .\book_en\html\index.html # Windows (Cmd)
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! _Chrome:_
|
//! _Chrome:_
|
||||||
//! ```console
|
//! ```console
|
||||||
//! $ google-chrome book/en/html/index.html # Linux
|
//! $ google-chrome book/en/html/index.html # Linux
|
||||||
//! $ open -a "Google Chrome" book/en/html/index.html # OS X
|
//! $ open -a "Google Chrome" book_en/html/index.html # OS X
|
||||||
//! $ Start-Process "chrome.exe" .\book\en\html\index.html # Windows (PowerShell)
|
//! $ Start-Process "chrome.exe" .\book_en\html\index.html # Windows (PowerShell)
|
||||||
//! $ start chrome.exe .\book\en\html\index.html # Windows (Cmd)
|
//! $ start chrome.exe .\book_en\html\index.html # Windows (Cmd)
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Executing `mdbook serve` will have **mdbook** act has a web service
|
//! Executing `mdbook serve` will have **mdbook** act has a web service
|
||||||
@@ -126,8 +139,10 @@
|
|||||||
//! $ mdbook test
|
//! $ mdbook test
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! <!--
|
||||||
//! #### Building a language variant of the book
|
//! #### Building a language variant of the book
|
||||||
//!
|
//!
|
||||||
|
//! WIP: adapt to mdbook-i18n-helpers
|
||||||
//! Translated version of the book will be placed inside the code tree
|
//! Translated version of the book will be placed inside the code tree
|
||||||
//! in the subdirectory `src/<language id`.
|
//! in the subdirectory `src/<language id`.
|
||||||
//!
|
//!
|
||||||
@@ -135,11 +150,12 @@
|
|||||||
//! into Element-Call books root directory and type:
|
//! into Element-Call books root directory and type:
|
||||||
//!
|
//!
|
||||||
//! ```console
|
//! ```console
|
||||||
//! $ MDBOOK_BOOK__src=src/de mdbook build --dest-dir book/de --open
|
//! $ MDBOOK_BOOK__src=src_de mdbook build --dest-dir book_de --open
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! The rendered HTML output will be placed underneath the
|
//! The rendered HTML output will be placed underneath the
|
||||||
//! `book/de` subdirectory. Since we appended the `--open` parameter, your default browser should be fired up and ... tada!
|
//! `book_de` subdirectory. Since we appended the `--open` parameter, your default browser should be fired up and ... tada!
|
||||||
|
//! !-->
|
||||||
//!
|
//!
|
||||||
//! ### 🛠️ Development
|
//! ### 🛠️ Development
|
||||||
//! ==================
|
//! ==================
|
||||||
|
|||||||
Reference in New Issue
Block a user