-
Notifications
You must be signed in to change notification settings - Fork 10
turbo reference event: updated translation #198
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
base: main
Are you sure you want to change the base?
turbo reference event: updated translation #198
Conversation
b3371dc to
cd9e32b
Compare
It will be fixed at hotwired/turbo-site#230
7a23128 to
a5ac0a0
Compare
|
|
||
| ### `turbo:visit` | ||
|
|
||
| ページ遷移が開始された直後に発火します。`event.detail.url` でリクエストされたロケーションと `event.detail.action` でページ遷移のアクションを取得できます。 |
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.
を、で繋いだほうがわかりやすいかもと思いました
| ページ遷移が開始された直後に発火します。`event.detail.url` でリクエストされたロケーションと `event.detail.action` でページ遷移のアクションを取得できます。 | |
| ページ遷移が開始された直後に発火します。`event.detail.url` でリクエストされたロケーションを、 `event.detail.action` でページ遷移のアクションを取得できます。 |
|
|
||
| ### `turbo:before-visit` | ||
|
|
||
| あるロケーションに移動する前に発火します(ただし、履歴操作によるナビゲーション時は除きます)。`event.detail.url` からリクエスト先のロケーションを取得できます。このイベントをキャンセルすると、ナビゲーションが行われなくなります。 |
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.
原文と言葉のニュアンスが若干変わりそうですが、
turbo:visitと合わせて、「ページ遷移が開始される直前に発火します」とかもありです?
| | `renderMethod` | `"replace" \| "morph"` | 新しいコンテンツを描画するときに使われる方式 | ||
| | `newBody` | [HTMLBodyElement][] | 現在の `<body>` 要素を置き換える新しい `<body>` 要素 | ||
| | `resume` | `(value?: any) => void` | [描画の一時停止][] 時に呼び出す関数 | ||
| | `render` | `(currentBody, newBody) => void`| [描画処理をカスタマイズする][] 用に既存の描画処理をカスタマイズする関数 |
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.
このままでも伝わりますが、説明が重複しているような気がしました。
よりシンプルにするのであれば、既存の[描画処理をカスタマイズする][]ための関数とか、もう少し説明を足すのであれば、[描画処理をカスタマイズする][] ために既存の描画処理を上書きする関数の方がしっくりくるかなと思いました。
|
|
||
| ### `turbo:before-render` | ||
|
|
||
| ページの描画前に発火します。新しい `<body>` 要素は `event.detail.newBody` から取得できます。描画は `event.detail.resume` を使って停止および再開ができます(詳細は [描画の一時停止][] を参照)。さらに、Turbo ドライブがレスポンスを描画する方法は、`event.detail.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.
最後の一文の表現がちょっと気になったので、文章の前後を入れ替えて少し自然な感じにしてみました
| ページの描画前に発火します。新しい `<body>` 要素は `event.detail.newBody` から取得できます。描画は `event.detail.resume` を使って停止および再開ができます(詳細は [描画の一時停止][] を参照)。さらに、Turbo ドライブがレスポンスを描画する方法は、`event.detail.render` 関数を上書きしてカスタマイズできます(詳細は [描画処理をカスタマイズする][] を参照)。 | |
| ページの描画前に発火します。新しい `<body>` 要素は `event.detail.newBody` から取得できます。描画は `event.detail.resume` を使って停止および再開ができます(詳細は [描画の一時停止][] を参照)。さらに `event.detail.render` 関数を上書きすることで、Turbo ドライブのレスポンス描画処理をカスタマイズできます(詳細は [描画処理をカスタマイズする][] を参照)。 |
| ### `turbo:submit-end` | ||
|
|
||
| フォーム送信によって開始されたネットワークリクエストが完了した後に発火します。 | ||
| `event.detail.formSubmission` で [FormSubmission][] オブジェクトにアクセスでき、`event.detail` 内の各プロパティを参照できます。 |
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.
FormSubmission オブジェクトから event.detail にアクセスできる??のような読み方をしてしまいました。以下のような形で並列に書くというのはいかがでしょうか。
| `event.detail.formSubmission` で [FormSubmission][] オブジェクトにアクセスでき、`event.detail` 内の各プロパティを参照できます。 | |
| `event.detail.formSubmission` で [FormSubmission][] オブジェクトにアクセスでき、その他のプロパティは `event.detail` からアクセスできます。 |
GitHub: GH-181