From e91ef168a7f74d183de5fbf4991bd431748b6616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Sat, 28 Oct 2023 14:22:36 +0900 Subject: [PATCH 1/8] ja: ch25, add translation draft for #652 --- po/ja.po | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 158 insertions(+), 7 deletions(-) diff --git a/po/ja.po b/po/ja.po index bc0f000a74a0..21668c047f6c 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8008,6 +8008,8 @@ msgstr "" msgid "" "Rust lets you abstract over types with traits. They're similar to interfaces:" msgstr "" +"Rustでは、型に関しての抽象化をトレイトを用いて行うことができます。トレイトは" +"interfaceに似ています:" #: src/traits.md:5 msgid "" @@ -8041,12 +8043,49 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"trait Pet {\n" +" fn name(&self) -> String;\n" +"}\n" +"\n" +"struct Dog {\n" +" name: String,\n" +"}\n" +"\n" +"struct Cat;\n" +"\n" +"impl Pet for Dog {\n" +" fn name(&self) -> String {\n" +" self.name.clone()\n" +" }\n" +"}\n" +"\n" +"impl Pet for Cat {\n" +" fn name(&self) -> String {\n" +" String::from(“The cat”) // 名前はありませんが、猫はいずれにせよこのこ" +"とを気にしないでしょう。\n" +" }\n" +"}\n" +"\n" +"fn greet(pet: &P) {\n" +" println!(“Who’s a cutie? {} is!”, pet.name());\n" +"}\n" +"\n" +"fn main() {\n" +" let fido = Dog { name: “Fido”.into() };\n" +" greet(&fido);\n" +"\n" +" let captain_floof = Cat;\n" +" greet(&captain_floof);\n" +"}\n" +"```" #: src/traits/trait-objects.md:3 msgid "" "Trait objects allow for values of different types, for instance in a " "collection:" msgstr "" +"トレイトオブジェクトは異なる型の値を許可します。例をまとめて挙げるとすると:" #: src/traits/trait-objects.md:5 msgid "" @@ -8078,10 +8117,44 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"trait Pet {\n" +" fn name(&self) -> String;\n" +"}\n" +"\n" +"struct Dog {\n" +" name: String,\n" +"}\n" +"\n" +"struct Cat;\n" +"\n" +"impl Pet for Dog {\n" +" fn name(&self) -> String {\n" +" self.name.clone()\n" +" }\n" +"}\n" +"\n" +"impl Pet for Cat {\n" +" fn name(&self) -> String {\n" +" String::from(“The cat”) // 名前はありませんが、猫はいずれにせよこのこ" +"とを気にしないでしょう。\n" +" }\n" +"}\n" +"\n" +"fn main() {\n" +" let pets: Vec> = vec![\n" +" Box::new(Cat),\n" +" Box::new(Dog { name: String::from(“Fido”) }),\n" +" ];\n" +" for pet in pets {\n" +" println!(“Hello {}!”, pet.name());\n" +" }\n" +"}\n" +"```" #: src/traits/trait-objects.md:32 msgid "Memory layout after allocating `pets`:" -msgstr "" +msgstr "`pets`を割り当てた後のメモリレイアウト:" #: src/traits/trait-objects.md:34 msgid "" @@ -8149,18 +8222,25 @@ msgid "" "Types that implement a given trait may be of different sizes. This makes it " "impossible to have things like `Vec` in the example above." msgstr "" +"与えられたトレイトを実装する型は、異なるサイズの型であるかもしれません。この" +"場合、型が、上の例にあるような `Vec`のようなものを持つことは不可能となり" +"ます。" #: src/traits/trait-objects.md:70 msgid "" "`dyn Pet` is a way to tell the compiler about a dynamically sized type that " "implements `Pet`." msgstr "" +"`dyn Pet` はコンパイラに、動的なサイズを持ち、かつ`Pet`を実装する型について知" +"らせるための方法です。" #: src/traits/trait-objects.md:72 msgid "" "In the example, `pets` is allocated on the stack and the vector data is on " "the heap. The two vector elements are _fat pointers_:" msgstr "" +"上の例では `pets` はスタックに確保され、vectorのデータはヒープ上にあります。" +"二つのベクターの要素は _ファット_ ポインタです:" #: src/traits/trait-objects.md:74 msgid "" @@ -8169,16 +8249,22 @@ msgid "" "wikipedia.org/wiki/Virtual_method_table) (vtable) for the `Pet` " "implementation of that particular object." msgstr "" +"ファットポインタはdouble-widthポインタです。これは二つの要素からなります:実" +"際のオブジェクトへのポインタと、そのオブジェクトの`Pet`の実装に向けた[仮想メ" +"ソッドテーブル](https://en.wikipedia.org/wiki/Virtual_method_table) (vtable)" +"です。" #: src/traits/trait-objects.md:77 msgid "" "The data for the `Dog` named Fido is the `name` and `age` fields. The `Cat` " "has a `lives` field." msgstr "" +"Fidoと名付けられた`Dog`のデータは`name` と `age` のフィールドに対応します。例" +"の`Cat`には`lives` フィールドがあります。" #: src/traits/trait-objects.md:79 msgid "Compare these outputs in the above example:" -msgstr "" +msgstr "上の例の結果を比べてみましょう:" #: src/traits/trait-objects.md:80 msgid "" @@ -8197,10 +8283,13 @@ msgid "" "Rust derive macros work by automatically generating code that implements the " "specified traits for a data structure." msgstr "" +"Rustのderiveマクロは、データ構造に対して、指定されたトレイトを実装するコード" +"を自動的に生成します。" #: src/traits/deriving-traits.md:5 msgid "You can let the compiler derive a number of traits as follows:" msgstr "" +"コンパイラには、以下のような幾つかのトレイトを導出させることができます:" #: src/traits/deriving-traits.md:7 msgid "" @@ -8224,6 +8313,8 @@ msgstr "" #: src/traits/default-methods.md:3 msgid "Traits can implement behavior in terms of other trait methods:" msgstr "" +"トレイトを用いて、異なるトレイトメソッドに関した動作を実装することができま" +"す:" #: src/traits/default-methods.md:5 msgid "" @@ -8259,34 +8350,42 @@ msgid "" "are required to implement themselves. Methods with default implementations " "can rely on required methods." msgstr "" +"トレイトは予め実装された(デフォルトの)メソッドと、ユーザが自身で実装する必" +"要のあるメソッドを指定することがあります。デフォルトの実装のあるメソッドは、" +"必須のメソッドのみに依存します。" #: src/traits/default-methods.md:35 msgid "Move method `not_equals` to a new trait `NotEquals`." msgstr "" +"メソッド `not_equals` を新しいトレイト `NotEquals` に移してみましょう。" #: src/traits/default-methods.md:37 msgid "Make `Equals` a super trait for `NotEquals`." -msgstr "" +msgstr "`Equals` を `NotEquals` のスーパートレイトにしてみましょう。" #: src/traits/default-methods.md:46 msgid "Provide a blanket implementation of `NotEquals` for `Equals`." -msgstr "" +msgstr "`Equals`に対する`NotEquals`のブランケット実装を示してください。" #: src/traits/default-methods.md:58 msgid "" "With the blanket implementation, you no longer need `Equals` as a super " "trait for `NotEqual`." msgstr "" +"ブランケット実装を用いれば、`NotEqual` のスーパートレイトとしての`Equals` は" +"もう必要ありません。" #: src/traits/trait-bounds.md:3 msgid "" "When working with generics, you often want to require the types to implement " "some trait, so that you can call this trait's methods." msgstr "" +"ジェネリクスを用いるとき、トレイトのメソッドを呼び出せるように、型にいくつか" +"のトレイトを実装することを必須にしたいことがよくあります。" #: src/traits/trait-bounds.md:6 msgid "You can do this with `T: Trait` or `impl Trait`:" -msgstr "" +msgstr "そうしたことは`T: Trait` や `impl Trait`を用いて行えます:" #: src/traits/trait-bounds.md:8 msgid "" @@ -8315,24 +8414,54 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn duplicate(a: T) -> (T, T) {\n" +" (a.clone(), a.clone())\n" +"}\n" +"\n" +"// 以下の糖衣構文です:\n" +"// fn add_42_millions>(x: T) -> i32 {\n" +"fn add_42_millions(x: impl Into) -> i32 {\n" +" x.into() + 42_000_000\n" +"}\n" +"\n" +"// struct NotClonable;\n" +"\n" +"fn main() {\n" +" let foo = String::from(“foo”);\n" +" let pair = duplicate(foo);\n" +" println!(“{pair:?}”);\n" +"\n" +" let many = add_42_millions(42_i8);\n" +" println!(“{many}”);\n" +" let many_more = add_42_millions(10_000_000);\n" +" println!(“{many_more}”);\n" +"}\n" +"```" #: src/traits/trait-bounds.md:35 msgid "Show a `where` clause, students will encounter it when reading code." msgstr "" +"`where` 節を見せてみましょう。受講生はコードを読んでいるときに、この`where`節" +"に遭遇します。" #: src/traits/trait-bounds.md:46 msgid "It declutters the function signature if you have many parameters." msgstr "" +"たくさんのパラメタがある場合に、`where`節は関数のシグネチャを整理整頓してくれ" +"ます。" #: src/traits/trait-bounds.md:47 msgid "It has additional features making it more powerful." -msgstr "" +msgstr "`where`節をさらに強力にするような追加の特徴があります。" #: src/traits/trait-bounds.md:48 msgid "" "If someone asks, the extra feature is that the type on the left of \":\" can " "be arbitrary, like `Option`." msgstr "" +"もし誰かに尋ねられたとき、追加の特徴は、「:」の左の型は任意であるというもので" +"す。`Option`のように。" #: src/traits/impl-trait.md:1 msgid "`impl Trait`" @@ -8343,6 +8472,8 @@ msgid "" "Similar to trait bounds, an `impl Trait` syntax can be used in function " "arguments and return values:" msgstr "" +"トレイト境界と似たように、構文 `impl Trait`は関数の引数と返り値においてのみ利" +"用可能です:" #: src/traits/impl-trait.md:6 msgid "" @@ -8363,17 +8494,21 @@ msgstr "" #: src/traits/impl-trait.md:19 msgid "`impl Trait` allows you to work with types which you cannot name." msgstr "" +"`impl Trait`を用いれば、名前を付けることができない型を活用することができま" +"す。" #: src/traits/impl-trait.md:23 msgid "" "The meaning of `impl Trait` is a bit different in the different positions." -msgstr "" +msgstr "`impl Trait`の意味は、位置によって少し異なります。" #: src/traits/impl-trait.md:25 msgid "" "For a parameter, `impl Trait` is like an anonymous generic parameter with a " "trait bound." msgstr "" +"パラメタに対しては、`impl Trait`は、トレイト境界を持つ匿名のジェネリックパラ" +"メタのようなものです。" #: src/traits/impl-trait.md:27 msgid "" @@ -8381,6 +8516,9 @@ msgid "" "implements the trait, without naming the type. This can be useful when you " "don't want to expose the concrete type in a public API." msgstr "" +"返り値に対しては、トレイトを実装する具象型と同じ返り値の型をとり、かつ型に名" +"前をつけることはない、ということです。このことは公開されるAPIに具象型を晒した" +"くない場合に便利です。" #: src/traits/impl-trait.md:31 msgid "" @@ -8391,6 +8529,12 @@ msgid "" "`let x: Vec<_> = foo.collect()` or with the turbofish, `foo.collect::" ">()`." msgstr "" +"返り値の位置における型推論は困難です。`impl Foo`を返す関数は、それが返す具象" +"型はソースコードに書かれることないまま、具象型を選びます。`collect() -> B`" +"のようなジェネリック型を返す関数は、`B`を満たすどのような型でも返すことがあり" +"ます。 また、関数の呼び出し元はそのような型を一つを選ぶ必要があるかもしれませ" +"ん。 それは、 `let x: Vec<_> = foo.collect()`としたり、turbofishを用いて`foo." +"collect::>()`とすることで行えます。" #: src/traits/impl-trait.md:37 msgid "" @@ -8402,6 +8546,13 @@ msgid "" "`format!` returns. If we wanted to do the same via `: Display` syntax, we'd " "need two independent generic parameters." msgstr "" +"この例は素晴らしい例です。なぜなら、 `impl Display`を2回用いているからで" +"す。 ここでは `impl Display` の型が同一になることを強制するものはない、という" +"説明をするのに役立ちます。もし単一の`T: Display`を用いた場合、定数に対して入" +"力の`T`と返り値の`T`が同一の型であることが強制されてしまいます。例で示した関" +"数ではうまくいかないでしょう。なぜなら、我々が期待する入力の型は、`format!`が" +"返すものではおそらくないからです。もしも同じことを`: Display`の構文で行いたい" +"場合、2つの独立してジェネリックなパラメタが必要となるでしょう。" #: src/traits/important-traits.md:3 msgid "" From a5f938f6a07859a6bed6ce7fbb17488e8f6103c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Sat, 28 Oct 2023 14:33:52 +0900 Subject: [PATCH 2/8] ja: ch25, update old translation in snippets for #652 --- po/ja.po | 58 +++++++++++++++++++++----------------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/po/ja.po b/po/ja.po index 21668c047f6c..f2ae57fb4938 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8044,39 +8044,32 @@ msgid "" "```" msgstr "" "```rust,editable\n" -"trait Pet {\n" -" fn name(&self) -> String;\n" -"}\n" +"struct Dog { name: String, age: i8 }\n" +"struct Cat { lives: i8 } // 猫に名前は必要ありません。どのみち猫は名前に反応" +"しないからです。\n" "\n" -"struct Dog {\n" -" name: String,\n" +"trait Pet {\n" +" fn talk(&self) -> String;\n" "}\n" "\n" -"struct Cat;\n" -"\n" "impl Pet for Dog {\n" -" fn name(&self) -> String {\n" -" self.name.clone()\n" -" }\n" +" fn talk(&self) -> String { format!(“Woof, my name is {}!”, self.name) }\n" "}\n" "\n" "impl Pet for Cat {\n" -" fn name(&self) -> String {\n" -" String::from(“The cat”) // 名前はありませんが、猫はいずれにせよこのこ" -"とを気にしないでしょう。\n" -" }\n" +" fn talk(&self) -> String { String::from(“Miau!”) }\n" "}\n" "\n" "fn greet(pet: &P) {\n" -" println!(“Who’s a cutie? {} is!”, pet.name());\n" +" println!(“Oh you’re a cutie! What’s your name? {}”, pet.talk());\n" "}\n" "\n" "fn main() {\n" -" let fido = Dog { name: “Fido”.into() };\n" -" greet(&fido);\n" +" let captain_floof = Cat { lives: 9 };\n" +" let fido = Dog { name: String::from(“Fido”), age: 5 };\n" "\n" -" let captain_floof = Cat;\n" " greet(&captain_floof);\n" +" greet(&fido);\n" "}\n" "```" @@ -8118,36 +8111,29 @@ msgid "" "```" msgstr "" "```rust,editable\n" -"trait Pet {\n" -" fn name(&self) -> String;\n" -"}\n" +"struct Dog { name: String, age: i8 }\n" +"struct Cat { lives: i8 } // 猫に名前は必要ありません。どのみち猫は名前に反応" +"しないからです。\n" "\n" -"struct Dog {\n" -" name: String,\n" +"trait Pet {\n" +" fn talk(&self) -> String;\n" "}\n" "\n" -"struct Cat;\n" -"\n" "impl Pet for Dog {\n" -" fn name(&self) -> String {\n" -" self.name.clone()\n" -" }\n" +" fn talk(&self) -> String { format!(“Woof, my name is {}!”, self.name) }\n" "}\n" "\n" "impl Pet for Cat {\n" -" fn name(&self) -> String {\n" -" String::from(“The cat”) // 名前はありませんが、猫はいずれにせよこのこ" -"とを気にしないでしょう。\n" -" }\n" +" fn talk(&self) -> String { String::from(“Miau!”) }\n" "}\n" "\n" "fn main() {\n" " let pets: Vec> = vec![\n" -" Box::new(Cat),\n" -" Box::new(Dog { name: String::from(“Fido”) }),\n" +" Box::new(Cat { lives: 9 }),\n" +" Box::new(Dog { name: String::from(“Fido”), age: 5 }),\n" " ];\n" " for pet in pets {\n" -" println!(“Hello {}!”, pet.name());\n" +" println!(“Hello, who are you? {}”, pet.talk());\n" " }\n" "}\n" "```" @@ -8419,7 +8405,7 @@ msgstr "" " (a.clone(), a.clone())\n" "}\n" "\n" -"// 以下の糖衣構文です:\n" +"// 以下の糖衣構文です:\n" "// fn add_42_millions>(x: T) -> i32 {\n" "fn add_42_millions(x: impl Into) -> i32 {\n" " x.into() + 42_000_000\n" From cb4b5d6a3134f41f8a8c701c056bf1c3c0ae0b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Sat, 28 Oct 2023 21:42:04 +0900 Subject: [PATCH 3/8] ja: ch25, fix auto-converted " in ja.po for #652 --- po/ja.po | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/po/ja.po b/po/ja.po index f2ae57fb4938..02c7b10cf123 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8053,20 +8053,21 @@ msgstr "" "}\n" "\n" "impl Pet for Dog {\n" -" fn talk(&self) -> String { format!(“Woof, my name is {}!”, self.name) }\n" +" fn talk(&self) -> String { format!(\"Woof, my name is {}!\", self." +"name) }\n" "}\n" "\n" "impl Pet for Cat {\n" -" fn talk(&self) -> String { String::from(“Miau!”) }\n" +" fn talk(&self) -> String { String::from(\"Miau!\") }\n" "}\n" "\n" "fn greet(pet: &P) {\n" -" println!(“Oh you’re a cutie! What’s your name? {}”, pet.talk());\n" +" println!(\"Oh you're a cutie! What's your name? {}\", pet.talk());\n" "}\n" "\n" "fn main() {\n" " let captain_floof = Cat { lives: 9 };\n" -" let fido = Dog { name: String::from(“Fido”), age: 5 };\n" +" let fido = Dog { name: String::from(\"Fido\"), age: 5 };\n" "\n" " greet(&captain_floof);\n" " greet(&fido);\n" @@ -8120,20 +8121,21 @@ msgstr "" "}\n" "\n" "impl Pet for Dog {\n" -" fn talk(&self) -> String { format!(“Woof, my name is {}!”, self.name) }\n" +" fn talk(&self) -> String { format!(\"Woof, my name is {}!\", self." +"name) }\n" "}\n" "\n" "impl Pet for Cat {\n" -" fn talk(&self) -> String { String::from(“Miau!”) }\n" +" fn talk(&self) -> String { String::from(\"Miau!\") }\n" "}\n" "\n" "fn main() {\n" " let pets: Vec> = vec![\n" " Box::new(Cat { lives: 9 }),\n" -" Box::new(Dog { name: String::from(“Fido”), age: 5 }),\n" +" Box::new(Dog { name: String::from(\"Fido\"), age: 5 }),\n" " ];\n" " for pet in pets {\n" -" println!(“Hello, who are you? {}”, pet.talk());\n" +" println!(\"Hello, who are you? {}\", pet.talk());\n" " }\n" "}\n" "```" @@ -8414,14 +8416,14 @@ msgstr "" "// struct NotClonable;\n" "\n" "fn main() {\n" -" let foo = String::from(“foo”);\n" +" let foo = String::from(\"foo\");\n" " let pair = duplicate(foo);\n" -" println!(“{pair:?}”);\n" +" println!(\"{pair:?}\");\n" "\n" " let many = add_42_millions(42_i8);\n" -" println!(“{many}”);\n" +" println!(\"{many}\");\n" " let many_more = add_42_millions(10_000_000);\n" -" println!(“{many_more}”);\n" +" println!(\"{many_more}\");\n" "}\n" "```" From 81e2db74a3f3ef4a5dd3454af94934e758532ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:35:42 +0900 Subject: [PATCH 4/8] ja: ch25 WIP apply @HidenoriKobayashi review 1 --- po/ja.po | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/po/ja.po b/po/ja.po index 02c7b10cf123..bd84bd924b88 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8210,9 +8210,8 @@ msgid "" "Types that implement a given trait may be of different sizes. This makes it " "impossible to have things like `Vec` in the example above." msgstr "" -"与えられたトレイトを実装する型は、異なるサイズの型であるかもしれません。この" -"場合、型が、上の例にあるような `Vec`のようなものを持つことは不可能となり" -"ます。" +"同じトレイトを実装する型であってもそのサイズは異なることがあります。そのた" +"め、上の例でVecと書くことはできません。" #: src/traits/trait-objects.md:70 msgid "" @@ -8238,7 +8237,7 @@ msgid "" "implementation of that particular object." msgstr "" "ファットポインタはdouble-widthポインタです。これは二つの要素からなります:実" -"際のオブジェクトへのポインタと、そのオブジェクトの`Pet`の実装に向けた[仮想メ" +"際のオブジェクトへのポインタと、そのオブジェクトの`Pet`の実装のための[仮想メ" "ソッドテーブル](https://en.wikipedia.org/wiki/Virtual_method_table) (vtable)" "です。" @@ -8252,7 +8251,7 @@ msgstr "" #: src/traits/trait-objects.md:79 msgid "Compare these outputs in the above example:" -msgstr "上の例の結果を比べてみましょう:" +msgstr "上の例において、下のコードによる出力結果を比べてみましょう:" #: src/traits/trait-objects.md:80 msgid "" @@ -8271,8 +8270,8 @@ msgid "" "Rust derive macros work by automatically generating code that implements the " "specified traits for a data structure." msgstr "" -"Rustのderiveマクロは、データ構造に対して、指定されたトレイトを実装するコード" -"を自動的に生成します。" +"Rustのderiveマクロは、データ構造体に対して、指定されたトレイトを実装するコー" +"ドを自動的に生成します。" #: src/traits/deriving-traits.md:5 msgid "You can let the compiler derive a number of traits as follows:" @@ -8301,8 +8300,7 @@ msgstr "" #: src/traits/default-methods.md:3 msgid "Traits can implement behavior in terms of other trait methods:" msgstr "" -"トレイトを用いて、異なるトレイトメソッドに関した動作を実装することができま" -"す:" +"トレイトでは、別のトレイトメソッドを用いて挙動を定義することが可能です:" #: src/traits/default-methods.md:5 msgid "" @@ -8339,8 +8337,8 @@ msgid "" "can rely on required methods." msgstr "" "トレイトは予め実装された(デフォルトの)メソッドと、ユーザが自身で実装する必" -"要のあるメソッドを指定することがあります。デフォルトの実装のあるメソッドは、" -"必須のメソッドのみに依存します。" +"要のあるメソッドを指定することができます。デフォルトの実装のあるメソッドは、" +"その定義を実装必須のメソットに依存することができます。" #: src/traits/default-methods.md:35 msgid "Move method `not_equals` to a new trait `NotEquals`." @@ -8481,9 +8479,7 @@ msgstr "" #: src/traits/impl-trait.md:19 msgid "`impl Trait` allows you to work with types which you cannot name." -msgstr "" -"`impl Trait`を用いれば、名前を付けることができない型を活用することができま" -"す。" +msgstr "`impl Trait`を用いれば、型名を明示せずに型を限定することができます。" #: src/traits/impl-trait.md:23 msgid "" @@ -8504,9 +8500,9 @@ msgid "" "implements the trait, without naming the type. This can be useful when you " "don't want to expose the concrete type in a public API." msgstr "" -"返り値に対しては、トレイトを実装する具象型と同じ返り値の型をとり、かつ型に名" -"前をつけることはない、ということです。このことは公開されるAPIに具象型を晒した" -"くない場合に便利です。" +"返り値の型に用いる場合は、具体的な型名を明示せずに特定のトレイトを実装する何" +"らかの具象型を返すということを意味します。このことは公開されるAPIに具象型を晒" +"したくない場合に便利です。" #: src/traits/impl-trait.md:31 msgid "" @@ -8540,7 +8536,7 @@ msgstr "" "力の`T`と返り値の`T`が同一の型であることが強制されてしまいます。例で示した関" "数ではうまくいかないでしょう。なぜなら、我々が期待する入力の型は、`format!`が" "返すものではおそらくないからです。もしも同じことを`: Display`の構文で行いたい" -"場合、2つの独立してジェネリックなパラメタが必要となるでしょう。" +"場合、2つの独立したジェネリックなパラメタが必要となるでしょう。" #: src/traits/important-traits.md:3 msgid "" From a723f7e812644e9c068c5f39f17af4a07ccbbf08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Sat, 4 Nov 2023 12:54:51 +0900 Subject: [PATCH 5/8] ja: ch25 WIP apply @HidenoriKobayashi review 2 --- po/ja.po | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/po/ja.po b/po/ja.po index bd84bd924b88..986d7085ff54 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8079,7 +8079,8 @@ msgid "" "Trait objects allow for values of different types, for instance in a " "collection:" msgstr "" -"トレイトオブジェクトは異なる型の値を許可します。例をまとめて挙げるとすると:" +"トレイトオブジェクトは異なる型の値をひとつのコレクションにまとめることを可能" +"にします:" #: src/traits/trait-objects.md:5 msgid "" @@ -8218,8 +8219,8 @@ msgid "" "`dyn Pet` is a way to tell the compiler about a dynamically sized type that " "implements `Pet`." msgstr "" -"`dyn Pet` はコンパイラに、動的なサイズを持ち、かつ`Pet`を実装する型について知" -"らせるための方法です。" +"`dyn Pet` はコンパイラに、この型が`Pet`トレイトを実装する動的なサイズの型であ" +"ることを伝えます。" #: src/traits/trait-objects.md:72 msgid "" @@ -8275,8 +8276,7 @@ msgstr "" #: src/traits/deriving-traits.md:5 msgid "You can let the compiler derive a number of traits as follows:" -msgstr "" -"コンパイラには、以下のような幾つかのトレイトを導出させることができます:" +msgstr "コンパイラには、以下のような多くのトレイトを導出させることができます:" #: src/traits/deriving-traits.md:7 msgid "" @@ -8351,23 +8351,23 @@ msgstr "`Equals` を `NotEquals` のスーパートレイトにしてみまし #: src/traits/default-methods.md:46 msgid "Provide a blanket implementation of `NotEquals` for `Equals`." -msgstr "`Equals`に対する`NotEquals`のブランケット実装を示してください。" +msgstr "`Equals`に対する`NotEquals`のブランケット実装を示してみましょう。" #: src/traits/default-methods.md:58 msgid "" "With the blanket implementation, you no longer need `Equals` as a super " "trait for `NotEqual`." msgstr "" -"ブランケット実装を用いれば、`NotEqual` のスーパートレイトとしての`Equals` は" -"もう必要ありません。" +"ブランケット実装を用いれば、`Equals` を`NotEqual`のスーパートレイトとする必要" +"はなくなります。" #: src/traits/trait-bounds.md:3 msgid "" "When working with generics, you often want to require the types to implement " "some trait, so that you can call this trait's methods." msgstr "" -"ジェネリクスを用いるとき、トレイトのメソッドを呼び出せるように、型にいくつか" -"のトレイトを実装することを必須にしたいことがよくあります。" +"ジェネリクスを用いるとき、トレイトのメソッドを呼び出せるように、型が特定のト" +"レイトを実装していることを要求したいことがよくあります。" #: src/traits/trait-bounds.md:6 msgid "You can do this with `T: Trait` or `impl Trait`:" @@ -8428,8 +8428,8 @@ msgstr "" #: src/traits/trait-bounds.md:35 msgid "Show a `where` clause, students will encounter it when reading code." msgstr "" -"`where` 節を見せてみましょう。受講生はコードを読んでいるときに、この`where`節" -"に遭遇します。" +"`where` 節の使い方を示しましょう。受講生はコードを読んでいるときに、この" +"`where`節に遭遇します。" #: src/traits/trait-bounds.md:46 msgid "It declutters the function signature if you have many parameters." @@ -8439,15 +8439,15 @@ msgstr "" #: src/traits/trait-bounds.md:47 msgid "It has additional features making it more powerful." -msgstr "`where`節をさらに強力にするような追加の特徴があります。" +msgstr "`where`節には更に強力な機能があります。" #: src/traits/trait-bounds.md:48 msgid "" "If someone asks, the extra feature is that the type on the left of \":\" can " "be arbitrary, like `Option`." msgstr "" -"もし誰かに尋ねられたとき、追加の特徴は、「:」の左の型は任意であるというもので" -"す。`Option`のように。" +"誰かに聞かれた場合で良いですが、その機能というのは、\":\" の左側には " +"`Option` のように任意の型を表現できるというものです。" #: src/traits/impl-trait.md:1 msgid "`impl Trait`" @@ -8532,11 +8532,11 @@ msgid "" msgstr "" "この例は素晴らしい例です。なぜなら、 `impl Display`を2回用いているからで" "す。 ここでは `impl Display` の型が同一になることを強制するものはない、という" -"説明をするのに役立ちます。もし単一の`T: Display`を用いた場合、定数に対して入" -"力の`T`と返り値の`T`が同一の型であることが強制されてしまいます。例で示した関" -"数ではうまくいかないでしょう。なぜなら、我々が期待する入力の型は、`format!`が" -"返すものではおそらくないからです。もしも同じことを`: Display`の構文で行いたい" -"場合、2つの独立したジェネリックなパラメタが必要となるでしょう。" +"説明をするのに役立ちます。もし単一の`T: Display`を用いた場合、入力の`T`と返り" +"値の`T`が同一の型であることが強制されてしまいます。例で示した関数ではうまくい" +"かないでしょう。なぜなら、我々が期待する入力の型は、`format!`が返すものではお" +"そらくないからです。もしも同じことを`: Display`の構文で行いたい場合、2つの独" +"立したジェネリックなパラメタが必要となるでしょう。" #: src/traits/important-traits.md:3 msgid "" From 20cbf7e570c09d860677906623b5f74db46c1f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Mon, 6 Nov 2023 22:13:42 +0900 Subject: [PATCH 6/8] ja: ch25 WIP apply @keiichiw review 1 --- po/ja.po | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/po/ja.po b/po/ja.po index 986d7085ff54..2eef125967e4 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8212,7 +8212,7 @@ msgid "" "impossible to have things like `Vec` in the example above." msgstr "" "同じトレイトを実装する型であってもそのサイズは異なることがあります。そのた" -"め、上の例でVecと書くことはできません。" +"め、上の例でVecと書くことはできません。" #: src/traits/trait-objects.md:70 msgid "" @@ -8227,8 +8227,8 @@ msgid "" "In the example, `pets` is allocated on the stack and the vector data is on " "the heap. The two vector elements are _fat pointers_:" msgstr "" -"上の例では `pets` はスタックに確保され、vectorのデータはヒープ上にあります。" -"二つのベクターの要素は _ファット_ ポインタです:" +"上の例では `pets` はスタックに確保され、ベクターのデータはヒープ上にありま" +"す。二つのベクターの要素は _ファットポインタ_ です:" #: src/traits/trait-objects.md:74 msgid "" @@ -8238,9 +8238,10 @@ msgid "" "implementation of that particular object." msgstr "" "ファットポインタはdouble-widthポインタです。これは二つの要素からなります:実" -"際のオブジェクトへのポインタと、そのオブジェクトの`Pet`の実装のための[仮想メ" -"ソッドテーブル](https://en.wikipedia.org/wiki/Virtual_method_table) (vtable)" -"です。" +"際のオブジェクトへのポインタと、そのオブジェクトの`Pet`の実装のための[仮想関" +"数テーブル](https://ja.wikipedia.org/wiki/" +"%E4%BB%AE%E6%83%B3%E9%96%A2%E6%95%B0%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB) " +"(vtable)です。" #: src/traits/trait-objects.md:77 msgid "" @@ -8366,8 +8367,8 @@ msgid "" "When working with generics, you often want to require the types to implement " "some trait, so that you can call this trait's methods." msgstr "" -"ジェネリクスを用いるとき、トレイトのメソッドを呼び出せるように、型が特定のト" -"レイトを実装していることを要求したいことがよくあります。" +"ジェネリクスを用いるとき、あるトレイトのメソッドを呼び出せるように、型がその" +"トレイトを実装していることを要求したいことがよくあります。" #: src/traits/trait-bounds.md:6 msgid "You can do this with `T: Trait` or `impl Trait`:" From bf53b7cef0ac5da6686112410349297b97f0a74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Sun, 12 Nov 2023 18:24:18 +0900 Subject: [PATCH 7/8] ja: ch25 WIP apply @keiichiw review 2 --- po/ja.po | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/po/ja.po b/po/ja.po index 2eef125967e4..04a1b1512733 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8248,8 +8248,11 @@ msgid "" "The data for the `Dog` named Fido is the `name` and `age` fields. The `Cat` " "has a `lives` field." msgstr "" -"Fidoと名付けられた`Dog`のデータは`name` と `age` のフィールドに対応します。例" -"の`Cat`には`lives` フィールドがあります。" +"\"Fido\"と名付けられた`Dog`のデータは`name` と `age` のフィールドに対応しま" +"す。(訳注: \"Fido\"とはよくある犬の愛称で、日本語でいう「ポチ」のような名前" +"です。)例の`Cat`には`lives` フィールドがあります。(訳注: ここで`Cat`が" +"`lives`というフィールドを持ち、9で初期化しているのは\"A cat has nine lives\" " +"—猫は9つの命を持つ—ということわざに由来します。)" #: src/traits/trait-objects.md:79 msgid "Compare these outputs in the above example:" @@ -8368,7 +8371,11 @@ msgid "" "some trait, so that you can call this trait's methods." msgstr "" "ジェネリクスを用いるとき、あるトレイトのメソッドを呼び出せるように、型がその" -"トレイトを実装していることを要求したいことがよくあります。" +"トレイトを実装していることを要求したいことがよくあります。(脚注:本教材では" +"\"Trait bounds\"を「トレイト境界」と翻訳しましたが、Rustの日本語翻訳コミュニ" +"ティでは「トレイト制約」と呼ぶ流派もあり、どちらの翻訳を採用するかについては" +"[議論がなされています](https://github.com/rust-lang-ja/book-ja/" +"issues/172)。)" #: src/traits/trait-bounds.md:6 msgid "You can do this with `T: Trait` or `impl Trait`:" @@ -8501,9 +8508,9 @@ msgid "" "implements the trait, without naming the type. This can be useful when you " "don't want to expose the concrete type in a public API." msgstr "" -"返り値の型に用いる場合は、具体的な型名を明示せずに特定のトレイトを実装する何" -"らかの具象型を返すということを意味します。このことは公開されるAPIに具象型を晒" -"したくない場合に便利です。" +"返り値の型に用いる場合は、特定のトレイトを実装する何らかの具象型を返すが、具" +"体的な型名は明示しないということを意味します。このことは公開されるAPIに具象型" +"を晒したくない場合に便利です。" #: src/traits/impl-trait.md:31 msgid "" From addcf29c3ee58ac7ddb6af42194e528ca5d63e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kanta=20Yamaoka=20=28=E5=B1=B1=E5=B2=A1=E5=B9=B9=E5=A4=AA?= =?UTF-8?q?=29?= <49053649+kantasv@users.noreply.github.com> Date: Tue, 14 Nov 2023 08:09:45 +0900 Subject: [PATCH 8/8] ja: ch25 tiny wording fix suggested by @chikoski --- po/ja.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/po/ja.po b/po/ja.po index 04a1b1512733..9598af976505 100644 --- a/po/ja.po +++ b/po/ja.po @@ -469,7 +469,7 @@ msgstr "デフォルトメソッド" #: src/SUMMARY.md:144 src/traits/trait-bounds.md:1 msgid "Trait Bounds" -msgstr "トレイト境界" +msgstr "トレイト制約" #: src/SUMMARY.md:145 msgid "impl Trait" @@ -8009,7 +8009,7 @@ msgid "" "Rust lets you abstract over types with traits. They're similar to interfaces:" msgstr "" "Rustでは、型に関しての抽象化をトレイトを用いて行うことができます。トレイトは" -"interfaceに似ています:" +"インターフェースに似ています:" #: src/traits.md:5 msgid "" @@ -8372,8 +8372,8 @@ msgid "" msgstr "" "ジェネリクスを用いるとき、あるトレイトのメソッドを呼び出せるように、型がその" "トレイトを実装していることを要求したいことがよくあります。(脚注:本教材では" -"\"Trait bounds\"を「トレイト境界」と翻訳しましたが、Rustの日本語翻訳コミュニ" -"ティでは「トレイト制約」と呼ぶ流派もあり、どちらの翻訳を採用するかについては" +"\"Trait bounds\"を「トレイト制約」と翻訳しましたが、Rustの日本語翻訳コミュニ" +"ティでは「トレイト境界」と呼ぶ流派もあり、どちらの翻訳を採用するかについては" "[議論がなされています](https://github.com/rust-lang-ja/book-ja/" "issues/172)。)"