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

36 Commits

Author SHA1 Message Date
Martin Geisler
620b8a3b72
Run mdbook test on translated code (#1961)
I made a small mistake during the refactor in #1492: I removed the
`MDBOOK_BOOK__LANGUAGE` environment variable, which means that we ended
up testing the original Rust code snippets again and again.

This commit also fixes the few typos that have sneaked into the
translations due to the lack of testing.
2024-04-07 19:38:18 +09:00
Henri F
6a7fd259a3
pt-BR: Merge CR v.2 pt-BR translation back into main (#1846)
This PR merges the pt-BR v.2 translation back to main.
Also, it refreshes the .po file format removing the line numbers.
This requires just a syntactical review, as the partial PRs into this
branch were reviewed already.

You can skim this PR with the [GitHub CLI](https://cli.github.com/):

gh pr diff 1846 | bat -l patch

#317 #1463

---------

Co-authored-by: João Victor Mendes <mendesjoaovic@gmail.com>
Co-authored-by: azevedoalice <158203674+azevedoalice@users.noreply.github.com>
2024-02-23 09:56:53 +01:00
Martin Geisler
e2c59ddbb5
Test translations using same source as for publish (#1492)
Before we would run `mdbook test` using the current Markdown sources.
This is subtly wrong: we publish the course using back-dated sources,
so we should therefore also run the tests using the same sources (this
ensures that the code snippets actually work).

After this commit, all translatable content lives in exactly two
directories:

- `src/`
- `third_party/`

We need to restore both directories when testing and when publishing.
This ensures consistency in the Markdown text and in the included
source code.

A new `.github/workflows/build.sh` script takes care of preparing the
two directories according to the date in the PO file (if any).

To ensure we can restore all of `third_party/` to an old commit, the
non-changing `third_party/mdbook/book.js` file has been moved to
`theme/book.js`. The file is generated by `mdbook init --theme`,
making it suitable for modification by the user (us). Symlinks have
been added to `third_party/mdbook/` to indicate that the files
ultimately came from upstream.
2024-01-04 17:04:44 +01:00
Martin Geisler
c9f66fd425
Format all Markdown files with dprint (#1157)
This is the result of running `dprint fmt` after removing `src/` from
the list of excluded directories.

This also reformats the Rust code: we might want to tweak this a bit in
the future since some of the changes removes the hand-formatting. Of
course, this formatting can be seen as a mis-feature, so maybe this is
good overall.

Thanks to mdbook-i18n-helpers 0.2, the POT file is nearly unchanged
after this, meaning that all existing translations remain valid! A few
messages were changed because of stray whitespace characters:

     msgid ""
     "Slices always borrow from another object. In this example, `a` has to remain "
    -"'alive' (in scope) for at least as long as our slice. "
    +"'alive' (in scope) for at least as long as our slice."
     msgstr ""

The formatting is enforced in CI and we will have to see how annoying
this is in practice for the many contributors. If it becomes annoying,
we should look into fixing dprint/check#11 so that `dprint` can annotate
the lines that need fixing directly, then I think we can consider more
strict formatting checks.

I added more customization to `rustfmt.toml`. This is to better emulate
the dense style used in the course:

- `max_width = 85` allows lines to take up the full width available in
our code blocks (when taking margins and the line numbers into account).
- `wrap_comments = true` ensures that we don't show very long comments
in the code examples. I edited some comments to shorten them and avoid
unnecessary line breaks — please trim other unnecessarily long comments
when you see them! Remember we're writing code for slides 😄
- `use_small_heuristics = "Max"` allows for things like struct literals
and if-statements to take up the full line width configured above.

The formatting settings apply to all our Rust code right now — I think
we could improve this with https://github.com/dprint/dprint/issues/711
which lets us add per-directory `dprint` configuration files. However,
the `inherit: true` setting is not yet implemented (as far as I can
tell), so a nested configuration file will have to copy most or all of
the top-level file.
2023-12-31 00:15:07 +01:00
Martin Geisler
35beb8d916
pt-BR: remove translated variable names (#1472)
With #1460 merged, we took away the possibility of translating variable,
struct, and function names in the code snippets.

This broke the Brazilian Portuguese translation because it _does_
translate those things quite frequently! This PR reverts the
translations back to the English original.

I tried to also update the surrounding messages to use the English
words: so when a slide talked about a `nome` variable before, it now
uses `name` instead. We don’t have automated tests for this, so I hope I
did this correctly.
2023-11-13 11:31:37 +01:00
Henri F
25c8bb0135
pt-BR: Normalize .po file with mdbook-i18n-helpers 0.3.0 (#1467)
#317 #1460
2023-11-10 11:45:13 -08:00
Martin Geisler
98f5f9a88f
Revert "Fix typo: missing n in unknown" (#1347)
Reverts google/comprehensive-rust#1344.

The edit to the Markdown file has been kept since we _do_ want to fix
the typo!
2023-10-11 11:47:04 +00:00
Noam Zaks
4eebe43f3b
Fix typo: missing n in unknown (#1344) 2023-10-11 11:30:19 +01:00
Martin Geisler
b3bcaacb70
Set POT-Creation-Date field in PO files (#1252)
This updates each PO file to the date when it was last touched:

    for po_file in po/*.po; do
        POT_DATE=$(git log -1 --date=short --format=%ad $po_file)
sed -i -e 's/"POT-Creation-Date:.*"/"POT-Creation-Date:
'$POT_DATE'\\n"/' $po_file
    done

The dates will be updated with `msgmerge` in the future via
https://github.com/google/mdbook-i18n-helpers/pull/87.

The dates here can be adjusted by hand if needed — the starting point
here only serves as a rough anchor to let us freeze the translations
from further updates. So if you know that you ran `msgmerge` most
recently on a given date, please update the file to that date in a later
PR.
2023-09-25 16:38:03 +02:00
Henri Fontana
e921cb0506
pt-BR: Refresh .po file and clean up new fuzzy entries (#1125)
Part of #330, #317 , #893
2023-08-28 08:43:02 -03:00
rastringer
184b406900
pt-BR: Refresing translation via msgmerge #317 (#1120)
Refresing Brazilian Portuguese translation via msgmerge with new version
of mdbook-i18n-helpers and agreed Poedit settings. Issue #317, keeping
pace with #1104.
2023-08-25 09:28:44 -07:00
Martin Geisler
5432a613f9
pt-BR: normalize with mdbook-i18n-helpers 0.2.2 (#1104)
Before, po/pt-BR.po had these statistics:

1272 translated messages, 93 fuzzy translations, 416 untranslated
messages.

Afterwards, the statistics for po/pt-BR.po is:

1703 translated messages, 114 fuzzy translations, 650 untranslated
messages.

The number of translated messages changed from 71% to 69%.

With this change, it becomes important to use the latest version of
mdbook-i18n-helpers when viewing the translation locally. To update to
the latest version, run

    cargo install mdbook-i18n-helpers

You will now be able to serve the translation locally.

Part of #330.
2023-08-23 14:56:48 +02:00
Henri Fontana
53707c5943
pt-BR: Review / update of Android course (#1017)
* pt-BR: Catches up with latest PRs on the original
EN material

* pt-BR: Review / update of the Android course.
2023-07-25 09:34:05 +01:00
Henri Fontana
e2038b4897
pt-BR: Catches up with latest PRs on the original EN text (#1008)
pt-BR: Catches up with latest PRs on the original
EN material
2023-07-21 09:39:37 +01:00
Henri Fontana
b0380e1f0e
pt-BR: Some updates and fixes (#994)
pt-BR: Some updates and fixes to the
Brazilian Portuguese translation.
2023-07-18 11:10:24 +01:00
Henri Fontana
4d11d59247
pt-BR: Review new fuzzy entries after .po file refresh (#976)
* Added steps to configure Poedit properly

* Small adjustments

* Add link to Poedit

* Fix file formatting

* One. More. dprint. Fix.

* Normalizes pt-BR.po file format through Poedit
with line wrap.

* Fix typo.

* Fix fuzzy entries after .po file reformatting.

* Fix one code sample
2023-07-14 18:34:09 +00:00
Henri Fontana
d891d0bb5e
pt-BR: normalize file formatting (#975)
* Added steps to configure Poedit properly

* Small adjustments

* Add link to Poedit

* Fix file formatting

* One. More. dprint. Fix.

* Normalizes pt-BR.po file format through Poedit
with line wrap.

* Fix typo.
2023-07-14 08:57:05 -07:00
Henri Fontana
666fe8f71d
pt-BR: Day 3 afternoon tune-up - ch. 27-30 (#956)
* pt-BR: Day 3 afternoon tune up, ch. 27-30

* Fix. One. Missing. "/n"
2023-07-12 10:42:31 +01:00
Henri Fontana
51276a6444
pt-BR: Updates and completions - ch.11,18 to 21 (#924)
* pt-BR: Updates and completions - ch.18 to 21

* Fix a single typo

* pt-BR: Ch.11 tune-up
2023-07-10 13:53:17 -03:00
João Victor Mendes
d0b1217c8c
pt-BR: Update and Complete chapters 15 to 17.2 (#922)
* pt-BR: update and translate chapters 15 to 17.2
* address the comments as you wish
Thank you, @joaovicmendes !
2023-07-08 15:07:37 -07:00
João Victor Mendes
2f6c4f2226
pt-BR: Update and Complete chapter 12 to 15.2 (#920)
* Translate chap 12 to 15.2

* Remove unicode chars
2023-07-07 15:59:11 +01:00
Henri Fontana
eef6906235
pt-BR: Updates and completions - ch.6 to 10.8 (#914)
* pt-BR: Updates and completions - ch.6 to 10.2

* pt-BR: Updates and completions - ch.10.3 to 10.8
2023-07-07 15:56:57 +01:00
Henri Fontana
3150163f95
pt-BR: Updates/completes translations for ch 1-6 (#886)
* Completing and improving pt-BR translation for
chapter 1.

* Small typo fix.

* Some other fixes.

* pt-BR: Updates/completes translations for ch 1-6

* Fix missing '\n'
2023-07-01 09:34:02 +01:00
João Victor Mendes
f1dd836f4f
pt-BR: update some fuzzy translations (#787)
Co-authored-by: Hugo Drumond Jacob <74555956+hugojacob@users.noreply.github.com>
2023-06-30 09:57:40 -03:00
Martin Geisler
0e05175e16
pt-BR: fix Markdown link (#742)
Found while discussing links in #737.

Part of #317.
2023-06-01 13:14:55 +01:00
rastringer
ea846407fb
pt-BR: Updates Brazilian Portuguese translation to add new content (with cloud-translate) (#687)
* Updates Brazilian Portuguese translation with cloud-translate, will need fine-tuning

* no-wrap version for pt-BR update
2023-05-31 15:06:21 +02:00
Martin Geisler
4c91965224
pt-BR: Fix broken links (#622) 2023-05-09 16:44:26 +01:00
Jiuney Pachevitch
365795f9cd
pt-BR translation revision (#505)
Review of the translation for pt-BR.
Some terms cannot be translated.
Other terms have no translation and have been adapted.
Code examples have been translated, where possible, for ease of understanding.
2023-03-20 16:22:33 +00:00
Dustin J. Mitchell
ba28dd2d4c
Parse Markdown in mdbook-xgettext (#449)
* Parse Markdown to support translation.

This upgrades from just splitting Markdown files on double-newlines, to
using a Markdown parser to break them into more appropriate chunks. The
upshot is that code samples are all in one message, lists are bundled
together, and generally it should be easier to translate.

* [WIP] helper to update po files for new translation

* process synthetic input file-by-file

* review comments

* remove temporary code

* fix msgfmt lints
2023-03-07 18:07:07 +00:00
Jooyung Han
7bddf5e6d6
Remove Last-* properties in po/ko.po (#468)
* Remove Last-* properties in po/ko.po

* Remove Last* properties in other po files

---------

Co-authored-by: Jooyung Han <jooyung@google.com>
2023-03-01 20:57:47 +09:00
Hugo Drumond Jacob
df2c773652
More polishing on the pt-BR translation (#425)
* More polishing on the pt-BR translation

* Fix translation to make code compile

This was tested with `mdbook test` from
https://github.com/rust-lang/mdBook/pull/1986.

---------

Co-authored-by: Martin Geisler <mgeisler@google.com>
2023-02-17 16:55:59 +01:00
Jiyong Park
92d00f2fd4
Fix typo: patten -> pattern (#430) 2023-02-17 18:34:35 +09:00
Hugo Drumond Jacob
6edc5b1155
pt-BR.po: fine tuning (#418)
* pt-BR.po: fine tuning for slide #1

* pt-BR.po: orador -> instrutor

Orador is a person who speaks to the public while instrutor is literally a trainer.
2023-02-16 11:48:26 +00:00
rastringer
747589ae8c
Fixing mistranslation in match statement (#416) 2023-02-15 18:07:58 +01:00
rastringer
302c93e3fd
Adds latest English changes to pt-BR translation (#396)
* Adds latest English changes to  pt-BR translation

Updating latest changes in English version to pt-BR.po file using the `msgmerge --update po/pt-BR.po po/messages.pot` command.

* Removes all `fuzzy`

Removing all `#, fuzzy` lines so the translation can be live.
2023-02-14 18:43:00 +01:00
Martin Geisler
3a29be8c7d
Publish Brazilian Portuguese translation (#381)
The IETF language tag for “Brazilian Portuguese” is “pt-BR”[1]. This
tag is also used in the HTML lang attribute[2].

We derive the language code directly from the “.po” filename, so I’ve
renamed “pt_BR.po” to “pt-BR.po” make everything use the correct
language code. Nothing in the Gettext pipeline cares about the precise
filename, so it should be fine to rename it like this.

[1]: https://en.wikipedia.org/wiki/Brazilian_Portuguese#Language_codes
[2]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
2023-02-13 13:45:58 +00:00