-
Notifications
You must be signed in to change notification settings - Fork 183
Translate react-dom #45
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
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.
ありがとうございます 👍
ほとんど、スタイルに関する指摘です。修正よろしくお願いします。
LGTM 🚀 |
見返して気づいた修正点を少し修正しました。 |
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.
@gotchane レビューしましたので確認お願いします 🙇
hydrateについては、「クライアントと合わせる」という訳から「クライアントで再利用する」に変えましたが、これについては他の方の意見も聞きたいです。
Co-Authored-By: gotchane <20318418+gotchane@users.noreply.github.com>
@koba04 |
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.
確認をお願いします。
hydrate は直訳すると「水分を与える」(水素 hydrogen と同じ語源)ですが、要するに「入れ物(コンテナdiv)に中身を注ぐ」、もっと端的に言うとSSRにおいては単にコンテナに(HTMLに変換される)コンテンツを書き込むことだと思います。hydrate 自体に「再利用する」という意味はありません。しかも SSR 特有の単語かと思いきや、クライアント側のコードの render に対してまで hydrate を使っている文が2か所あり(これは原文が不親切)、その場合は「(初回)レンダー」と換言しても問題ないと思います。
> | ||
> Using `ReactDOM.render()` to hydrate a server-rendered container is deprecated and will be removed in React 17. Use [`hydrate()`](#hydrate) instead. | ||
> サーバで描画されたコンテナをクライアントで再利用するために `ReactDOM.render()` を使用することは非推奨となり、React 17 では削除されます。代わりに [`hydrate()`](#hydrate) を使用してください。 |
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.
> サーバで描画されたコンテナをクライアントで再利用するために `ReactDOM.render()` を使用することは非推奨となり、React 17 では削除されます。代わりに [`hydrate()`](#hydrate) を使用してください。 | |
> サーバで描画されたコンテナにコンテンツを書き込むために `ReactDOM.render()` を使用することは非推奨となり、React 17 では削除されます。代わりに [`hydrate()`](#hydrate) を使用してください。 |
原文に近づけたつもりですが、これはどちらでもいいです
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.
こちらは挙動のイメージのしやすさを踏まえ、「再利用する」のままにしますね。
@@ -62,15 +62,15 @@ If the optional callback is provided, it will be executed after the component is | |||
ReactDOM.hydrate(element, container[, callback]) | |||
``` | |||
|
|||
Same as [`render()`](#render), but is used to hydrate a container whose HTML contents were rendered by [`ReactDOMServer`](/docs/react-dom-server.html). React will attempt to attach event listeners to the existing markup. | |||
[`render()`](#render) と同様ですが、[`ReactDOMServer`](/docs/react-dom-server.html) により HTML コンテンツが描画されたコンテナをクライアントで再利用するために使用されます。React は既存のマークアップにイベントリスナをアタッチしようとします。 |
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.
[`render()`](#render) と同様ですが、[`ReactDOMServer`](/docs/react-dom-server.html) により HTML コンテンツが描画されたコンテナをクライアントで再利用するために使用されます。React は既存のマークアップにイベントリスナをアタッチしようとします。 | |
[`render()`](#render) と同様ですが、[`ReactDOMServer`](/docs/react-dom-server.html) によって HTML コンテンツが描画されるコンテナに書き込むために使用されます。React は既存のマークアップにイベントリスナをアタッチしようとします。 |
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.
「書き込む」だと、ReactDOM.hydrate()
のタイミングで何か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.
すみません SSR は殆ど素人なので実際の挙動に合っているようでしたら元の文で大丈夫です
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.
こちらも同様、「再利用する」のままにします!
hydrateについては、SSRで構築されたDOMに「動きを与える」(React Elementを構築してイベントリストを設定するなど)と理解しています。 |
なるほど、hydrate とは render の一部なんですね…とりあえずクライアントの render を指している部分についての修正ができていれば、SSR側については分かりやすく訳せていれば大丈夫だと思います。 |
Co-Authored-By: gotchane <20318418+gotchane@users.noreply.github.com>
@gotchane mergeしました 🚀 ありがとうございます 👏👏👏 |
ありがとうございました 🚀 🚀 🚀 |
This PR is a part of #4.
Translation: https://reactjs.org/docs/react-dom.html
Please review 🙏