Skip to content

Commit 0085728

Browse files
fix: translate tutrial first app 02 (#1151)
* {tutorials/first-app/intro}の翻訳 * 残っていた英文を削除 * 余分な空白を削除 * Update adev-ja/src/content/tutorials/first-app/intro/README.md 了解です。補足->HELPFULに戻します。 Co-authored-by: Suguru Inatomi <suguru.inatomi@gmail.com> * Update adev-ja/src/content/tutorials/first-app/intro/README.md 了解です。注意->NOTEに戻します。 Co-authored-by: Suguru Inatomi <suguru.inatomi@gmail.com> * Update adev-ja/src/content/tutorials/first-app/intro/README.md 了解です。注意->NOTEに戻します。 Co-authored-by: Suguru Inatomi <suguru.inatomi@gmail.com> * 和訳を作成 * 余分な行を削除 * 和訳を作成 --------- Co-authored-by: Suguru Inatomi <suguru.inatomi@gmail.com>
1 parent 49a3135 commit 0085728

2 files changed

Lines changed: 209 additions & 63 deletions

File tree

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Create Home component
2+
3+
This tutorial lesson demonstrates how to create a new [component](guide/components) for your Angular app.
4+
5+
<docs-video src="https://www.youtube.com/embed/R0nRX8jD2D0?si=OMVaw71EIa44yIOJ"/>
6+
7+
## What you'll learn
8+
9+
Your app has a new component: `Home`.
10+
11+
## Conceptual preview of Angular components
12+
13+
Angular apps are built around components, which are Angular's building blocks.
14+
Components contain the code, HTML layout, and CSS style information that provide the function and appearance of an element in the app.
15+
In Angular, components can contain other components. An app's functions and appearance can be divided and partitioned into components.
16+
17+
In Angular, components have metadata that define its properties.
18+
When you create your `Home`, you use these properties:
19+
20+
- `selector`: to describe how Angular refers to the component in templates.
21+
- `standalone`: to describe whether the component requires a `NgModule`.
22+
- `imports`: to describe the component's dependencies.
23+
- `template`: to describe the component's HTML markup and layout.
24+
- `styleUrls`: to list the URLs of the CSS files that the component uses in an array.
25+
26+
<docs-pill-row>
27+
<docs-pill href="api/core/Component" title="Learn more about Components"/>
28+
</docs-pill-row>
29+
30+
<docs-workflow>
31+
32+
<docs-step title="Create the `Home`">
33+
In this step, you create a new component for your app.
34+
35+
In the **Terminal** pane of your IDE:
36+
37+
1. In your project directory, navigate to the `first-app` directory.
38+
1. Run this command to create a new `Home`
39+
40+
```shell
41+
ng generate component home
42+
```
43+
44+
1. Run this command to build and serve your app.
45+
46+
NOTE: This step is only for your local environment!
47+
48+
```shell
49+
ng serve
50+
```
51+
52+
1. Open a browser and navigate to `http://localhost:4200` to find the application.
53+
54+
1. Confirm that the app builds without error.
55+
56+
HELPFUL: It should render the same as it did in the previous lesson because even though you added a new component, you haven't included it in any of the app's templates, yet.
57+
58+
1. Leave `ng serve` running as you complete the next steps.
59+
</docs-step>
60+
61+
<docs-step title="Add the new component to your app's layout">
62+
In this step, you add the new component, `Home` to your app's root component, `App`, so that it displays in your app's layout.
63+
64+
In the **Edit** pane of your IDE:
65+
66+
1. Open `app.ts` in the editor.
67+
1. In `app.ts`, import `Home` by adding this line to the file level imports.
68+
69+
<docs-code header="Import Home in src/app/app.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[2]"/>
70+
71+
1. In `app.ts`, in `@Component`, update the `imports` array property and add `Home`.
72+
73+
<docs-code header="Replace in src/app/app.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[6]"/>
74+
75+
1. In `app.ts`, in `@Component`, update the `template` property to include the following HTML code.
76+
77+
<docs-code language="angular-ts" header="Replace in src/app/app.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[7,16]"/>
78+
79+
1. Save your changes to `app.ts`.
80+
1. If `ng serve` is running, the app should update.
81+
If `ng serve` is not running, start it again.
82+
_Hello world_ in your app should change to _home works!_ from the `Home`.
83+
1. Check the running app in the browser and confirm that the app has been updated.
84+
85+
<img alt="browser frame of page displaying the text 'home works!'" src="assets/images/tutorials/first-app/homes-app-lesson-02-step-2.png">
86+
87+
</docs-step>
88+
89+
<docs-step title="Add features to `Home`">
90+
91+
In this step you add features to `Home`.
92+
93+
In the previous step, you added the default `Home` to your app's template so its default HTML appeared in the app.
94+
In this step, you add a search filter and button that is used in a later lesson.
95+
For now, that's all that `Home` has.
96+
Note that, this step just adds the search elements to the layout without any functionality, yet.
97+
98+
If you started from a fresh Angular project instead of downloading the starter
99+
(ng new): add these globals to `src/styles.css` so the search button and input border are visible:
100+
101+
```
102+
:root {
103+
--primary-color: #605DC8;
104+
--secondary-color: #8B89E6;
105+
--accent-color: #e8e7fa;
106+
--shadow-color: #E8E8E8;
107+
}
108+
109+
button.primary {
110+
padding: 10px;
111+
border: solid 1px var(--primary-color);
112+
background: var(--primary-color);
113+
color: white;
114+
border-radius: 8px;
115+
}
116+
```
117+
118+
In the **Edit** pane of your IDE:
119+
120+
1. In the `first-app` directory, open `home.ts` in the editor.
121+
1. In `home.ts`, in `@Component`, update the `template` property with this code.
122+
123+
<docs-code language="angular-ts" header="Replace in src/app/home/home.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.ts" visibleLines="[5,12]"/>
124+
125+
1. Next, open `home.css` in the editor and update the content with these styles.
126+
127+
NOTE: In the browser, these can go in `src/app/home/home.ts` in the `styles` array.
128+
129+
<docs-code header="Replace in src/app/home/home.css" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.css"/>
130+
131+
1. Confirm that the app builds without error. You should find the filter query box and button in your app and they should be styled. Correct any errors before you continue to the next step.
132+
133+
<img alt="browser frame of homes-app displaying logo, filter text input box and search button" src="assets/images/tutorials/first-app/homes-app-lesson-02-step-3.png">
134+
</docs-step>
135+
136+
</docs-workflow>
137+
138+
SUMMARY: In this lesson, you created a new component for your app and gave it a filter edit control and button.
139+
140+
For more information about the topics covered in this lesson, visit:
141+
142+
<docs-pill-row>
143+
<docs-pill href="cli/generate/component" title="`ng generate component`"/>
144+
<docs-pill href="api/core/Component" title="`Component` reference"/>
145+
<docs-pill href="guide/components" title="Angular components overview"/>
146+
</docs-pill-row>
Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,102 @@
1-
# Create Home component
1+
# homeコンポーネントを作成する
22

3-
This tutorial lesson demonstrates how to create a new [component](guide/components) for your Angular app.
3+
このチュートリアルはAngularアプリケーションの新しい[コンポーネント](guide/components)を作成する方法を紹介します。
44

55
<docs-video src="https://www.youtube.com/embed/R0nRX8jD2D0?si=OMVaw71EIa44yIOJ"/>
66

7-
## What you'll learn
7+
## 何を学ぶか
88

9-
Your app has a new component: `Home`.
9+
アプリケーションに新しいコンポーネント`Home`が追加されます。
1010

11-
## Conceptual preview of Angular components
11+
## Angularコンポーネントの概念的な概要
1212

13-
Angular apps are built around components, which are Angular's building blocks.
14-
Components contain the code, HTML layout, and CSS style information that provide the function and appearance of an element in the app.
15-
In Angular, components can contain other components. An app's functions and appearance can be divided and partitioned into components.
13+
Angularアプリケーションはコンポーネントを中心に構築されており、Angularの基本的な構成要素です。
14+
コンポーネントはアプリケーション内の要素の機能や見た目を提供するコード、HTMLレイアウト、CSSスタイルが含まれます。
15+
Angularではコンポーネントの中にさらに別のコンポーネントを含めることができます。アプリケーションの機能や見た目はコンポーネン単位に分割して構成できます。
1616

17-
In Angular, components have metadata that define its properties.
18-
When you create your `Home`, you use these properties:
17+
Angularでは、コンポーネントにはプロパティを定義するためのメタデータがあります。
18+
`Home`コンポーネントを作成するときには、これらのプロパティを使用します。
1919

20-
- `selector`: to describe how Angular refers to the component in templates.
21-
- `standalone`: to describe whether the component requires a `NgModule`.
22-
- `imports`: to describe the component's dependencies.
23-
- `template`: to describe the component's HTML markup and layout.
24-
- `styleUrls`: to list the URLs of the CSS files that the component uses in an array.
20+
- `selector`: テンプレートでAngularがコンポーネントを参照する方法を示します。
21+
- `standalone`: コンポーネントが`NgModule`を必要とするかを示します。
22+
- `imports`: コンポーネントの依存関係を示します。
23+
- `template`: コンポーネントのHTMLマークアップとレイアウトを示します。
24+
- `styleUrls`: コンポーネントが使用するCSSファイルのURLを配列で指定します。
2525

2626
<docs-pill-row>
27-
<docs-pill href="api/core/Component" title="Learn more about Components"/>
27+
<docs-pill href="api/core/Component" title="コンポーネントについて詳しく学ぶ"/>
2828
</docs-pill-row>
2929

3030
<docs-workflow>
3131

3232
<docs-step title="Create the `Home`">
33-
In this step, you create a new component for your app.
33+
このステップでは、アプリケーション用の新しいコンポーネントを作成します。
3434

35-
In the **Terminal** pane of your IDE:
35+
IDEの**ターミナル**ペインで、
3636

37-
1. In your project directory, navigate to the `first-app` directory.
38-
1. Run this command to create a new `Home`
37+
1. プロジェクトディレクトリの中の、`first-app`ディレクトリを開きます。
38+
1. 新しい`Home`コンポーネントを作成するために、次のコマンドを実行します。
3939

4040
```shell
4141
ng generate component home
4242
```
4343

44-
1. Run this command to build and serve your app.
44+
1. アプリケーションをビルドし、開発サーバーを起動するために、次のコマンドを実行します。
4545

46-
NOTE: This step is only for your local environment!
46+
NOTE: このステップはローカル環境でのみ実施します!
4747

4848
```shell
4949
ng serve
5050
```
5151

52-
1. Open a browser and navigate to `http://localhost:4200` to find the application.
52+
1. ブラウザを開き、`http://localhost:4200`にアクセスしてアプリケーションを確認します。
5353

54-
1. Confirm that the app builds without error.
54+
1. アプリケーションがエラーなくビルドされていることを確認します。
5555

56-
HELPFUL: It should render the same as it did in the previous lesson because even though you added a new component, you haven't included it in any of the app's templates, yet.
56+
HELPFUL: 新しいコンポーネントを追加しましたが、まだアプリケーションのどのテンプレートにも組み込んでいませんので、前のレッスンと同様の表示になります。
5757

58-
1. Leave `ng serve` running as you complete the next steps.
58+
1. 次のステップに進む間も、`ng serve`はそのまま実行し続けておきます。
5959
</docs-step>
6060

61-
<docs-step title="Add the new component to your app's layout">
62-
In this step, you add the new component, `Home` to your app's root component, `App`, so that it displays in your app's layout.
61+
<docs-step title="アプリケーションのレイアウトに新しいコンポーネントを追加する">
62+
このステップでは、新しいコンポーネント`Home`をアプリのルートコンポーネントである`App`に追加し、アプリケーションのレイアウトに表示されるようにします。
6363

64-
In the **Edit** pane of your IDE:
64+
IDEの**編集**ペインで、
6565

66-
1. Open `app.ts` in the editor.
67-
1. In `app.ts`, import `Home` by adding this line to the file level imports.
66+
1. エディタで`app.ts`を開きます。
67+
1. `app.ts`でファイルレベルのインポートに、次の行を追加して`Home`をインポートします。
6868

69-
<docs-code header="Import Home in src/app/app.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[2]"/>
69+
<docs-code header="src/app/app.tsでHomeをインポートする" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[2]"/>
7070

71-
1. In `app.ts`, in `@Component`, update the `imports` array property and add `Home`.
71+
1. `app.ts``@Component`内で、`imports`配列プロパティに`Home`を追加します。
7272

73-
<docs-code header="Replace in src/app/app.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[6]"/>
73+
<docs-code header="src/app/app.tsで置き換える" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[6]"/>
7474

75-
1. In `app.ts`, in `@Component`, update the `template` property to include the following HTML code.
75+
1. `app.ts``@Component`内で、次のHTMLコードを含むように`template`プロパティを更新します。
7676

77-
<docs-code language="angular-ts" header="Replace in src/app/app.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[7,16]"/>
77+
<docs-code language="angular-ts" header="src/app/app.tsで置き換える" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts" visibleLines="[7,16]"/>
7878

79-
1. Save your changes to `app.ts`.
80-
1. If `ng serve` is running, the app should update.
81-
If `ng serve` is not running, start it again.
82-
_Hello world_ in your app should change to _home works!_ from the `Home`.
83-
1. Check the running app in the browser and confirm that the app has been updated.
79+
1. 変更を`app.ts`に保存します。
80+
1. `ng serve`が実行中の場合、アプリケーションは自動的に更新されます。
81+
実行中でない場合、再度`ng serve`を開始してください。
82+
`Home`コンポーネントによって、*Hello world**home works!*に変わるはずです。
83+
1. ブラウザで実行中のアプリケーションをチェックし、アプリケーションが更新されていることを確認します。
8484

85-
<img alt="browser frame of page displaying the text 'home works!'" src="assets/images/tutorials/first-app/homes-app-lesson-02-step-2.png">
85+
<img alt="テキスト'home works!'を表示するページのブラウザのフレーム" src="assets/images/tutorials/first-app/homes-app-lesson-02-step-2.png">
8686

8787
</docs-step>
8888

89-
<docs-step title="Add features to `Home`">
89+
<docs-step title="`Home`コンポーネントに機能を追加する">
9090

91-
In this step you add features to `Home`.
91+
このステップでは、`Home`コンポーネントに機能を追加します。
9292

93-
In the previous step, you added the default `Home` to your app's template so its default HTML appeared in the app.
94-
In this step, you add a search filter and button that is used in a later lesson.
95-
For now, that's all that `Home` has.
96-
Note that, this step just adds the search elements to the layout without any functionality, yet.
93+
前のステップでは、`Home`のデフォルトのHTMLがアプリケーションで表示されるよう、`Home`をアプリケーションのテンプレートに追加しました。
94+
このステップでは、後のレッスンで使用する検索フィルターとボタンを追加します。
95+
現時点で`Home`が持つのはこれだけです。
96+
なお、このステップでは検索用の要素をレイアウトに追加するだけで、まだ機能はありません。
9797

98-
If you started from a fresh Angular project instead of downloading the starter
99-
(ng new): add these globals to `src/styles.css` so the search button and input border are visible:
98+
(ng newで)スターターを使わずに、新しいAngularプロジェクトを作成した場合、
99+
検索ボタンと入力欄の枠線が表示されるよう`src/styles.css`に次のグローバルスタイルを追加します。
100100

101101
```
102102
:root {
@@ -115,32 +115,32 @@ button.primary {
115115
}
116116
```
117117

118-
In the **Edit** pane of your IDE:
118+
IDEの**編集**ペインで、
119119

120-
1. In the `first-app` directory, open `home.ts` in the editor.
121-
1. In `home.ts`, in `@Component`, update the `template` property with this code.
120+
1. `first-app`ディレクトリで、`home.ts`をエディタで開きます。
121+
1. `home.ts``@Component`で、`template`プロパティを次のコードで更新します。
122122

123-
<docs-code language="angular-ts" header="Replace in src/app/home/home.ts" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.ts" visibleLines="[5,12]"/>
123+
<docs-code language="angular-ts" header="src/app/home/home.tsを置き換える" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.ts" visibleLines="[5,12]"/>
124124

125-
1. Next, open `home.css` in the editor and update the content with these styles.
125+
1. 次に、エディタで`home.css`を開き、次のスタイルで内容を更新します。`
126126

127-
NOTE: In the browser, these can go in `src/app/home/home.ts` in the `styles` array.
127+
NOTE: ブラウザでは、`src/app/home/home.ts``styles`配列にこれらのスタイルを記述可能です。
128128

129-
<docs-code header="Replace in src/app/home/home.css" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.css"/>
129+
<docs-code header="src/app/home/home.cssを置き換える" path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.css"/>
130130

131-
1. Confirm that the app builds without error. You should find the filter query box and button in your app and they should be styled. Correct any errors before you continue to the next step.
131+
1. アプリケーションがエラーなくビルドされていることを確認してください。フィルター用の入力ボックスとボタンが表示され、スタイルが反映されているはずです。次のステップに進む前に、エラーがあれば修正してください。
132132

133-
<img alt="browser frame of homes-app displaying logo, filter text input box and search button" src="assets/images/tutorials/first-app/homes-app-lesson-02-step-3.png">
133+
<img alt="homesアプリケーションのロゴ、フィルター入力欄、検索ボタンが表示されたブラウザ画面" src="assets/images/tutorials/first-app/homes-app-lesson-02-step-3.png">
134134
</docs-step>
135135

136136
</docs-workflow>
137137

138-
SUMMARY: In this lesson, you created a new component for your app and gave it a filter edit control and button.
138+
SUMMARY: このレッスンでは、アプリケーションに新しいコンポーネントを作成し、フィルター用の入力欄とボタンを追加しました。
139139

140-
For more information about the topics covered in this lesson, visit:
140+
このレッスンで扱った内容の詳細については、次のページをご覧ください:
141141

142142
<docs-pill-row>
143143
<docs-pill href="cli/generate/component" title="`ng generate component`"/>
144-
<docs-pill href="api/core/Component" title="`Component` reference"/>
145-
<docs-pill href="guide/components" title="Angular components overview"/>
144+
<docs-pill href="api/core/Component" title="`Component`リファレンス"/>
145+
<docs-pill href="guide/components" title="Angularコンポーネントの概要"/>
146146
</docs-pill-row>

0 commit comments

Comments
 (0)