1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-15 06:20:32 +02:00
Commit Graph

1279 Commits

Author SHA1 Message Date
Hidenori Kobayashi
8ff97f1ee7
Remove HTML tag <abbr> (#1310)
The html tag seems to confuse the mdbook-i18n-helpers and make the
translation work hard (#1284).

This simply replaces them with a set of parenthesis.
2023-10-06 10:38:48 +01:00
Henri F
fa1f19e391
zh-CN: Restores lost translations (#1312)
Addresses issue #1311

zh-CN.po stats:
```
msgfmt -o /dev/null --statistics po/zh-CN.po
1258 translated messages, 178 fuzzy translations, 1038 untranslated messages.
```
2023-10-06 08:02:48 +00:00
Zhang SIQI
1a0c0d3fa6
Update CODEOWNERS (#1309)
@henrif75 I want to add myself as the Chinese version reviewer! 
Thank you
2023-10-06 09:56:26 +02:00
Martin Geisler
a38a33c8fb
Use AND between words in mdbook search (#1306)
The default is to use `OR`, which I find counter-intuitive: the more I
try to narrow down a search, the more hits I get. See the full
documentation for more options:


https://rust-lang.github.io/mdBook/format/configuration/renderers.html#outputhtmlsearch
2023-10-05 10:17:05 -04:00
Nick Radcliffe
c93a4bc20c
Remove unused import (use) (#1303)
This should be a clean pull request with just the required diff
2023-10-05 11:17:48 +02:00
Nick Radcliffe
2072ed022b
Fix typo (missing s on threads) (#1304)
Again, a clean pull request for this typo.
2023-10-05 09:17:17 +00:00
Martin Geisler
5760e99e22
Introduce a glossary (#1277)
The goal of this is twofold: give translators a place to document how
certain terms are translated as well as giving people a place to quickly
find a definition of a term. The slides might not always give a quick
definition the same way a glossary can.
2023-10-05 07:17:24 +02:00
Kanta Yamaoka (山岡幹太)
d59cb116b7
ja: Translate Chapter 24 (Generics) (#1283)
Hi JP translation folks (#652). Here's a MR for Generics chapter. Could
you take a look at it? Thank you!
2023-10-05 07:58:20 +09:00
Colin Finck
9d45db83b1
Add a "minimum wrong example" program in C (#1241)
This example shows what kind of bugs easily slip into C code and are
made impossible via Rust.

I have created this example for the motivation slides of my master
thesis. Since then, the university institute has used it in their
introduction to Rust.
I hereby make this part available to the Comprehensive Rust course and
relicense it under the terms of the Apache 2.0 license.

Thank you @mgeisler for your invitation to contribute to this course!

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-10-04 13:26:37 +00:00
Martin Geisler
8c2d8208b2
Link blog post from README.md (#1291)
I hope the blog post can help shed more light on why we wrote the course
and how it has been used at Google.

I'm not sure if "Press" is the best title, but I hope to link other
articles later from this section at a later point.
2023-10-04 13:01:02 +02:00
Martin Geisler
7395725edf
Avoid naming struct field like trait method (#1294)
The `name` struct field was confusing because it was named the same as
the trait method. The struct fields are now disjoint from the method
names — the fact that there are two separate name spaces is not the
point of these slides.

I also dropped the zero-sized type, this is also not the main focus
here.

I also compressed the code a bit to make the unimportant structs take
up less space.

Fixes #1292.
2023-10-04 09:52:15 +00:00
Nick Radcliffe
a883a569d0
Remove unused callback from GUI exercise (#1293)
Here's a possible update to the GUI/TUI exercise, taking out the
callback and explaining (slightly).

See what you think.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-10-03 14:07:33 +00:00
Nick Radcliffe
0f768df367
Minor rewording of safe-ffi-wrapper exercise. (#1286)
For readability.
2023-10-03 14:03:30 +00:00
Martin Geisler
9f079f173b
Update all Cargo.lock files (#1295)
This is the result of running `cargo update` in every directory.

It fixes a alert: https://github.com/advisories/GHSA-9mcr-873m-xcxp. We
don’t run any HTTP server directly, so this is not super important for
us. However, it will remove the alert from my dashboard.
2023-10-03 14:18:44 +02:00
Yuri Astrakhan
36449cb1b2
Add hash to rustdoc example (#1282)
Hashes are important (and somewhat confusing to novices) part of the
rustdoc.
2023-10-02 14:23:46 +02:00
Martin Geisler
1d658ead10
Update to mdbook-i18n-helpers 0.2.4 (#1263)
This is the newest release of mdbook-i18n-helpers, fully backwards
compatible with the old one.
2023-10-01 23:01:22 -07:00
Martin Geisler
42541fc401
Automatically format YAML, CSS, and JS files (#1272)
Initially, I also formatted the templates in `theme/`, but this triggers
https://github.com/prettier/prettier/issues/11834. So I exclude them for
now.

---------

Co-authored-by: Ming-Ying Chung <mych@chromium.org>
2023-10-02 14:48:00 +09:00
Alexey Sokolov
4e768e2e36
Fix several typos (#1251)
cc @Makarevich
2023-09-29 11:41:48 -07:00
Henri Fontana
86cde61f60
zh_CN: .po refresh and remaining course intro translations (#1242)
Normalizes .po file and add professional translation to missing entries
before day 1.
#324
2023-09-29 11:38:31 -07:00
Yarema Mazuryk
1a1a9c85db
continued translation - finished 1-200, continued with 201-400 (#1278)
part of #836
2023-09-29 12:25:52 +01:00
Yuri Astrakhan
c894ea3517
Add unittest example to rustdoc (#1276)
Fixes #1275

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-09-29 06:40:24 +00:00
Matthew
1c43db108b
Fix inconsistent filename styling (#1274)
Addresses https://github.com/google/comprehensive-rust/issues/625

Pages with inconsistent styling:
[Bare Metal Rust Afternoon
Solutions](https://google.github.io/comprehensive-rust/exercises/bare-metal/solutions-afternoon.html)
[Concurrency Afternoon
Solutions](https://google.github.io/comprehensive-rust/exercises/concurrency/solutions-afternoon.html)
[Microcontroller > Debugging
Page](https://google.github.io/comprehensive-rust/bare-metal/microcontrollers/debugging.html)
2023-09-29 08:38:42 +02:00
Martin Geisler
81e30daf66
Run dprint config update (#1273)
This updates the plugins to the latest version.
2023-09-28 22:52:00 +02:00
Dustin J. Mitchell
0e89050eb9
Actually print something in prime_squares example (#1271)
As suggested in #1268.
2023-09-28 11:09:40 +02:00
Martin Geisler
c74b2c8a04
da: Translate the welcome page (#1256) 2023-09-27 12:57:48 +00:00
Martin Geisler
d0e0e5c1af
Skip some untranslatable code blocks (#1258)
This builds on the work of @dyoo in
https://github.com/google/mdbook-i18n-helpers/pull/69: by adding a
special `<!-- mdbook-xgettext: skip -->` comment, we can skip the
following code block.

I also modified a few code blocks to remove translatable text: variable
names are not expected to be translated, so it’s fine to have a line
with `println!("foo: {foo}")` in the code block.

This PR removes 36 messages from the POT file. The number of lines drop
by 633 (3%).

Part of #1257.
2023-09-26 17:04:46 +02:00
Matthew
a492b2f1b2
Italic filenames formatted accordingly (#1259)
**Task** Addresses:
https://github.com/google/comprehensive-rust/issues/625
Certain pages in the mdbook that display filenames have inconsistent
styling.

The style we want to follow: [the interop
section](https://google.github.io/comprehensive-rust/android/interoperability/java.html)

The current problem: [the RTC
driver](https://google.github.io/comprehensive-rust/exercises/bare-metal/rtc.html)
excercise page.

--
@mgeisler I checked this feature by looking through every page


![work](https://github.com/google/comprehensive-rust/assets/38759997/8affd0c2-71f2-4708-88f6-f63cf3c24efa)
2023-09-26 15:15:41 +02:00
Andrew Walbran
864bb942c0
Clarify distinction between Drop trait and drop function. (#1255)
This clears up some misleading explanation from #246.
2023-09-26 11:59:16 +01:00
Martin Geisler
ea44e2547b
da: refresh translation (#1203)
Stats before:

    312 translated messages, 2155 untranslated messages.

and after:

    320 translated messages, 2136 untranslated messages.

Part of #286.
2023-09-26 09:20:32 +00:00
Frances Wingerter
758639174a
Add solution for Health Statistics exercise (#1172) 2023-09-26 09:29:00 +02:00
Hidenori Kobayashi
fc388570bf
ja: Translations - Chapter 40 (bare-metal no_std) (#1198)
Part of google#652.
2023-09-26 10:42:56 +09:00
Matthew
af9c940f09
Fix resolver setting (#1253)
Fixes: https://github.com/google/comprehensive-rust/issues/1249

Since `mdbook-exerciser` and `mdbook-course` are using Rust edition
2021, they naturally want to use the newer resolver (resolver = 2).
<img width="571" alt="Screen Shot 2023-09-25 at 9 57 32 AM"
src="https://github.com/google/comprehensive-rust/assets/38759997/50446a93-877d-408e-ab68-e88d8467f0e3">
2023-09-25 18:00:13 +02: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
Kanta Yamaoka (山岡幹太)
b2f6c37635
ja: Translate Chapter 54, Control Flow (#1189)
Hi, JA project folks (#652), here's a MR for the chapter "Control Flow".
When you have some time, could you review the diff? Any feedback or
suggestions are greatly appreciated. Thank you in advance.
2023-09-25 22:55:43 +09:00
Martin Geisler
ca424b90e0
Revert "Update boot-library.md" (#1235)
Reverts google/comprehensive-rust#225. We normally include links at the
start of each exercise blocks — but we don't include links in the
individual exercises.

If we want to add such links, we should do it consistently across the
entire course.
2023-09-25 09:39:37 -04:00
Emma Li
0f48230b32
Update CODEOWNERS (#1250)
Update my username
2023-09-25 05:47:47 -07:00
Martin Geisler
ca966f304c
Sync src/ with date in PO file when publishing (#1243)
Before, we always used the latest English source files when
publishing. This means that translations become outdated as soon as
anything is changed in the source.

This PR changes will instead freeze translations in place: they will
keep using the same English source files until a new POT file is
merged into the translation. We do this by relying on the
POT-Creation-Date field in the PO files.

We still use up-to-date versions of all other files: this allows us to
fix things in the theme, for example. So the assumption here is that
never versions of our infrastructure remains compatible with old
versions of the Markdown files.

This approach has a problem: when files are moved, the English
translation will link to the new name. This name will not exist in the
old translations. We might be able to disable these links somehow.

Part of google/mdbook-i18n-helpers#16. The
logic here should eventually be moved to somewhere in
mdbook-i18n-helpers, most likely to the renderer that @sakex is
building in google/mdbook-i18n-helpers#84.
2023-09-25 09:52:39 +02:00
Daniel Fernández Núñez
9d21fe159a
Fix bad link in speaker notes Day 2 exercises (#1244) 2023-09-25 07:01:40 +00:00
Hidenori Kobayashi
f6e128b4ad
ja: Translations - bare-metal.md (#1197)
Part of google#652.
2023-09-25 02:58:25 +00:00
Kanta Yamaoka (山岡幹太)
a9183eb305
ja: Translate Chapter 50, Send and Sync (#1161)
Hi, JA translation folks (#652), here's a MR for the chapter "Send and
Sync". This chapter is particularly interesting and contains very
rust-specific concepts which seems unfamiliar to me. Any feedback and
suggestions are welcome :)
2023-09-24 12:07:55 +09:00
Martin Geisler
187fc20007
Fix solution for Storing Books exercise (#1237)
As pointed out by @njr0 in #1233, we were making the exercise confusing
by showing people code that cannot work — and then expecting the course
participants to somehow fix this, without setting clear boundaries for
what can and cannot be modified.

This PR should align the exercise with the other exercises in the course
and avoid the “brain teaser” here.

This also has the advantage of having a full working solution, with no
commented code which will bit-rot over time.
2023-09-22 11:22:51 -04:00
Dustin J. Mitchell
c4a821d43d
Add a pattern-matching exercise (#1231)
This adds a second day-1 afternoon exercise, drawn from the v2 work. It
illustrates general use of an enum and also previews `Result`.

Fixes #1228.
2023-09-22 13:36:57 +02:00
Hatim Nalawala
cc0a78ed9a
Move CSS files into theme/ folder (#1229)
Hi all,
This PR fixes https://github.com/google/comprehensive-rust/issues/1226:

* Moved CSS files to `theme/css`
* Moved speaker-notes.js to `theme/`
* Updated paths in book.toml
2023-09-21 11:00:27 +02:00
Dustin J. Mitchell
4815264e2d
Add mdbook-course to handle parsing frontmatter (#1224)
In v2 of the course, I'd like to include an estimate of the time to be
spent on each segment in the Markdown file. I think a good place for
such metadata is in the frontmatter.

For review purposes, though, I just want to display that information.
So, this is a start at a new mdbook preprocessor that just separates out
the frontmatter and includes it in a `<pre>` block. Eventually, I'd like
to parse it and put the time in the speaker notes.

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-09-20 10:01:53 -04:00
Martin Geisler
ddc9ea1fa6
Replace binary_search example with try_into (#1213)
I don't think `binary_search` is the best example of using `Result` — it
should actually use an `Either` type instead.
2023-09-20 15:52:10 +02:00
Martin Geisler
38557b142a
Use latest mdbook-i18n-helpers in action.yml (#1221)
The new release will allow us to skip untranslatable text in the course,
thus reducing the amount of work and churn for our translators.
2023-09-20 10:38:15 +02:00
Yarema Mazuryk
9ca8d5e286
uk: Continued Translation - Finished 1-200, Continued with 201-400 (#1208)
part of #836
2023-09-19 16:03:00 +01:00
Martin Geisler
ad6ea690aa
de: Refresh PO file (#1223)
This is a clean `msgmerge --update po/de.po po/messages.pot`.
2023-09-19 14:57:05 +02:00
Igor Petruk
0b8ec0ca3e
Update drop.md (#246)
Adding speaker notes about more details when people might want to call
`drop`.

It is not about a `Drop` trait per-se, but if this is to be mentioned in
the course, this is a reasonable place.

---------

Co-authored-by: Martin Geisler <mgeisler@google.com>
Co-authored-by: Martin Geisler <martin@geisler.net>
2023-09-19 10:29:53 +00:00
Ivan De Marino
c5231fc38a
it: Refresh translation (#1222)
As per
https://github.com/google/comprehensive-rust/blob/main/TRANSLATIONS.md#refreshing-an-existing-translation.

There is a bunch of stuff to correct, but I wanted to start by
submitting this as it contains plenty of changes already.
2023-09-19 11:27:07 +01:00