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

301 Commits

Author SHA1 Message Date
Martin Geisler
790e964ee6
Merge pull request #186 from rastringer/patch-1
Speaker notes for 6.5 Functions
2023-01-19 14:48:11 +01:00
Robin Stringer
2d4340f3eb
Speaker notes for 6.5 Functions
Adds speaker notes covering functions basics (declaration parameters, return values, the 'unit' type.
2023-01-19 12:16:43 +00:00
Andrew Walbran
eb9f873466
Merge pull request #185 from markozagar/zagar
Edits to Day1 Morning material
2023-01-19 11:55:12 +00:00
Marko Zagar
6bda89f34e Clarification on references 2023-01-19 10:51:35 +00:00
Marko Zagar
529d4bf20c Speaker note tweaks for compound types 2023-01-19 10:51:35 +00:00
Marko Zagar
7a2ffda266 Mention ADT and zero-cost abstractions among modern features 2023-01-19 10:51:35 +00:00
Martin Geisler
20601319f2
Merge pull request #130 from google/translations
Add support for translations
2023-01-18 16:37:07 +01:00
Martin Geisler
f42c76e6a8 Test that a no-op translation does nothing
This ensures that the full mdbook-xgettext and mdbook-gettext workflow
is stable and doesn’t include spurious newlines.
2023-01-18 16:12:53 +01:00
Martin Geisler
c45bb19528 Test i18n-helpers on pull requests
This ensures that our i18n helpers stay working.
2023-01-18 16:12:53 +01:00
Martin Geisler
afa63ad7b5 Test that translations on pull requests
This adds a simple validation step to the PRs: calling ‘msgfmt’ will
check that the ‘.po’ files are well-formed.
2023-01-18 16:12:53 +01:00
Martin Geisler
2de9c0dae8 Start a Danish translation 2023-01-18 16:12:53 +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
Martin Geisler
8e3941d2e6
Fix close tag on keyboard shortcut page (#179) 2023-01-18 10:57:31 +00:00
Martin Geisler
0324cd2b27
Merge pull request #176 from google/testing
Fix Rustdoc comment.
2023-01-17 17:32:39 +01:00
Andrew Walbran
8f6dcf35f5 Fix Rustdoc. 2023-01-17 16:07:10 +00:00
Zhizhen He
51ad97a8df
Fix typo (#173) 2023-01-17 11:42:31 +00:00
Brandon Pollack
13da3112e9
Ownership speaker notes (#172)
* ownership speaker notes

Co-authored-by: Martin Geisler <mgeisler@google.com>
2023-01-17 08:09:14 +00:00
Andrew Walbran
b602dc9be4
Merge pull request #169 from google/intoiterator
Add some speaker notes for day 3 morning and a page about FromIterator
2023-01-16 21:31:09 +00:00
Andrew Walbran
1c7ce1cac6 Use a consistent order in memory layout of trait objects example. 2023-01-16 16:11:31 +00:00
Andrew Walbran
5cbb8d4c27 Add speaker notes about closures. 2023-01-16 16:11:31 +00:00
Andrew Walbran
a1861ef900 Add speaker notes for impl Trait. 2023-01-16 16:11:31 +00:00
Andrew Walbran
832c7e9963 Add speaker notes for Iterator, and an example using FromIterator. 2023-01-16 16:11:31 +00:00
Fabian Bornhofen
61732adadd
Merge pull request #164 from fbornhofen/speaker-notes-move
Add speaker notes for moves-function-calls.md
2023-01-16 11:34:02 +01:00
sahennenkamp
93b20be600 Hint towards making library mut
Follow up to https://github.com/google/comprehensive-rust/pull/137
Gives the student a hint that it's okay to edit variables within main.
2023-01-16 11:06:40 +01:00
Yauheni Baltukha
4c8d85dc88 Fix typo in rust.md 2023-01-16 11:06:40 +01:00
Robin Stringer
71c68a6996 Adds speaker notes for 6.4.1. String vs str
Adds speaker notes including:
-Brief explanation of &str, String type
-String::from and String::new
-push_str method
2023-01-16 11:06:40 +01:00
Martin Geisler
d1dc1f466a
Merge pull request #167 from sahennenkamp/patch-1
Hint towards making library mut
2023-01-14 08:07:10 +01:00
Martin Geisler
61163d019c
Merge pull request #168 from baltuky/rust_memory_management_typo
Fix a typo on the Memory Management in Rust page
2023-01-14 08:06:33 +01:00
Yauheni Baltukha
f118a78ef2 Fix typo in rust.md 2023-01-14 01:45:36 +01:00
sahennenkamp
fdf26a776f
Hint towards making library mut
Follow up to https://github.com/google/comprehensive-rust/pull/137
Gives the student a hint that it's okay to edit variables within main.
2023-01-13 14:45:47 -08:00
Andrew Walbran
74e2ba6acd
Merge pull request #166 from rastringer/patch-1
Adds speaker notes for 6.4.1. String vs str
2023-01-13 14:05:19 +00:00
Robin Stringer
47435cbf41
Adds speaker notes for 6.4.1. String vs str
Adds speaker notes including:
-Brief explanation of &str, String type
-String::from and String::new
-push_str method
2023-01-13 13:14:19 +00:00
Fabian Bornhofen
35893e2bc6
Update src/ownership/lifetimes-data-structures.md
Co-authored-by: Martin Geisler <martin@geisler.net>
2023-01-13 12:47:15 +01:00
Fabian Bornhofen
53706056e3
Update src/ownership/lifetimes-data-structures.md
Co-authored-by: Martin Geisler <martin@geisler.net>
2023-01-13 12:47:01 +01:00
Fabian Bornhofen
77f24ffab7 Add speaker notes for lifetimes-data-structures.md 2023-01-12 19:36:40 +01:00
Fabian Bornhofen
9c652d06aa Add speaker notes for moves-function-calls.md 2023-01-12 18:23:57 +01:00
Martin Geisler
ddd68c5b0f
Merge pull request #163 from rastringer/patch-1
Speaker notes to 6.4 Slices
2023-01-12 17:16:57 +01:00
Martin Geisler
67b65c5ee8
Simplify language in speaker notes 2023-01-12 17:13:46 +01:00
Robin Stringer
d85643d5ac
Update src/basic-syntax/slices.md
Co-authored-by: Martin Geisler <martin@geisler.net>
2023-01-12 16:11:46 +00:00
Robin Stringer
f4b651456c
Speaker notes to 6.4 Slices
Brief digest of the slice type, including mentions of borrowing, range syntax and lifetimes.
2023-01-12 15:53:16 +00:00
Martin Geisler
39693b929b
Merge pull request #162 from fbornhofen/speaker-notes-2
Re-add link that is still in use
2023-01-12 14:31:20 +01:00
Fabian Bornhofen
81ba5b6a06
Merge pull request #161 from google/defunct-speaker-notes
Simplify state transitions for speaker notes
2023-01-12 12:45:28 +01:00
Fabian Bornhofen
3dd03bbd65 Re-add link that is still in use 2023-01-12 12:33:03 +01:00
Martin Geisler
b7de49e1b8 Simplify state transitions for speaker notes
Before, we attempted to change state from “popup” to “inline-open”
when the speaker note window was closed.

We did this by listening to “pagehide” and change the state there. The
event fires every time you navigate away from the page, so we had a
complex setup where we would reset the state to “popup” when the next
page was loaded into the speaker note window.

The problem with this is that it’s racy: we could end up in a
situation where we set the state to “inline-open” right after the
speaker note window was updated. When that happened, we would mark the
window as “defunct”, meaning that it was supposed to be closed.

With this change, we no longer try to change the state from the
speaker note window. If the window is lost (closed), the user will
have to click the “Close speaker notes” button in the top-right to
reset the state. This should be much more reliable.

Long-term, a better solution would be to let the speaker notes fetch
the current URL using JavaScript instead of doing it via an actual
page navigation. That should allow us to react to “pagehide” events
again (since they won’t fire on every page transition).
2023-01-12 12:31:26 +01:00
Fabian Bornhofen
92dafcb676
Merge pull request #158 from brandonpollack23/stackheap
Add speaker notes to stack and heap pages
2023-01-12 11:53:54 +01:00
Fabian Bornhofen
45e57e9359
Capitalization in stack.md 2023-01-12 11:51:37 +01:00
Fabian Bornhofen
7203bb8a65
Capitalization in src/memory-management/rust.md 2023-01-12 11:50:28 +01:00
Martin Geisler
bd1c8edc3c
Merge pull request #159 from fbornhofen/speaker-notes
Speaker notes: cosmetic fixes for compund-types.md, borrowing.md
2023-01-12 11:38:43 +01:00
Fabian Bornhofen
e8ed8cb5de Clean up playground link in borrowing.md 2023-01-12 11:32:11 +01:00
Fabian Bornhofen
83cd7ab67b Fix typo in borrowing.md 2023-01-12 11:27:57 +01:00