-
Notifications
You must be signed in to change notification settings - Fork 181
Polish "Adding Interacrtivity" and pages below #666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Size changes📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
助かります。まだ draft のようですのでレビューはしませんが、多分 95% くらいはそのまま採用する感じになりそうです。 |
|
||
</YouWillLearn> | ||
|
||
コンポーネントは厨房で材料から美味しい料理を作る料理人だと想像してください。このシナリオでは React はお客様のリクエストを受け付け、注文された料理を運ぶウェイターです。注文を受けて UI 要素を「配膳」するプロセスには、次の 3 つのステップが存在します: | ||
コンポーネントが料理人として厨房に立ち、食材を調理して美味しい料理を作っている様子をイメージしてみてください。このシナリオにおいて React はウェイターです。お客様の注文を伝えて、できた料理をお客様に渡します。この UI の「注文」と「提供」のプロセスは、次の 3 つのステップからなります: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「注文を受けて」 → 「お客様の注文を伝えて」と変更しました。
原文の「puts in request from customers」は「(厨房に)お客様の注文を伝える」と訳すのが正しいはず。
|
||
</Pitfall> | ||
|
||
<DeepDive> | ||
|
||
#### パフォーマンスの最適化 {/*optimizing-performance*/} | ||
|
||
更新されたコンポーネントがツリー内で非常に高い位置にある場合、その内部にネストされたすべてのコンポーネントを再レンダーするというデフォルトの挙動は、パフォーマンスにとって理想的ではありません。パフォーマンスの問題に遭遇した場合、[パフォーマンス](https://reactjs.org/docs/optimizing-performance.html)セクションで述べられているいくつかのオプトインによる解決方法があります。**最適化は急いでやってはいけません!** | ||
更新されたコンポーネントがツリー内で非常に高い位置にある場合、その内部にネストされたすべてのコンポーネントを再レンダーするというデフォルトの挙動は、パフォーマンスにとって理想的ではありません。パフォーマンスの問題に遭遇した場合、[パフォーマンス](https://reactjs.org/docs/optimizing-performance.html)セクションで述べられているいくつかのオプトインによる解決方法があります。**早まった最適化をしてしまってはいけません!** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"premature optimization" は 「早まった最適化」あるいは「時期尚早な最適化」と訳されるのが一般的なので、前者を踏まえた訳にしました。
@@ -312,7 +312,7 @@ button { margin-right: 10px; } | |||
|
|||
</Sandpack> | |||
|
|||
`App` コンポーネントは、`Toolbar` が `onPlayMovie` や `onUploadImage` に対して*何*を行うかを知る必要がないことに注意してください。それは `Toolbar` の実装の詳細です。ここでは、`Toolbar` はそれらを `Button` の `onClick` ハンドラとして渡していますが、後でキーボードショートカットでもそれらをトリガするようにすることができます。`onPlayMovie` のようなアプリ固有のインタラクションに基づいて props を名付けることで、後でどのように使用されるかを変更できるという柔軟性が得られます。 | |||
`Toolbar` が `onPlayMovie` や `onUploadImage` を*どう扱う*のかを、`App` コンポーネントが知る必要がないことに注意してください。それは `Toolbar` の実装の詳細です。ここでは、`Toolbar` はそれらを `Button` の `onClick` ハンドラとして渡していますが、後でキーボードショートカットでもそれらをトリガするようにすることができます。`onPlayMovie` のようなアプリ固有のインタラクションに基づいて props を名付けることで、後でどのように使用されるかを変更できるという柔軟性が得られます。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コールバック引数を目的語とすると違和感のある表現だったので、「に対して何を行うか」→「をどう扱うか」に変更しました。
@@ -511,7 +511,7 @@ button { margin-left: 5px; } | |||
|
|||
</Sandpack> | |||
|
|||
`e.stopPropagation()` と `e.preventDefault()` を混同しないでください。どちらも有用ですが、無関係です。 | |||
`e.stopPropagation()` と `e.preventDefault()` を混同しないでください。どちらも有用ですが、両者は無関係です。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「無関係」だと、「共にいま述べているトピックとは無関係」のようなニュアンスがしてしまうので「両者は」を補いました。
1. レンダーの**トリガ**(お客様の注文を厨房に伝える) | ||
2. コンポーネントの**レンダー**(厨房で注文の品を料理する) | ||
3. DOM への**コミット**(テーブルに注文の品を提供する) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここをはじめ、 以下の単語は日本語に訳すときに「レストランでの行為」という文脈を踏まえて訳さないといけないので、かなり大胆に訳を見直しています。
- 「料理する」
- assemble dishes / prepare
- 「注文品 / できた料理」
- order
- 「注文(する行為 / の内容)」
- request / order
- order は「注文品」のほうの意味でも使われる
- 「提供する」
- serve / deliver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「注文の品」については完全に仰るとおりです…
<Illustration caption="state の更新が..." alt="レストランのウェイター役の React が Card UI を提供したところ。矢印頭の顧客は、黒ではなく、ピンクのカードが欲しいのだと注文している。" src="/images/docs/illustrations/i_rerender1.png" /> | ||
<Illustration caption="... トリガになって ..." alt="React はコンポーネントの厨房に戻り、ピンクの Card が必要だと Card シェフに伝える。" src="/images/docs/illustrations/i_rerender2.png" /> | ||
<Illustration caption="... レンダーされる!" alt="Card シェフはピンクのカードを React に渡している。" src="/images/docs/illustrations/i_rerender3.png" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"State update / triggers / render." (ステートの更新がレンダーをトリガする)
の意味を保ったままで、日本語として無理のない語順に言い換えてみました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。自分では問題に気づけないもんですね…。
数カ所だけ確認いただけますでしょうか。
1. レンダーの**トリガ**(お客様の注文を厨房に伝える) | ||
2. コンポーネントの**レンダー**(厨房で注文の品を料理する) | ||
3. DOM への**コミット**(テーブルに注文の品を提供する) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「注文の品」については完全に仰るとおりです…
Co-authored-by: Soichiro Miki <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion 取り込みました!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございました!
大変だとは思いますが、お時間があるのであれば他の部分もガンガン変えていただいて大丈夫です!
了解です! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ありがとうございます!
Adding Interactivity 以下で、伝わりにくくなっている表現および、ページ間で不整合がある箇所を改善しました。
Instead of doing の訳しかた見直し
「A する代わりに B する」には、「A しない。その代替として B する。」だけでなく、「A することの代償として B する。」という解釈の余地が残ると思います。解釈の曖昧さを排すれば楽に読めることに繋がりそうなので、「A せず、(代わりに) B する」のような明示的な表現に改めました。
長い修飾語の読みとりにくさを改善
「主語 + 動詞句を含む長い修飾語 + 述語」 の形だと構文を読み取りづらいので、適当な接続語を補って 「主語 + 述語 + "であり、" + 長い説明」 のような構文に書き換えました。
例: Before
After
連用修飾か連体修飾か
英文の前置詞を連用修飾として訳すべきところを、誤って連体修飾として誤訳になっていると見られる(あるいはその逆)箇所がいくつかあったので、正しいと思われるほうに修正しました。
訳の揺れを少し直しました