Skip to content

Commit 32b4ba7

Browse files
committed
translate 01-svelte/06-bindings into Japanese
1 parent cc1b439 commit 32b4ba7

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

content/tutorial/01-svelte/06-bindings/01-text-inputs/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: Text inputs
33
---
44

5-
As a general rule, data flow in Svelte is _top down_ — a parent component can set props on a child component, and a component can set attributes on an element, but not the other way around.
5+
原則、Svelteのデータフローはトップダウンです。親コンポーネントは子コンポーネントにプロパティをセットできますし、コンポーネントは要素に属性をセットできますが、その逆はできません。
66

7-
Sometimes it's useful to break that rule. Take the case of the `<input>` element in this component — we _could_ add an `on:input` event handler that sets the value of `name` to `event.target.value`, but it's a bit... boilerplatey. It gets even worse with other form elements, as we'll see.
7+
時々、そのルールを破ると便利なことがあります。このコンポーネントの`<input>`要素の例で考えてみましょう。`on:input`イベントハンドラを追加して、`name`の値を`event.target.value`に設定できますが、それは少し…面倒(boilerplatey)です。想像がつくと思いますが、他のフォーム要素ではそれがさらに悪化します。
88

9-
Instead, we can use the `bind:value` directive:
9+
代わりに、`bind:value`を使用することができます。
1010

1111
```svelte
1212
<input bind:value={name}>
1313
```
1414

15-
This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`.
15+
これは`name`の値が変更されるとinputの値が更新されるだけでなく、inputの値が変更されると`name`の値が更新されることを意味します。

content/tutorial/01-svelte/06-bindings/02-numeric-inputs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: Numeric inputs
33
---
44

5-
In the DOM, everything is a string. That's unhelpful when you're dealing with numeric inputs — `type="number"` and `type="range"` — as it means you have to remember to coerce `input.value` before using it.
5+
DOMの中では、全てが文字列(string)です。これは、数値のinput(`type="number"` `type="range"`)を扱う際、その値を取り出す時に`input.value`を使わなければならないため、不便です。
66

7-
With `bind:value`, Svelte takes care of it for you:
7+
`bind:value`を使用すれば、Svelteがそれを代行してくれます。
88

99
```svelte
1010
<input type=number bind:value={a} min=0 max=10>

content/tutorial/01-svelte/06-bindings/03-checkbox-inputs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Checkbox inputs
33
---
44

5-
Checkboxes are used for toggling between states. Instead of binding to `input.value`, we bind to `input.checked`:
5+
チェックボックスは状態を切り替えるのに使用されます。`input.value`にバインドする代わりに、`input.checked`にバインドします。
66

77
```svelte
88
<input type=checkbox bind:checked={yes}>

content/tutorial/01-svelte/06-bindings/04-group-inputs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
title: Group inputs
33
---
44

5-
If you have multiple inputs relating to the same value, you can use `bind:group` along with the `value` attribute. Radio inputs in the same group are mutually exclusive; checkbox inputs in the same group form an array of selected values.
5+
同じ値に関係する複数のinputがあるなら、`value`属性に加えて`bind:group`を使用できます。同じグループ内のラジオinputは相互に排他的で、同じグループ内のチェックボックスinputは選択された値の配列を形成します。
66

7-
Add `bind:group` to each input:
7+
各inputに`bind:group`を追加しましょう。
88

99
```svelte
1010
<input type=radio bind:group={scoops} name="scoops" value={1}>
1111
```
1212

13-
In this case, we could make the code simpler by moving the checkbox inputs into an `each` block. First, add a `menu` variable to the `<script>` block...
13+
この場合、チェックボックスinputを`each`ブロックに移動させることでコードをよりシンプルにすることができます。まず、`<script>`ブロックに`menu`変数を追加します。
1414

1515
```js
1616
let menu = ['Cookies and cream', 'Mint choc chip', 'Raspberry ripple'];
1717
```
1818

19-
...then replace the second section:
19+
…それから2つ目のセクションを置き換えます。
2020

2121
```svelte
2222
<h2>Flavours</h2>
@@ -29,4 +29,4 @@ let menu = ['Cookies and cream', 'Mint choc chip', 'Raspberry ripple'];
2929
{/each}
3030
```
3131

32-
It's now easy to expand our ice cream menu in new and exciting directions.
32+
アイスクリームのメニューを新しいエキサイティングな方向に簡単に拡張できるようになりました。

content/tutorial/01-svelte/06-bindings/05-textarea-inputs/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
title: Textarea inputs
33
---
44

5-
> This exercise doesn't currently work. You can switch to the old tutorial instead: https://svelte.dev/tutorial/textarea-inputs
5+
> この練習問題は現時点では動作しません。代わりに、既存のチュートリアルをお試しください: https://svelte.jp/tutorial/textarea-inputs
66
7-
The `<textarea>` element behaves similarly to a text input in Svelte — use `bind:value`:
7+
Svelteでは、`<textarea>`要素はtext inputと同じように振る舞います。`bind:value`を使ってみましょう。
88

99
```svelte
1010
<textarea bind:value={value}></textarea>
1111
```
1212

13-
In cases like these, where the names match, we can also use a shorthand form:
13+
このように名前が一致する場合は、省略形を使用することもできます。
1414

1515
```svelte
1616
<textarea bind:value></textarea>
1717
```
1818

19-
This applies to all bindings, not just textareas.
19+
これはtextareaに限らず全てのバインディングに適用されます。

content/tutorial/01-svelte/06-bindings/06-select-bindings/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
title: Select bindings
33
---
44

5-
We can also use `bind:value` with `<select>` elements. Update line 32:
5+
`<select>`要素にも`bind:value`を使用できます。32行目を更新してください。
66

77
```svelte
88
<select bind:value={selected} on:change="{() => answer = ''}">
99
```
1010

11-
Note that the `<option>` values are objects rather than strings. Svelte doesn't mind.
11+
`<option>`の値は文字列ではなくオブジェクトであることにご注意ください。Svelteは気にしません。
1212

13-
> Because we haven't set an initial value of `selected`, the binding will set it to the default value (the first in the list) automatically. Be careful though — until the binding is initialised, `selected` remains undefined, so we can't blindly reference e.g. `selected.id` in the template.
13+
> `selected`の初期値を設定していないので、バインディングは自動的にデフォルト値(配列の先頭)に設定されます。しかし、注意してください。バインディングが初期化されるまで、`selected`はundefinedのままなので、よく考えもせずにテンプレート内の`selected.id`などを参照することはできません。

content/tutorial/01-svelte/06-bindings/07-multiple-select-bindings/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: Select multiple
33
---
44

5-
A select can have a `multiple` attribute, in which case it will populate an array rather than selecting a single value.
5+
select `multiple` 属性を持つことができ、その場合は単一の値を選択するのではなく配列を追加します。
66

7-
Returning to our [earlier ice cream example](/tutorial/group-inputs), we can replace the checkboxes with a `<select multiple>`:
7+
[先ほどのアイスクリームの例](/tutorial/group-inputs)に戻り、チェックボックスを `<select multiple>` で置き換えることができます。
88

99
```svelte
1010
<h2>Flavours</h2>
@@ -18,4 +18,4 @@ Returning to our [earlier ice cream example](/tutorial/group-inputs), we can rep
1818
</select>
1919
```
2020

21-
> Press and hold the `control` key (or the `command` key on MacOS) for selecting multiple options.
21+
> 複数のオプションを選択するには `control` キー (MacOSの場合は `command` キー) を押したままにしてください。

0 commit comments

Comments
 (0)