element with the `Hello` text inside + const newNode = document.createElement('p'); + newNode.innerHTML = 'Hello'; + + // Insert the
before the first element. Since Angular has no information + // about the
element, it will be looking for the
element. + this.hostElement.insertBefore(newNode, this.hostElement.firstChild); + } +} +``` + +## Debugging the error + +The error message in the developer console should contain information on a specific part of the application's DOM structure that is causing the problem. Review that part of the application for hydration-related errors, such as direct DOM manipulation using native APIs. + +Check that your template has valid HTML structure. See more information in the [hydration guide](guide/hydration#valid-html-structure). + +You can add the `ngSkipHydration` attribute to your component host node as a possible workaround. + +If your application works in development environment, but you see hydration errors in production builds, make sure that the generated HTML that is delivered to a browser contains comment nodes produced by Angular during the rendering on the server. Those comment nodes are used by Angular runtime as anchors for view containers (with and without hydration) and hydration process expects them to be present at their original locations. If you have a custom logic to remove comment nodes from the HTML generated by the server-side rendering or you've configured your CDN to remove them before serving the content - disable the comment nodes removal and check if hydration errors are gone. diff --git a/adev-ja/src/content/reference/errors/NG0500.md b/adev-ja/src/content/reference/errors/NG0500.md index a8ffd8aa3..2d301de68 100644 --- a/adev-ja/src/content/reference/errors/NG0500.md +++ b/adev-ja/src/content/reference/errors/NG0500.md @@ -1,12 +1,12 @@ # Hydration Node Mismatch -This error means that during the hydration process, Angular expected a DOM structure as rendered and annotated during server-side rendering. However, on the client, the DOM tree was different than the server rendered DOM tree. +このエラーは、ハイドレーションプロセス中に、Angularがサーバーサイドレンダリング時にレンダリングおよび注釈付けされたDOM構造を期待していることを意味します。ただし、クライアント側では、DOMツリーがサーバー側でレンダリングされたDOMツリーとは異なるものでした。 -This error typically happens due to direct DOM manipulation using native browser APIs that alter the DOM structure outside of what Angular produced. It will also occur if you use `innerHTML` or `outerHTML` to set HTML content, which similarly alters the DOM structure outside of what Angular produced. You can resolve this by refactoring the component to use native Angular APIs instead of native APIs. If that's not possible, you can add the `ngSkipHydration` attribute to your component's host node, which will disable hydration for the component and its children. `ngSkipHydration` should only be used as a last resort and should be considered a bug that needs to be fixed. +このエラーは、通常、Angularが生成したものを超えてDOM構造を変更するネイティブブラウザAPIを使用した直接的なDOM操作によって発生します。同様に、Angularが生成したものを超えてDOM構造を変更する `innerHTML` または `outerHTML` を使用してHTMLコンテンツを設定した場合にも発生します。ネイティブAPIの代わりにネイティブAngular APIを使用するようにコンポーネントをリファクタリングすることで、これを解決できます。それが不可能な場合は、コンポーネントのホストノードに `ngSkipHydration` 属性を追加できます。これにより、コンポーネントとその子のハイドレーションが無効になります。`ngSkipHydration` は、最後の手段としてのみ使用し、修正が必要なバグとして扱う必要があります。 -More information about hydration can be found in [this guide](guide/hydration). +ハイドレーションの詳細については、[このガイド](guide/hydration)を参照してください。 -The following example will trigger the error. +次の例では、エラーが発生します。 ```typescript @Component({ @@ -18,25 +18,25 @@ export class ExampleComponent { hostElement = inject(ElementRef).nativeElement; ngOnInit() { - // Create a new
element with the `Hello` text inside + // `Hello` テキストを含む新しい
要素を作成する const newNode = document.createElement('p'); newNode.innerHTML = 'Hello'; - // Insert the
before the first element. Since Angular has no information - // about the
element, it will be looking for the
element. - this.hostElement.insertBefore(newNode, this.hostElement.firstChild); - } + //
要素を最初の要素の前に挿入します。Angular に
要素に関する情報がないため、 + // 最初の要素の位置で
要素を作成します。
+ this.hostElement.insertBefore(newNode, this.hostElement.firstChild);
+ }
}
```
-## Debugging the error
+## エラーのデバッグ
-The error message in the developer console should contain information on a specific part of the application's DOM structure that is causing the problem. Review that part of the application for hydration-related errors, such as direct DOM manipulation using native APIs.
+開発者コンソール内のエラーメッセージには、問題を引き起こしているアプリケーションのDOM構造の特定の部分に関する情報が含まれているはずです。ネイティブAPIを使用した直接的なDOM操作など、ハイドレーション関連のエラーについて、アプリケーションのその部分を確認します。
-Check that your template has valid HTML structure. See more information in the [hydration guide](guide/hydration#valid-html-structure).
+テンプレートが有効なHTML構造であることを確認します。[Hydration ガイド](guide/hydration#valid-html-structure)で詳細を確認してください。
-You can add the `ngSkipHydration` attribute to your component host node as a possible workaround.
+コンポーネントのホストノードに `ngSkipHydration` 属性を追加することで、回避策として使用できます。
-If your application works in development environment, but you see hydration errors in production builds, make sure that the generated HTML that is delivered to a browser contains comment nodes produced by Angular during the rendering on the server. Those comment nodes are used by Angular runtime as anchors for view containers (with and without hydration) and hydration process expects them to be present at their original locations. If you have a custom logic to remove comment nodes from the HTML generated by the server-side rendering or you've configured your CDN to remove them before serving the content - disable the comment nodes removal and check if hydration errors are gone.
+アプリケーションが開発環境では動作するが、本番ビルドで ハイドレーション エラーが発生する場合は、ブラウザに配信される生成されたHTMLに、サーバーでのレンダリング中にAngularによって生成されたコメントノードが含まれていることを確認してください。これらのコメントノードは、Angularランタイムによってビューコンテナのアンカー (ハイドレーション の有無にかかわらず) として使用され、ハイドレーション プロセスでは、これらのノードが元の位置に存在することを期待します。サーバーサイドレンダリングによって生成されたHTMLからコメントノードを削除するカスタムロジックがある場合、またはCDNを構成してコンテンツを提供する前にコメントノードを削除した場合、コメントノードの削除を無効にして、ハイドレーション エラーが解消されるかどうかを確認してください。
diff --git a/adev-ja/src/content/reference/errors/NG05000.en.md b/adev-ja/src/content/reference/errors/NG05000.en.md
new file mode 100644
index 000000000..6e7f135b5
--- /dev/null
+++ b/adev-ja/src/content/reference/errors/NG05000.en.md
@@ -0,0 +1,11 @@
+# Hydration with unsupported Zone.js instance
+
+This warning means that the hydration was enabled for an application that was configured to use an unsupported version of Zone.js: either a custom or a "noop" one (see more info [here](api/core/BootstrapOptions#ngZone)).
+
+Hydration relies on a signal from Zone.js when it becomes stable inside an application, so that Angular can start the serialization process on the server or post-hydration cleanup on the client (to remove DOM nodes that remained unclaimed).
+
+Providing a custom or a "noop" Zone.js implementation may lead to a different timing of the "stable" event, thus triggering the serialization or the cleanup too early or too late. This is not yet a fully supported configuration.
+
+If you use a custom Zone.js implementation, make sure that the "onStable" event is emitted at the right time and does not result in incorrect application behavior with hydration.
+
+More information about hydration can be found in the [hydration guide](guide/hydration).
diff --git a/adev-ja/src/content/reference/errors/NG05000.md b/adev-ja/src/content/reference/errors/NG05000.md
index 6e7f135b5..2090ff36c 100644
--- a/adev-ja/src/content/reference/errors/NG05000.md
+++ b/adev-ja/src/content/reference/errors/NG05000.md
@@ -1,11 +1,11 @@
# Hydration with unsupported Zone.js instance
-This warning means that the hydration was enabled for an application that was configured to use an unsupported version of Zone.js: either a custom or a "noop" one (see more info [here](api/core/BootstrapOptions#ngZone)).
+この警告は、サポートされていないバージョンのZone.jsを使用するように構成されたアプリケーションに対してハイドレーションが有効になっていることを意味します。カスタムまたは「noop」のいずれかです(詳細については [こちら](api/core/BootstrapOptions#ngZone) を参照してください)。
-Hydration relies on a signal from Zone.js when it becomes stable inside an application, so that Angular can start the serialization process on the server or post-hydration cleanup on the client (to remove DOM nodes that remained unclaimed).
+ハイドレーションは、Zone.jsからアプリケーション内で安定した状態になったときのシグナルを必要とし、Angularはサーバーでのシリアル化プロセスを開始するか、クライアントでのハイドレーション後のクリーンアップ(主張されていないDOMノードを削除するため)を開始できます。
-Providing a custom or a "noop" Zone.js implementation may lead to a different timing of the "stable" event, thus triggering the serialization or the cleanup too early or too late. This is not yet a fully supported configuration.
+カスタムまたは「noop」のZone.js実装を提供すると、「stable」イベントのタイミングが異なり、シリアル化またはクリーンアップが早すぎるか遅すぎる場合があり、まだ完全にサポートされている構成ではありません。
-If you use a custom Zone.js implementation, make sure that the "onStable" event is emitted at the right time and does not result in incorrect application behavior with hydration.
+カスタムZone.js実装を使用する場合は、「onStable」イベントが適切なタイミングで発生し、ハイドレーションによるアプリケーション動作に誤りが発生しないことを確認してください。
-More information about hydration can be found in the [hydration guide](guide/hydration).
+ハイドレーションの詳細については、[Hydration ガイド](guide/hydration) を参照してください。
diff --git a/adev-ja/src/content/reference/errors/NG0501.en.md b/adev-ja/src/content/reference/errors/NG0501.en.md
new file mode 100644
index 000000000..d4904663f
--- /dev/null
+++ b/adev-ja/src/content/reference/errors/NG0501.en.md
@@ -0,0 +1,7 @@
+# Hydration Missing Siblings
+
+This error is similar to the [error NG0500](errors/NG0500), but it indicates that Angular hydration process expected more siblings present in the DOM structure at a particular location. Please refer to the [error NG0500](errors/NG0500) page for additional information.
+
+## Debugging the error
+
+See the [error NG0500](errors/NG0500) for more information on how to debug this error.
diff --git a/adev-ja/src/content/reference/errors/NG0501.md b/adev-ja/src/content/reference/errors/NG0501.md
index d4904663f..767c0d9c4 100644
--- a/adev-ja/src/content/reference/errors/NG0501.md
+++ b/adev-ja/src/content/reference/errors/NG0501.md
@@ -1,7 +1,7 @@
# Hydration Missing Siblings
-This error is similar to the [error NG0500](errors/NG0500), but it indicates that Angular hydration process expected more siblings present in the DOM structure at a particular location. Please refer to the [error NG0500](errors/NG0500) page for additional information.
+このエラーは、[error NG0500](errors/NG0500)と似ていますが、Angularのハイドレーションプロセスが特定の場所でDOM構造内に存在するはずの兄弟要素が不足していることを示しています。詳細については、[error NG0500](errors/NG0500)ページを参照してください。
-## Debugging the error
+## エラーのデバッグ
-See the [error NG0500](errors/NG0500) for more information on how to debug this error.
+このエラーのデバッグ方法については、[error NG0500](errors/NG0500)を参照してください。
diff --git a/adev-ja/src/content/reference/errors/NG0502.en.md b/adev-ja/src/content/reference/errors/NG0502.en.md
new file mode 100644
index 000000000..a0ba1df9a
--- /dev/null
+++ b/adev-ja/src/content/reference/errors/NG0502.en.md
@@ -0,0 +1,7 @@
+# Hydration Missing Node
+
+This error is similar to the [error NG0500](errors/NG0500), but it indicates that Angular hydration process expected a node to be present in the DOM structure at a particular location and none was found. Please refer to the [error NG0500](errors/NG0500) page for additional information.
+
+## Debugging the error
+
+See the [error NG0500](errors/NG0500) for more information on how to debug this error.
diff --git a/adev-ja/src/content/reference/errors/NG0502.md b/adev-ja/src/content/reference/errors/NG0502.md
index a0ba1df9a..254968ded 100644
--- a/adev-ja/src/content/reference/errors/NG0502.md
+++ b/adev-ja/src/content/reference/errors/NG0502.md
@@ -1,7 +1,7 @@
# Hydration Missing Node
-This error is similar to the [error NG0500](errors/NG0500), but it indicates that Angular hydration process expected a node to be present in the DOM structure at a particular location and none was found. Please refer to the [error NG0500](errors/NG0500) page for additional information.
+このエラーは [error NG0500](errors/NG0500) と似ていますが、Angularのハイドレーションプロセスで、特定の場所にDOM構造内にノードが存在することを期待していたのに、見つからなかったことを示しています。詳細については、[error NG0500](errors/NG0500) のページを参照してください。
-## Debugging the error
+## デバッグ
-See the [error NG0500](errors/NG0500) for more information on how to debug this error.
+このエラーのデバッグ方法の詳細については、[error NG0500](errors/NG0500) を参照してください。
diff --git a/adev-ja/src/content/reference/errors/NG0503.en.md b/adev-ja/src/content/reference/errors/NG0503.en.md
new file mode 100644
index 000000000..73f6b66a9
--- /dev/null
+++ b/adev-ja/src/content/reference/errors/NG0503.en.md
@@ -0,0 +1,47 @@
+# Hydration Unsupported Projection of DOM Nodes
+
+This error means that during the server-side serialization process, Angular encountered nodes that were created outside of Angular's context (i.e. using native DOM APIs) and found those nodes were provided as projectable nodes. They were likely provided using `ViewContainerRef.createComponent` or `createComponent` APIs. Angular hydration does not support this use case.
+
+More information about hydration can be found in [this guide](guide/hydration).
+
+The following examples will trigger the error.
+
+```typescript
+@Component({
+ standalone: true,
+ selector: 'dynamic',
+ template: `
+