Skip to content

Commit de6c1bb

Browse files
authored
fix(adev): translate essentials (angular#932)
* fix(adev): translate essentials/overview, components * chore(tools): implement translate script with AI * fix(adev): translate essentials
1 parent edabc74 commit de6c1bb

25 files changed

+821
-172
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.tmp
2+
.env
23
build
34
node_modules

adev-ja/src/app/sub-navigation-data.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,45 +32,45 @@ const DOCS_SUB_NAVIGATION_DATA: NavigationItem[] = [
3232
contentPath: 'introduction/what-is-angular',
3333
},
3434
{
35-
label: '基本要素',
35+
label: '基本概念',
3636
children: [
3737
{
38-
label: 'Overview',
38+
label: '概要',
3939
path: 'essentials',
4040
contentPath: 'introduction/essentials/overview',
4141
},
4242
{
43-
label: 'Composing with Components',
43+
label: 'コンポーネントによる構築',
4444
path: 'essentials/components',
4545
contentPath: 'introduction/essentials/components',
4646
},
4747
{
48-
label: 'Managing Dynamic Data',
48+
label: '動的なデータの管理',
4949
path: 'essentials/managing-dynamic-data',
5050
contentPath: 'introduction/essentials/managing-dynamic-data',
5151
},
5252
{
53-
label: 'Rendering Dynamic Templates',
53+
label: '動的なテンプレート',
5454
path: 'essentials/rendering-dynamic-templates',
5555
contentPath: 'introduction/essentials/rendering-dynamic-templates',
5656
},
5757
{
58-
label: 'Conditionals and Loops',
58+
label: '条件分岐とループ',
5959
path: 'essentials/conditionals-and-loops',
6060
contentPath: 'introduction/essentials/conditionals-and-loops',
6161
},
6262
{
63-
label: 'Handling User Interaction',
63+
label: 'ユーザーインタラクションの処理',
6464
path: 'essentials/handling-user-interaction',
6565
contentPath: 'introduction/essentials/handling-user-interaction',
6666
},
6767
{
68-
label: 'Sharing Logic',
68+
label: 'ロジックの共有',
6969
path: 'essentials/sharing-logic',
7070
contentPath: 'introduction/essentials/sharing-logic',
7171
},
7272
{
73-
label: 'Next Steps',
73+
label: '次のステップ',
7474
path: 'essentials/next-steps',
7575
contentPath: 'introduction/essentials/next-steps',
7676
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<docs-decorative-header title="Components" imgSrc="adev/src/assets/images/components.svg"> <!-- markdownlint-disable-line -->
2+
The fundamental building block for creating applications in Angular.
3+
</docs-decorative-header>
4+
5+
Components provide structure for organizing your project into easy-to-understand parts with clear responsibilities so that your code is maintainable and scalable.
6+
7+
Here is an example of how a Todo application could be broken down into a tree of components.
8+
9+
```mermaid
10+
flowchart TD
11+
A[TodoApp]-->B
12+
A-->C
13+
B[TodoList]-->D
14+
C[TodoMetrics]
15+
D[TodoListItem]
16+
```
17+
18+
In this guide, we'll take a look at how to create and use components in Angular.
19+
20+
## Defining a Component
21+
22+
Every component has the following core properties:
23+
24+
1. A `@Component`[decorator](https://www.typescriptlang.org/docs/handbook/decorators.html) that contains some configuration
25+
2. An HTML template that controls what renders into the DOM
26+
3. A [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors) that defines how the component is used in HTML
27+
4. A TypeScript class with behaviors such as managing state, handling user input, or fetching data from a server.
28+
29+
Here is a simplified example of a TodoListItem component.
30+
31+
```ts
32+
// todo-list-item.component.ts
33+
@Component({
34+
selector: 'todo-list-item',
35+
template: `
36+
<li>(TODO) Read Angular Essentials Guide</li>
37+
`,
38+
})
39+
export class TodoListItem {
40+
/* Component behavior is defined in here */
41+
}
42+
```
43+
44+
Other common metadata that you'll also see in components include:
45+
46+
- `standalone: true` — The recommended approach of streamlining the authoring experience of components
47+
- `styles` — A string or array of strings that contains any CSS styles you want applied to the component
48+
49+
Knowing this, here is an updated version of our `TodoListItem` component.
50+
51+
```ts
52+
// todo-list-item.component.ts
53+
@Component({
54+
standalone: true,
55+
selector: 'todo-list-item',
56+
template: `
57+
<li>(TODO) Read Angular Essentials Guide</li>
58+
`,
59+
styles: `
60+
li {
61+
color: red;
62+
font-weight: 300;
63+
}
64+
`,
65+
})
66+
export class TodoListItem {
67+
/* Component behavior is defined in here */
68+
}
69+
```
70+
71+
### Separating HTML and CSS into separate files
72+
73+
For teams that prefer managing their HTML and/or CSS in separate files, Angular provides two additional properties: `templateUrl` and `styleUrl`.
74+
75+
Using the previous `TodoListItem` component, the alternative approach looks like:
76+
77+
```ts
78+
// todo-list-item.component.ts
79+
@Component({
80+
standalone: true,
81+
selector: 'todo-list-item',
82+
templateUrl: './todo-list-item.component.html',
83+
styleUrl: './todo-list-item.component.css',
84+
})
85+
export class TodoListItem {
86+
/* Component behavior is defined in here */
87+
}
88+
```
89+
90+
```html
91+
<!-- todo-list-item.component.html -->
92+
<li>(TODO) Read Angular Essentials Guide</li>
93+
```
94+
95+
```css
96+
// todo-list-item.component.css
97+
li {
98+
color: red;
99+
font-weight: 300;
100+
}
101+
```
102+
103+
## Using a Component
104+
105+
One advantage of component architecture is that your application is modular. In other words, components can be used in other components.
106+
107+
To use a component, you need to:
108+
109+
1. Import the component into the file
110+
2. Add it to the component's `imports` array
111+
3. Use the component's selector in the `template`
112+
113+
Here's an example of a `TodoList` component importing the `TodoListItem` component from before:
114+
115+
```ts
116+
// todo-list.component.ts
117+
import {TodoListItem} from './todo-list-item.component.ts';
118+
119+
@Component({
120+
standalone: true,
121+
imports: [TodoListItem],
122+
template: `
123+
<ul>
124+
<todo-list-item></todo-list-item>
125+
</ul>
126+
`,
127+
})
128+
export class TodoList {}
129+
```
130+
131+
## Next Step
132+
133+
Now that you know how components work in Angular, it's time to learn how we add and manage dynamic data in our application.
134+
135+
<docs-pill-row>
136+
<docs-pill title="Managing Dynamic Data" href="essentials/managing-dynamic-data" />
137+
</docs-pill-row>

adev-ja/src/content/introduction/essentials/components.md

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<docs-decorative-header title="Components" imgSrc="adev/src/assets/images/components.svg"> <!-- markdownlint-disable-line -->
2-
The fundamental building block for creating applications in Angular.
1+
<docs-decorative-header title="コンポーネント" imgSrc="adev/src/assets/images/components.svg"> <!-- markdownlint-disable-line -->
2+
Angular でアプリケーションを作成するための基本的な構成要素。
33
</docs-decorative-header>
44

5-
Components provide structure for organizing your project into easy-to-understand parts with clear responsibilities so that your code is maintainable and scalable.
5+
コンポーネントは、プロジェクトを理解しやすい部品に分割し、明確な責任を持たせることで、コードの保守性とスケーラビリティを向上させます。
66

7-
Here is an example of how a Todo application could be broken down into a tree of components.
7+
Todo アプリケーションをコンポーネントのツリーに分解する例を示します。
88

99
```mermaid
1010
flowchart TD
@@ -15,18 +15,18 @@ flowchart TD
1515
D[TodoListItem]
1616
```
1717

18-
In this guide, we'll take a look at how to create and use components in Angular.
18+
このガイドでは、Angular でコンポーネントを作成および使用する方法について説明します。
1919

20-
## Defining a Component
20+
## コンポーネントの定義
2121

22-
Every component has the following core properties:
22+
すべてのコンポーネントには、核となる次のプロパティがあります。
2323

24-
1. A `@Component`[decorator](https://www.typescriptlang.org/docs/handbook/decorators.html) that contains some configuration
25-
2. An HTML template that controls what renders into the DOM
26-
3. A [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors) that defines how the component is used in HTML
27-
4. A TypeScript class with behaviors such as managing state, handling user input, or fetching data from a server.
24+
1. いくつかの設定を含む `@Component`[デコレーター](https://www.typescriptlang.org/docs/handbook/decorators.html)
25+
2. DOM にレンダリングされる内容を制御する HTMLテンプレート
26+
3. HTML でコンポーネントがどのように使用されるかを定義する [CSSセレクター](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors)
27+
4. 状態管理、ユーザー入力処理、サーバーからのデータフェッチなどの動作を持つ TypeScriptクラス
2828

29-
Here is a simplified example of a TodoListItem component.
29+
TodoListItem コンポーネントの簡略化された例を次に示します。
3030

3131
```ts
3232
// todo-list-item.component.ts
@@ -37,16 +37,16 @@ Here is a simplified example of a TodoListItem component.
3737
`,
3838
})
3939
export class TodoListItem {
40-
/* Component behavior is defined in here */
40+
/* コンポーネントの動作はここで定義します。 */
4141
}
4242
```
4343

44-
Other common metadata that you'll also see in components include:
44+
コンポーネントでよく見られるその他のメタデータには次のものがあります。
4545

46-
- `standalone: true`The recommended approach of streamlining the authoring experience of components
47-
- `styles`A string or array of strings that contains any CSS styles you want applied to the component
46+
- `standalone: true`コンポーネントの作成を簡素化する推奨アプローチ
47+
- `styles`コンポーネントに適用する CSSスタイルを含む文字列または文字列の配列
4848

49-
Knowing this, here is an updated version of our `TodoListItem` component.
49+
これを踏まえて、`TodoListItem` コンポーネントの更新バージョンを示します。
5050

5151
```ts
5252
// todo-list-item.component.ts
@@ -64,15 +64,15 @@ Knowing this, here is an updated version of our `TodoListItem` component.
6464
`,
6565
})
6666
export class TodoListItem {
67-
/* Component behavior is defined in here */
67+
/* コンポーネントの動作はここで定義します。 */
6868
}
6969
```
7070

71-
### Separating HTML and CSS into separate files
71+
### HTMLとCSSを別ファイルに分離する
7272

73-
For teams that prefer managing their HTML and/or CSS in separate files, Angular provides two additional properties: `templateUrl` and `styleUrl`.
73+
HTMLやCSSを別ファイルで管理することを好むチーム向けに、Angular `templateUrl` `styleUrl` の2つの追加プロパティを提供します。
7474

75-
Using the previous `TodoListItem` component, the alternative approach looks like:
75+
前の `TodoListItem` コンポーネントを使用して、代替アプローチは次のようになります。
7676

7777
```ts
7878
// todo-list-item.component.ts
@@ -83,7 +83,7 @@ Using the previous `TodoListItem` component, the alternative approach looks like
8383
styleUrl: './todo-list-item.component.css',
8484
})
8585
export class TodoListItem {
86-
/* Component behavior is defined in here */
86+
/* コンポーネントの動作はここで定義します。 */
8787
}
8888
```
8989

@@ -100,17 +100,17 @@ li {
100100
}
101101
```
102102

103-
## Using a Component
103+
## コンポーネントの使用
104104

105-
One advantage of component architecture is that your application is modular. In other words, components can be used in other components.
105+
コンポーネントアーキテクチャの利点の1つは、アプリケーションがモジュール化されることです。つまり、コンポーネントは他のコンポーネントの中で使用できます。
106106

107-
To use a component, you need to:
107+
コンポーネントを使用するには、次の手順を実行します。
108108

109-
1. Import the component into the file
110-
2. Add it to the component's `imports` array
111-
3. Use the component's selector in the `template`
109+
1. ファイルにコンポーネントをインポートする
110+
2. コンポーネントの `imports` 配列に追加する
111+
3. テンプレートでコンポーネントのセレクターを使用する
112112

113-
Here's an example of a `TodoList` component importing the `TodoListItem` component from before:
113+
前の `TodoListItem` コンポーネントをインポートする `TodoList` コンポーネントの例を次に示します。
114114

115115
```ts
116116
// todo-list.component.ts
@@ -128,10 +128,10 @@ import {TodoListItem} from './todo-list-item.component.ts';
128128
export class TodoList {}
129129
```
130130

131-
## Next Step
131+
## 次のステップ
132132

133-
Now that you know how components work in Angular, it's time to learn how we add and manage dynamic data in our application.
133+
Angularのコンポーネントの仕組みがわかったところで、アプリケーションに動的なデータを追加して管理する方法について学びましょう。
134134

135135
<docs-pill-row>
136-
<docs-pill title="Managing Dynamic Data" href="essentials/managing-dynamic-data" />
136+
<docs-pill title="動的なデータの管理" href="essentials/managing-dynamic-data" />
137137
</docs-pill-row>

0 commit comments

Comments
 (0)