Skip to content

Commit 8475045

Browse files
authored
feat(docs): translate guide/templates/error-boundaries to Japanese (#1208)
* feat(docs): translate guide/templates/error-boundaries to Japanese * chore(prh): unify バウンダリ notation * chore(prh): unify 開発者プレビュー notation * fix(docs): reduce demonstratives in error-boundaries translation
1 parent 9729ae2 commit 8475045

5 files changed

Lines changed: 142 additions & 24 deletions

File tree

‎adev-ja/src/app/routing/navigation-entries/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export const DOCS_SUB_NAVIGATION_DATA: NavigationItem[] = [
257257
contentPath: 'guide/templates/defer',
258258
},
259259
{
260-
label: 'Error boundaries with @boundary',
260+
label: '@boundaryによるエラーバウンダリ',
261261
path: 'guide/templates/error-boundaries',
262262
contentPath: 'guide/templates/error-boundaries',
263263
status: 'new',

‎adev-ja/src/content/guide/routing/route-transition-animations.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ルート遷移アニメーションは、Angularアプリケーション内の異なるビュー間を移動する際にスムーズな視覚的遷移を提供することで、ユーザー体験を向上させます。[Angular Router](/guide/routing)は、ブラウザのView Transitions APIの組み込みサポートを含んでおり、サポートされているブラウザでルート変更間のシームレスなアニメーションを可能にします。
44

5-
HELPFUL: RouterのネイティブView Transitions統合は現在[デベロッパープレビュー](/reference/releases#developer-preview)中です。ネイティブView Transitionsは比較的新しいブラウザ機能であり、すべてのブラウザでのサポートは限られています。
5+
HELPFUL: RouterのネイティブView Transitions統合は現在[開発者プレビュー](/reference/releases#developer-preview)中です。ネイティブView Transitionsは比較的新しいブラウザ機能であり、すべてのブラウザでのサポートは限られています。
66

77
## Viewトランジションの仕組み {#how-view-transitions-work}
88

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Error boundaries with `@boundary`
2+
3+
IMPORTANT: `@boundary` is in [developer preview](reference/releases#developer-preview).
4+
5+
Angular templates support error boundaries to gracefully handle runtime errors that occur during rendering and change detection.
6+
7+
Error boundaries prevent a single component's failure from crashing the entire application and provide a way to display fallback UI to the user.
8+
9+
## Catching errors with `@boundary` and `@error`
10+
11+
The `@boundary` block wraps a section of your template. If any component or directive inside this boundary throws an error during initialization or change detection, the framework catches the error and renders the `@error` block instead.
12+
13+
```angular-html
14+
@boundary {
15+
<app-risky-component />
16+
} @error {
17+
<p>Something went wrong!</p>
18+
}
19+
```
20+
21+
## Accessing the error object
22+
23+
You can access the caught error by accessing the implicit `$error` variable:
24+
25+
```angular-html
26+
@boundary {
27+
<app-risky-component />
28+
} @error {
29+
<p>Error occurred: {{ $error.message }}</p>
30+
}
31+
```
32+
33+
## Resetting the boundary
34+
35+
You can attempt to re-render the content of the `@boundary` by calling the implicit `$reset` function in the `@error` block. When called, it resets the boundary state and tries to render the original content again.
36+
37+
```angular-html
38+
@boundary {
39+
<app-flaky-component />
40+
} @error {
41+
<p>Loading failed.</p>
42+
<button (click)="$reset()">Try again</button>
43+
}
44+
```
45+
46+
## Conditional error handling with `when`
47+
48+
You can use `when` clauses to conditionally handle specific types of errors, allowing you to provide different fallback UIs. Angular evaluates this condition when it catches an error.
49+
50+
```angular-html
51+
@boundary {
52+
<app-chart-dashboard />
53+
} @error (let err; reset = $reset; when isRenderError(err)) {
54+
<p>Network issue. Check your connection.</p>
55+
<button (click)="reset()">Retry</button>
56+
} @error {
57+
<p>An unexpected error occurred: {{ $error.message }}</p>
58+
}
59+
```
60+
61+
Order your `@error` blocks from most specific to least specific, as Angular evaluates the `when` clauses in order and uses the first one that evaluates to true. A final `@error` block without a `when` clause acts as a catch-all fallback.
62+
63+
## Global error handler integration
64+
65+
When a boundary catches an error, Angular can still notify the global `ErrorHandler`. You can implement the optional `onViewError` hook in your custom `ErrorHandler` to log these caught errors to your error tracking service.
66+
67+
```ts
68+
@Injectable()
69+
export class MyErrorHandler implements ErrorHandler {
70+
handleError(error: any): void {
71+
// Handle uncaught errors
72+
}
73+
74+
onViewError(error: Error, details: ErrorDetails): void {
75+
// Handle errors caught by a @boundary
76+
console.warn('Caught by boundary:', details.boundary);
77+
myErrorTrackingService.log(error);
78+
}
79+
}
80+
```
81+
82+
IMPORTANT: If an `@error` block itself throws an error, the error propagates to the next outer `@boundary` or Angular treats it as an unhandled application error.
83+
84+
## Content projection
85+
86+
If your component uses [content projection](guide/components/content-projection), wrapping `<ng-content>` in a `@boundary` does not catch errors from projected content. That content belongs to the view that declares it, not the receiving component's view.
87+
88+
For example, a wrapper component with the following template does not catch errors from components projected into it:
89+
90+
```angular-html {avoid}
91+
@boundary {
92+
<ng-content />
93+
} @error {
94+
<p>Something went wrong!</p>
95+
}
96+
```
97+
98+
To catch those errors, wrap the wrapper component and its projected content in a `@boundary` in the parent template:
99+
100+
```angular-html {prefer}
101+
@boundary {
102+
<app-wrapper>
103+
<app-risky-component />
104+
</app-wrapper>
105+
} @error {
106+
<p>Something went wrong!</p>
107+
}
108+
```
109+
110+
## Dynamic views and programmatic error handling
111+
112+
Error handling isn't limited to template syntax. If you are creating components or embedded views dynamically, you can use the `onError` option to handle errors. See the [Handling rendering errors](guide/components/programmatic-rendering#handling-rendering-errors) section in the programmatic rendering guide for more information.

‎adev-ja/src/content/guide/templates/error-boundaries.md‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Error boundaries with `@boundary`
1+
# `@boundary`によるエラーバウンダリ
22

3-
IMPORTANT: `@boundary` is in [developer preview](reference/releases#developer-preview).
3+
IMPORTANT: `@boundary`は[開発者プレビュー](reference/releases#developer-preview)です。
44

5-
Angular templates support error boundaries to gracefully handle runtime errors that occur during rendering and change detection.
5+
Angularテンプレートは、レンダリングや変更検知中に発生するランタイムエラーを適切に処理するためのエラーバウンダリをサポートしています。
66

7-
Error boundaries prevent a single component's failure from crashing the entire application and provide a way to display fallback UI to the user.
7+
エラーバウンダリは、単一のコンポーネントの障害によってアプリケーション全体がクラッシュするのを防ぎ、ユーザーにフォールバックUIを表示する方法を提供します。
88

9-
## Catching errors with `@boundary` and `@error`
9+
## `@boundary`と`@error`によるエラーの捕捉 {#catching-errors-with-boundary-and-error}
1010

11-
The `@boundary` block wraps a section of your template. If any component or directive inside this boundary throws an error during initialization or change detection, the framework catches the error and renders the `@error` block instead.
11+
`@boundary`ブロックはテンプレートの一部をラップします。このバウンダリ内のコンポーネントやディレクティブが初期化または変更検知中にエラーをスローした場合、フレームワークはそのエラーを捕捉し、代わりに`@error`ブロックをレンダリングします。
1212

1313
```angular-html
1414
@boundary {
@@ -18,9 +18,9 @@ The `@boundary` block wraps a section of your template. If any component or dire
1818
}
1919
```
2020

21-
## Accessing the error object
21+
## エラーオブジェクトへのアクセス {#accessing-the-error-object}
2222

23-
You can access the caught error by accessing the implicit `$error` variable:
23+
暗黙の`$error`変数を参照すると、捕捉されたエラーにアクセスできます:
2424

2525
```angular-html
2626
@boundary {
@@ -30,9 +30,9 @@ You can access the caught error by accessing the implicit `$error` variable:
3030
}
3131
```
3232

33-
## Resetting the boundary
33+
## バウンダリのリセット {#resetting-the-boundary}
3434

35-
You can attempt to re-render the content of the `@boundary` by calling the implicit `$reset` function in the `@error` block. When called, it resets the boundary state and tries to render the original content again.
35+
`@error`ブロック内で暗黙の`$reset`関数を呼び出すことで、`@boundary`のコンテンツの再レンダリングを試みることができます。呼び出されると、バウンダリの状態をリセットし、元のコンテンツのレンダリングを再試行します。
3636

3737
```angular-html
3838
@boundary {
@@ -43,9 +43,9 @@ You can attempt to re-render the content of the `@boundary` by calling the impli
4343
}
4444
```
4545

46-
## Conditional error handling with `when`
46+
## `when`による条件付きエラーハンドリング {#conditional-error-handling-with-when}
4747

48-
You can use `when` clauses to conditionally handle specific types of errors, allowing you to provide different fallback UIs. Angular evaluates this condition when it catches an error.
48+
`when`句を使用すると、特定の種類のエラーを条件付きで処理し、異なるフォールバックUIを提供できます。Angularはエラーを捕捉したときにこの条件を評価します。
4949

5050
```angular-html
5151
@boundary {
@@ -58,11 +58,11 @@ You can use `when` clauses to conditionally handle specific types of errors, all
5858
}
5959
```
6060

61-
Order your `@error` blocks from most specific to least specific, as Angular evaluates the `when` clauses in order and uses the first one that evaluates to true. A final `@error` block without a `when` clause acts as a catch-all fallback.
61+
Angularは`when`句を順番に評価し、最初にtrueと評価されたものを使用するため、`@error`ブロックは条件が具体的なものから一般的なものの順に配置してください。`when`句のない最後の`@error`ブロックは、すべてのエラーを捕捉するフォールバックとして機能します。
6262

63-
## Global error handler integration
63+
## グローバルエラーハンドラーの統合 {#global-error-handler-integration}
6464

65-
When a boundary catches an error, Angular can still notify the global `ErrorHandler`. You can implement the optional `onViewError` hook in your custom `ErrorHandler` to log these caught errors to your error tracking service.
65+
バウンダリがエラーを捕捉した場合でも、Angularはグローバルな`ErrorHandler`に通知できます。カスタム`ErrorHandler`にオプションの`onViewError`フックを実装することで、捕捉されたこれらのエラーをエラー追跡サービスに記録できます。
6666

6767
```ts
6868
@Injectable()
@@ -79,13 +79,13 @@ export class MyErrorHandler implements ErrorHandler {
7979
}
8080
```
8181

82-
IMPORTANT: If an `@error` block itself throws an error, the error propagates to the next outer `@boundary` or Angular treats it as an unhandled application error.
82+
IMPORTANT: `@error`ブロック自体がエラーをスローした場合、そのエラーは1つ外側の`@boundary`に伝播します。外側に`@boundary`がなければ、Angularはそれを未処理のアプリケーションエラーとして扱います。
8383

84-
## Content projection
84+
## コンテンツプロジェクション {#content-projection}
8585

86-
If your component uses [content projection](guide/components/content-projection), wrapping `<ng-content>` in a `@boundary` does not catch errors from projected content. That content belongs to the view that declares it, not the receiving component's view.
86+
コンポーネントが[コンテンツプロジェクション](guide/components/content-projection)を使用している場合、`<ng-content>`を`@boundary`でラップしても、投影されたコンテンツのエラーは捕捉されません。投影されたコンテンツが属するのは、受け取る側のコンポーネントのビューではなく、コンテンツを宣言した側のビューです。
8787

88-
For example, a wrapper component with the following template does not catch errors from components projected into it:
88+
例えば、以下のテンプレートを持つラッパーコンポーネントは、そこに投影されたコンポーネントのエラーを捕捉しません。
8989

9090
```angular-html {avoid}
9191
@boundary {
@@ -95,7 +95,7 @@ For example, a wrapper component with the following template does not catch erro
9595
}
9696
```
9797

98-
To catch those errors, wrap the wrapper component and its projected content in a `@boundary` in the parent template:
98+
これらのエラーを捕捉するには、親テンプレートの`@boundary`でラッパーコンポーネントとその投影されたコンテンツをラップします。
9999

100100
```angular-html {prefer}
101101
@boundary {
@@ -107,6 +107,6 @@ To catch those errors, wrap the wrapper component and its projected content in a
107107
}
108108
```
109109

110-
## Dynamic views and programmatic error handling
110+
## 動的ビューとプログラムによるエラー処理 {#dynamic-views-and-programmatic-error-handling}
111111

112-
Error handling isn't limited to template syntax. If you are creating components or embedded views dynamically, you can use the `onError` option to handle errors. See the [Handling rendering errors](guide/components/programmatic-rendering#handling-rendering-errors) section in the programmatic rendering guide for more information.
112+
エラー処理はテンプレート構文に限定されません。コンポーネントや埋め込みビューを動的に作成している場合は、`onError`オプションを使用してエラーを処理できます。詳細については、プログラムによるレンダリングガイドの[レンダリングエラーの処理](guide/components/programmatic-rendering#handling-rendering-errors)セクションを参照してください。

‎prh.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ rules:
1919
- expected: 双方向
2020
pattern: 二方向
2121

22+
- expected: 開発者プレビュー
23+
pattern: デベロッパープレビュー
24+
2225
- expected: 変更検知
2326
pattern: 変更検出
2427

@@ -110,6 +113,9 @@ rules:
110113
- expected: ブラウザ
111114
pattern: /ブラウザー/
112115

116+
- expected: バウンダリ
117+
pattern: /バウンダリー/
118+
113119
- expected: サブスクライバー
114120
pattern: /サブスクライバ(?!ー)/
115121

0 commit comments

Comments
 (0)