1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-03 19:16:38 +02:00
Commit Graph

12 Commits

Author SHA1 Message Date
Martin Geisler
753dea4950
Give guidance on how to review translations (#784)
This captures some general advice which I’ve been handing out 1:1 to
the many new translation reviewers.
2023-06-08 10:42:09 -04:00
Martin Geisler
aaca44f62b
Format files with dprint (#711)
The dprint formatter is a flexible system which will use sandboxed
WebAssembly formatters to format our code (mostly: it calls out to
`rustfmt` for Rust code).

A particularly interesting feature is that dprint can format Rust code
blocks in the Markdown files. However, before we turn that on, we need
to have a way to normalize the Markdown text as it is extracted[1].
That is so that the word put into the translations is kept after the
reformatting.

[1]: https://github.com/google/mdbook-i18n-helpers/issues/19
2023-05-30 17:04:19 +02:00
Martin Geisler
84650b2af1
Add a style guide (#591)
This is an attempt at documenting some things to do and don’t do when
updating the course text or a translation.

Fixes #560.
2023-05-04 12:20:22 +02:00
Martin Geisler
251782aac3
Small copy-edit for TRANSLATIONS.md (#590) 2023-04-28 09:42:05 +02:00
Martin Geisler
49bf110b31
Use mdbook-i18n-helpers crate (#552)
The i18n-helpers are now available as a stand-alone crate:
https://crates.io/crates/mdbook-i18n-helpers.

Because we cache the Rust binaries in our GitHub workflows, I bumped
the cache prefix to ensure we use a clean cache. Otherwise, Cargo
won’t install the new binaries in mdbook-i18n-helpers because it sees
the old ones from this repository.
2023-04-05 16:08:11 +02:00
Martin Geisler
f26134b1f5
Add links to the cloud-translate tool (#549) 2023-04-04 15:14:20 +02:00
Kuba
4a9b679a9c
Add note about fuzzy and fix heading nesting (#466) 2023-03-01 09:17:41 +00:00
Jooyung Han
1821a3fd12
Make i18n-helpers a requirement (#461)
* Make i18n-helpers a requirement

* Skip mdbook-gettext for mdbook-xgettext

* Gettext finds PO file based on `book.language`

* Update workflow

No need to set `preprocessor.gettext.po-file`.

---------

Co-authored-by: Jooyung Han <jooyung@google.com>
2023-02-28 22:05:09 +09:00
Martin Geisler
f90fecb449
Add hint about using a PO editor (#356) 2023-02-06 20:17:36 +01:00
Martin Geisler
e847c13fb7
Take out unnecessary watch dir (#303)
The directory is already mentioned in our `book.toml`.
2023-01-30 13:33:04 +01:00
Kostis Andrikopoulos
4fed580efa
Add trailing backslash for multiline command (#277)
There were some backslashed missing in the command to serve the
translated book. Thus the shell would execute the lines one after the
other, instead of as one command.

This lead to the environment variables not actually being set, and thus
the non-translated version was served anyway.
2023-01-25 18:26:58 +01:00
Martin Geisler
48ec773052 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-18 16:12:53 +01:00