Skip to content

Conversation

@otegami
Copy link
Collaborator

@otegami otegami commented Sep 18, 2025

GitHub: GH-181

@otegami otegami force-pushed the update-translation-turbo-reference-event branch from b3371dc to cd9e32b Compare November 5, 2025 10:49
@otegami otegami changed the title WIP turbo reference event: updated translation turbo reference event: updated translation Nov 9, 2025
@otegami otegami marked this pull request as ready for review November 9, 2025 02:36
@otegami otegami force-pushed the update-translation-turbo-reference-event branch from 7a23128 to a5ac0a0 Compare November 10, 2025 09:03

### `turbo:visit`

ページ遷移が開始された直後に発火します。`event.detail.url` でリクエストされたロケーションと `event.detail.action` でページ遷移のアクションを取得できます。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

を、で繋いだほうがわかりやすいかもと思いました

Suggested change
ページ遷移が開始された直後に発火します。`event.detail.url` でリクエストされたロケーションと `event.detail.action` でページ遷移のアクションを取得できます。
ページ遷移が開始された直後に発火します。`event.detail.url` でリクエストされたロケーションを、 `event.detail.action` でページ遷移のアクションを取得できます。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: 4241a4b


### `turbo:before-visit`

あるロケーションに移動する前に発火します(ただし、履歴操作によるナビゲーション時は除きます)。`event.detail.url` からリクエスト先のロケーションを取得できます。このイベントをキャンセルすると、ナビゲーションが行われなくなります。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原文と言葉のニュアンスが若干変わりそうですが、
turbo:visitと合わせて、「ページ遷移が開始される直前に発火します」とかもありです?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: d24d444

| `renderMethod` | `"replace" \| "morph"` | 新しいコンテンツを描画するときに使われる方式
| `newBody` | [HTMLBodyElement][] | 現在の `<body>` 要素を置き換える新しい `<body>` 要素
| `resume` | `(value?: any) => void` | [描画の一時停止][] 時に呼び出す関数
| `render` | `(currentBody, newBody) => void`| [描画処理をカスタマイズする][] 用に既存の描画処理をカスタマイズする関数
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このままでも伝わりますが、説明が重複しているような気がしました。
よりシンプルにするのであれば、既存の[描画処理をカスタマイズする][]ための関数とか、もう少し説明を足すのであれば、[描画処理をカスタマイズする][] ために既存の描画処理を上書きする関数の方がしっくりくるかなと思いました。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: 0169b39


### `turbo:before-render`

ページの描画前に発火します。新しい `<body>` 要素は `event.detail.newBody` から取得できます。描画は `event.detail.resume` を使って停止および再開ができます(詳細は [描画の一時停止][] を参照)。さらに、Turbo ドライブがレスポンスを描画する方法は、`event.detail.render` 関数を上書きしてカスタマイズできます(詳細は [描画処理をカスタマイズする][] を参照)。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最後の一文の表現がちょっと気になったので、文章の前後を入れ替えて少し自然な感じにしてみました

Suggested change
ページの描画前に発火します。新しい `<body>` 要素は `event.detail.newBody` から取得できます。描画は `event.detail.resume` を使って停止および再開ができます(詳細は [描画の一時停止][] を参照)。さらに、Turbo ドライブがレスポンスを描画する方法は、`event.detail.render` 関数を上書きしてカスタマイズできます(詳細は [描画処理をカスタマイズする][] を参照)。
ページの描画前に発火します。新しい `<body>` 要素は `event.detail.newBody` から取得できます。描画は `event.detail.resume` を使って停止および再開ができます(詳細は [描画の一時停止][] を参照)。さらに `event.detail.render` 関数を上書きすることで、Turbo ドライブのレスポンス描画処理をカスタマイズできます(詳細は [描画処理をカスタマイズする][] を参照)。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: 576b20b

### `turbo:submit-end`

フォーム送信によって開始されたネットワークリクエストが完了した後に発火します。
`event.detail.formSubmission`[FormSubmission][] オブジェクトにアクセスでき、`event.detail` 内の各プロパティを参照できます。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FormSubmission オブジェクトから event.detail にアクセスできる??のような読み方をしてしまいました。以下のような形で並列に書くというのはいかがでしょうか。

Suggested change
`event.detail.formSubmission`[FormSubmission][] オブジェクトにアクセスでき、`event.detail` 内の各プロパティを参照できます
`event.detail.formSubmission`[FormSubmission][] オブジェクトにアクセスでき、その他のプロパティは `event.detail` からアクセスできます

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: 2859233

@otegami
Copy link
Collaborator Author

otegami commented Jan 15, 2026

レビューありがとうございます!上から対応していきます 🙏🏾

@otegami
Copy link
Collaborator Author

otegami commented Jan 15, 2026

ここまで頂いたレビューコメントの対応を行いました。


- ナビゲーション中の `<turbo-frame>`
- 送信中の `<form>`
- ページ全体の Turbo ビジット中の `<html>` 要素
Copy link
Contributor

@akira888 akira888 Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ビジットは遷移とかで統一していた気がするので、以下のような感じはいかがでしょうか

Suggested change
- ページ全体の Turbo ビジット中の `<html>` 要素
- ページ全体を対象とした Turbo 遷移中の `<html>` 要素
もしくは
- Turbo によるページ遷移中の `<html>` 要素

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: f669c33 ありがとうございます。同じように Turbo Visit について言及している部分も修正しました 🙏🏾

@otegami
Copy link
Collaborator Author

otegami commented Jan 16, 2026

ここまで頂いたレビューコメントの対応を行いました。

Copy link
Contributor

@akira888 akira888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMです!ボリュームの大きい修正をありがとうございました 🙏🏻

@akira888 akira888 requested a review from n-hagiwara January 16, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants