From d052f4402be66ea66f52521d17bb901346edf215 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Fri, 14 Jul 2023 12:05:24 +0200 Subject: [PATCH] ko: refresh translation for basic-syntax (#937) * ko: refresh translation for basic-syntax Part of #925. * Apply suggestions from code review Co-authored-by: Jiyong Park <55639800+jiyongp@users.noreply.github.com> * Update po/ko.po --------- Co-authored-by: Jiyong Park <55639800+jiyongp@users.noreply.github.com> --- po/ko.po | 294 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 294 insertions(+) diff --git a/po/ko.po b/po/ko.po index 82d80023..f6e4266d 100644 --- a/po/ko.po +++ b/po/ko.po @@ -2294,6 +2294,13 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut a: [i8; 10] = [42; 10];\n" +" a[5] = 0;\n" +" println!(\"a: {:?}\", a);\n" +"}\n" +"```" #: src/basic-syntax/compound-types.md:18 msgid "Tuple assignment and access:" @@ -2309,6 +2316,13 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let t: (i8, bool) = (7, true);\n" +" println!(\"1st index: {}\", t.0);\n" +" println!(\"2nd index: {}\", t.1);\n" +"}\n" +"```" #: src/basic-syntax/compound-types.md:32 msgid "Arrays:" @@ -2384,6 +2398,14 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut x: i32 = 10;\n" +" let ref_x: &mut i32 = &mut x;\n" +" *ref_x = 20;\n" +" println!(\"x: {x}\");\n" +"}\n" +"```" #: src/basic-syntax/references.md:14 msgid "Some notes:" @@ -2436,6 +2458,16 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable,compile_fail\n" +"fn main() {\n" +" let ref_x: &i32;\n" +" {\n" +" let x: i32 = 10;\n" +" ref_x = &x;\n" +" }\n" +" println!(\"ref_x: {ref_x}\");\n" +"}\n" +"```" #: src/basic-syntax/references-dangling.md:16 msgid "" @@ -2543,6 +2575,20 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let s1: &str = \"World\";\n" +" println!(\"s1: {s1}\");\n" +"\n" +" let mut s2: String = String::from(\"Hello \");\n" +" println!(\"s2: {s2}\");\n" +" s2.push_str(s1);\n" +" println!(\"s2: {s2}\");\n" +" \n" +" let s3: &str = &s2[6..];\n" +" println!(\"s3: {s3}\");\n" +"}\n" +"```" #: src/basic-syntax/string-slices.md:20 msgid "Rust terminology:" @@ -2730,6 +2776,29 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"struct Rectangle {\n" +" width: u32,\n" +" height: u32,\n" +"}\n" +"\n" +"impl Rectangle {\n" +" fn area(&self) -> u32 {\n" +" self.width * self.height\n" +" }\n" +"\n" +" fn inc_width(&mut self, delta: u32) {\n" +" self.width += delta;\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let mut rect = Rectangle { width: 10, height: 5 };\n" +" println!(\"old area: {}\", rect.area());\n" +" rect.inc_width(5);\n" +" println!(\"new area: {}\", rect.area());\n" +"}\n" +"```" #: src/basic-syntax/methods.md:30 msgid "* We will look much more at methods in today's exercise and in tomorrow's class." @@ -2776,6 +2845,16 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn pick_one(a: T, b: T) -> T {\n" +" if std::process::id() % 2 == 0 { a } else { b }\n" +"}\n" +"\n" +"fn main() {\n" +" println!(\"coin toss: {}\", pick_one(\"heads\", \"tails\"));\n" +" println!(\"cash prize: {}\", pick_one(500, 1000));\n" +"}\n" +"```" #: src/basic-syntax/functions-interlude.md:27 msgid "" @@ -3128,6 +3207,24 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn takes_u32(x: u32) {\n" +" println!(\"u32: {x}\");\n" +"}\n" +"\n" +"fn takes_i8(y: i8) {\n" +" println!(\"i8: {y}\");\n" +"}\n" +"\n" +"fn main() {\n" +" let x = 10;\n" +" let y = 20;\n" +"\n" +" takes_u32(x);\n" +" takes_i8(y);\n" +" // takes_u32(y);\n" +"}\n" +"```" #: src/basic-syntax/type-inference.md:26 msgid "This slide demonstrates how the Rust compiler infers types based on constraints given by variable declarations and usages." @@ -3158,6 +3255,17 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let mut v = Vec::new();\n" +" v.push((10, false));\n" +" v.push((20, true));\n" +" println!(\"v: {v:?}\");\n" +"\n" +" let vv = v.iter().collect::>();\n" +" println!(\"vv: {vv:?}\");\n" +"}\n" +"```" #: src/basic-syntax/type-inference.md:46 msgid "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.collect) relies on `FromIterator`, which [`HashSet`](https://doc.rust-lang.org/std/iter/trait.FromIterator.html) implements." @@ -3199,6 +3307,24 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"const DIGEST_SIZE: usize = 3;\n" +"const ZERO: Option = Some(42);\n" +"\n" +"fn compute_digest(text: &str) -> [u8; DIGEST_SIZE] {\n" +" let mut digest = [ZERO.unwrap_or(0); DIGEST_SIZE];\n" +" for (idx, &b) in text.as_bytes().iter().enumerate() {\n" +" digest[idx % DIGEST_SIZE] = digest[idx % DIGEST_SIZE]." +"wrapping_add(b);\n" +" }\n" +" digest\n" +"}\n" +"\n" +"fn main() {\n" +" let digest = compute_digest(\"Hello\");\n" +" println!(\"Digest: {digest:?}\");\n" +"}\n" +"```" #: src/basic-syntax/static-and-const.md:27 msgid "According the the [Rust RFC Book][1] these are inlined upon use." @@ -3277,6 +3403,22 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let a = 10;\n" +" println!(\"before: {a}\");\n" +"\n" +" {\n" +" let a = \"hello\";\n" +" println!(\"inner scope: {a}\");\n" +"\n" +" let a = true;\n" +" println!(\"shadowed in inner scope: {a}\");\n" +" }\n" +"\n" +" println!(\"after: {a}\");\n" +"}\n" +"```" #: src/basic-syntax/scopes-shadowing.md:25 msgid "" @@ -3301,6 +3443,14 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let a = 1;\n" +" let b = &a;\n" +" let a = a + 1;\n" +" println!(\"{a} {b}\");\n" +"}\n" +"```" #: src/memory-management.md:1 msgid "# Memory Management" @@ -13831,6 +13981,55 @@ msgid "" "```" msgstr "" +#: src/basic-syntax/scalar-types.md:21 +msgid "There are a few syntaxes which are not shown above:" +msgstr "위에 표시되지 않은 몇 가지 문법이 있습니다." + +#: src/basic-syntax/scalar-types.md:23 +msgid "" +"- Raw strings allow you to create a `&str` value with escapes disabled: " +"`r\"\\n\"\n" +" == \"\\\\\\\\n\"`. You can embed double-quotes by using an equal amount of " +"`#` on\n" +" either side of the quotes:\n" +"\n" +" ```rust,editable\n" +" fn main() {\n" +" println!(r#\"link\"#);\n" +" println!(\"link\");\n" +" }\n" +" ```\n" +"\n" +"- Byte strings allow you to create a `&[u8]` value directly:\n" +"\n" +" ```rust,editable\n" +" fn main() {\n" +" println!(\"{:?}\", b\"abc\");\n" +" println!(\"{:?}\", &[97, 98, 99]);\n" +" }\n" +" ```" +msgstr "" +"- 원시 문자열을 사용하면 이스케이프되지 않는 `&str` 값을 만들 수 있습니" +"다. `r\"\\n\"\n" +" == \"\\\\\\\\n\"` 따옴표의 양쪽에 같은 양의 `#`을\n" +" 사용하여 큰따옴표를 삽입할 수 있습니다.\n" +"\n" +" ```rust,editable\n" +" fn main() {\n" +" println!(r#\"link\"#);\n" +" println!(\"link\");\n" +" }\n" +" ```\n" +"\n" +"- Byte strings allow you to create a `&[u8]` value directly:\n" +"\n" +" ```rust,editable\n" +" fn main() {\n" +" println!(\"{:?}\", b\"abc\");\n" +" println!(\"{:?}\", &[97, 98, 99]);\n" +" }\n" +" ```" + #: src/welcome.md:18 msgid "" "The first three days show you the fundamentals of Rust. Following this, " @@ -14203,3 +14402,98 @@ msgstr "" "}\n" "```" +#: src/basic-syntax/rustdoc.md:3 +msgid "" +"All language items in Rust can be documented using special `///` syntax." +msgstr "" +"Rust의 아이템(item)은 `///` 문법을 사용하여 문서화할 수 있습니다." + +#: src/basic-syntax/rustdoc.md:5 +msgid "" +"```rust,editable\n" +"/// Determine whether the first argument is divisible by the second " +"argument.\n" +"///\n" +"/// If the second argument is zero, the result is false.\n" +"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" +" if rhs == 0 {\n" +" return false; // Corner case, early return\n" +" }\n" +" lhs % rhs == 0 // The last expression in a block is the return " +"value\n" +"}\n" +"```" +msgstr "" +"```rust,editable\n" +"/// 첫 번째 인수가 두 번째 인수로 나눠질 수 있는지 결정합니다.\n" +"///\n" +"/// 두 번째 인수가 0이면 결과는 false입니다.\n" +"fn is_divisible_by(lhs: u32, rhs: u32) -> bool {\n" +" if rhs == 0 {\n" +" return false; // Corner case, early return\n" +" }\n" +" lhs % rhs == 0 // 블록 안의 마지막 표현식은 반환값입니다\n" +"}\n" +"```" + +#: src/basic-syntax/rustdoc.md:17 +msgid "" +"The contents are treated as Markdown. All published Rust library crates are\n" +"automatically documented at [`docs.rs`](https://docs.rs) using the\n" +"[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) tool. It " +"is\n" +"idiomatic to document all public items in an API using this pattern." +msgstr "" +"콘텐츠는 마크다운으로 처리됩니다. 게시된 모든 Rust 라이브러리 크레이트는\n" +"[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) 도구를 사용" +"하여 [`docs.rs`](https://docs.rs)에\n" +"자동으로 문서화됩니다. 일반적으로 API의 모든 공개 항목은\n" +"이 패턴을 사용하여 문서화됩니다." + +#: src/basic-syntax/rustdoc.md:24 +msgid "" +"* Show students the generated docs for the `rand` crate at\n" +" [`docs.rs/rand`](https://docs.rs/rand).\n" +"\n" +"* This course does not include rustdoc on slides, just to save space, but " +"in\n" +" real code they should be present.\n" +"\n" +"* Inner doc comments are discussed later (in the page on modules) and need " +"not\n" +" be addressed here." +msgstr "" +"* [`docs.rs/rand`](https://docs.rs/rand)에서 `rand` 크레이트용으로 생성된 문" +"서를\n" +"학생에게 보여줍니다.\n" +"\n" +"* 이 과정에서는 공간 절약을 위해 슬라이드에 rustdoc을 포함하지 않지만\n" +"실제 코드에는 존재해야 합니다.\n" +"\n" +"* 내부 문서 주석은 모듈 페이지 뒷부분에서 다루며 여기서 다루지\n" +"않아도 됩니다." + +#: src/basic-syntax/methods.md:34 +msgid "" +"- Add a `Rectangle::new` constructor and call this from `main`:\n" +"\n" +" ```rust,editable,compile_fail\n" +" fn new(width: u32, height: u32) -> Rectangle {\n" +" Rectangle { width, height }\n" +" }\n" +" ```\n" +"\n" +"- Add a `Rectangle::new_square(width: u32)` constructor to illustrate that\n" +" constructors can take arbitrary parameters." +msgstr "" +"- `Rectangle::new` 생성자를 추가하고 이를 `main`에서 호출합니다.\n" +"\n" +" ```rust,editable,compile_fail\n" +" fn new(width: u32, height: u32) -> Rectangle {\n" +" Rectangle { width, height }\n" +" }\n" +" ```\n" +"\n" +"- `Rectangle::new_square(width: u32)` 생성자를 추가하여 생성자가 임의의 매개" +"변수를 사용할 수 있음을\n" +"보여줍니다."