Skip to content

Commit 7c405d4

Browse files
tutti2612u-sho
authored andcommitted
「Tutorial > Declarative Rendering」の翻訳 (vuejs-translations#364)
* translated tutorial step2 * レビュー指摘箇所の修正 * :の前の。は不要なので削除
1 parent 3d32b0f commit 7c405d4

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/tutorial/src/step-2/description.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Declarative Rendering
1+
# 宣言的レンダリング
22

33
<div class="sfc">
44

5-
What you see in the editor is a Vue Single File Component (SFC). An SFC is a reusable self-contained block of code that encapsulates HTML, CSS and JavaScript that belong together, written inside a `.vue` file.
5+
エディターに表示されているのは、Vue Single File Component (SFC) です。SFC は再利用可能な自己完結型のコードブロックであり、一緒に属する HTMLCSSJavaScript をカプセル化して `.vue` ファイル内に記述します。
66

77
</div>
88

9-
The core feature of Vue is **declarative rendering**: using a template syntax that extends HTML, we can describe how the HTML should look like based on JavaScript state. When the state changes, the HTML updates automatically.
9+
Vue の中核となる機能は**宣言的レンダリング**です。HTML を拡張したテンプレート構文を用いて、JavaScript の状態に基づいて HTML がどのように見えるかを記述することができます。状態が変更されると、HTML は自動的に更新されます。
1010

1111
<div class="composition-api">
1212

13-
State that can trigger updates when changed are considered **reactive**. We can declare reactive state using Vue's `reactive()` API. Objects created from `reactive()` are JavaScript [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that work just like normal objects:
13+
変更されたときに更新のトリガーとなるような状態は**リアクティブ**とみなされます。Vue`reactive()` API を使用してリアクティブな状態を宣言することができます。`reactive()` で生成されるオブジェクトは JavaScript [プロキシ](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Proxy) であり、通常のオブジェクトと同様に動作します:
1414

1515
```js
1616
import { reactive } from 'vue'
@@ -23,7 +23,7 @@ console.log(counter.count) // 0
2323
counter.count++
2424
```
2525

26-
`reactive()` only works on objects (including arrays and built-in types like `Map` and `Set`). `ref()`, on the other hand, can take any value type and create an object that exposes the inner value under a `.value` property:
26+
`reactive()` はオブジェクト(配列や `Map` `Set` のような組み込み型も含む)に対してのみ動作します。一方、`ref()` は、任意の値の型を取り、`.value` プロパティの下で内部の値を公開するオブジェクトを作成することができます:
2727

2828
```js
2929
import { ref } from 'vue'
@@ -34,17 +34,17 @@ console.log(message.value) // "Hello World!"
3434
message.value = 'Changed'
3535
```
3636

37-
Details on `reactive()` and `ref()` are discussed in <a target="_blank" href="/guide/essentials/reactivity-fundamentals.html">Guide - Reactivity Fundamentals</a>.
37+
`reactive()` `ref()` の詳細については、<a target="_blank" href="/guide/essentials/reactivity-fundamentals.html">ガイド - リアクティビティの基礎</a>で説明します。
3838

3939
<div class="sfc">
4040

41-
Reactive state declared in the component's `<script setup>` block can be used directly in the template. This is how we can render dynamic text based on the value of the `state` object and `message` ref, using mustaches syntax:
41+
コンポーネントの `<script setup>` ブロックで宣言されたリアクティブステートはテンプレートで直接使用することができます。このようにして、mustaches 構文を使い、 `state` オブジェクトと `message` ref の値に基づいて動的なテキストをレンダリングすることができます:
4242

4343
</div>
4444

4545
<div class="html">
4646

47-
The object being passed to `createApp()` is a Vue component. A component's state should be declared inside its `setup()` function, and returned using an object:
47+
`createApp()` に渡されるオブジェクトは Vue のコンポーネントです。コンポーネントの状態は、その `setup()` 関数内で宣言され、オブジェクトを使用して返される必要があります:
4848

4949
```js{2,5}
5050
setup() {
@@ -57,7 +57,7 @@ setup() {
5757
}
5858
```
5959

60-
Properties in the returned object will be made available in the template. This is how we can render dynamic text based on the value of `message`, using mustaches syntax:
60+
返されたオブジェクトのプロパティはテンプレートで利用できるようになります。このようにして、mustaches 構文を使い、 `message` の値に基づいて動的なテキストをレンダリングすることができます:
6161

6262
</div>
6363

@@ -66,15 +66,15 @@ Properties in the returned object will be made available in the template. This i
6666
<p>count is: {{ counter.count }}</p>
6767
```
6868

69-
Notice how we did not need to use `.value` when accessing the `message` ref in templates: it is automatically unwrapped for more succinct usage.
69+
テンプレートで `message` ref にアクセスする際、`.value` を使用する必要がないことに注意してください。自動的にアンラップされ、より簡潔な使い方ができます。
7070

7171
</div>
7272

7373
<div class="options-api">
7474

75-
State that can trigger updates when changed are considered **reactive**. In Vue, reactive state is held in components. In the example code, the object being passed to `createApp()` is a component.
75+
変更されたときに更新のトリガーとなるような状態は**リアクティブ**とみなされます。Vue では、リアクティブステートはコンポーネントに保持されます。例のコードでは、`createApp()` に渡されるオブジェクトがコンポーネントになっています。
7676

77-
We can declare reactive state using the `data` component option, which should be a function that returns an object:
77+
`data` コンポーネントオプションを使ってリアクティブステートを宣言することができますが、これはオブジェクトを返す関数であるべきです。
7878

7979
<div class="sfc">
8080

@@ -103,28 +103,28 @@ createApp({
103103

104104
</div>
105105

106-
The `message` property will be made available in the template. This is how we can render dynamic text based on the value of `message`, using mustaches syntax:
106+
`message` プロパティはテンプレート内で使用可能です。このように、 mustaches 構文を使い、 `message` の値に基づいた動的なテキストをレンダリングすることができます。
107107

108108
```vue-html
109109
<h1>{{ message }}</h1>
110110
```
111111

112112
</div>
113113

114-
The content inside the mustaches is not limited to just identifiers or paths - we can use any valid JavaScript expression:
114+
mustaches の内側の内容は識別子やパスに限られません。有効な JavaScript の式であれば何でも使うことができます:
115115

116116
```vue-html
117117
<h1>{{ message.split('').reverse().join('') }}</h1>
118118
```
119119

120120
<div class="composition-api">
121121

122-
Now, try to create some reactive state yourself, and use it to render dynamic text content for the `<h1>` in the template.
122+
では、自分でリアクティブステートを作成し、それを使ってテンプレートの `<h1>` に動的なテキストコンテンツをレンダリングしてみましょう。
123123

124124
</div>
125125

126126
<div class="options-api">
127127

128-
Now, try to create a data property yourself, and use it as the text content for the `<h1>` in the template.
128+
では、自分でデータプロパティを作成して、テンプレート内の `<h1>` のテキストコンテンツとして使ってみてください。
129129

130130
</div>

0 commit comments

Comments
 (0)