Skip to content

Commit 519f8e6

Browse files
committed
translate 01-svelte/03-props into Japanese
1 parent 1430829 commit 519f8e6

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

content/tutorial/01-svelte/03-props/01-declaring-props/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: Declaring props
33
---
44

5-
So far, we've dealt exclusively with internal state — that is to say, the values are only accessible within a given component.
5+
これまで、内部状態についてのみ扱ってきました。- つまり、値はそのコンポーネント内からしかアクセスできないということです。
66

7-
In any real application, you'll need to pass data from one component down to its children. To do that, we need to declare _properties_, generally shortened to 'props'. In Svelte, we do that with the `export` keyword. Edit the `Nested.svelte` component:
7+
実際のアプリケーションでは、あるコンポーネントから、その子コンポーネントにデータを渡す必要があります。そのためには、*プロパティ(properties)*を宣言する必要があります。通常は 'props'と省略されます。Svelteでは、`export`というキーワードを使用してこれを行います。`Nested.svelte`コンポーネントを編集してみましょう。
88

99
```svelte
1010
<script>
1111
+++export+++ let answer;
1212
</script>
1313
```
1414

15-
> Just like `$:`, this may feel a little weird at first. That's not how `export` normally works in JavaScript modules! Just roll with it for now — it'll soon become second nature.
15+
> `$:`と同じように、最初は少し奇妙に感じるかもしれません。これはJavaScriptモジュールの通常の`export`とは動作が異なりますので!とりあえず今は使っていってください。すぐに慣れるでしょう。

content/tutorial/01-svelte/03-props/02-default-values/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
title: Default values
33
---
44

5-
We can easily specify default values for props in `Nested.svelte`:
5+
`Nested.svelte`のプロパティのデフォルト値を簡単に指定することができます。
66

77
```svelte
88
<script>
99
export let answer +++= 'a mystery'+++;
1010
</script>
1111
```
1212

13-
If we now add a second component _without_ an `answer` prop, it will fall back to the default:
13+
`answer`プロパティなしで2つ目のコンポーネントを追加すると、デフォルト値にフォールバックします。
1414

1515
```svelte
1616
<Nested answer={42}/>

content/tutorial/01-svelte/03-props/03-spread-props/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: Spread props
33
---
44

5-
If you have an object of properties, you can 'spread' them onto a component instead of specifying each one:
5+
オブジェクトがプロパティを持っている場合、それぞれ個別に指定する代わりに、コンポーネントに '展開'することができます。
66

77
```svelte
88
<PackageInfo +++{...pkg}+++/>
99
```
1010

11-
> Conversely, if you need to reference all the props that were passed into a component, including ones that weren't declared with `export`, you can do so by accessing `$$props` directly. It's not generally recommended, as it's difficult for Svelte to optimise, but it's useful in rare cases.
11+
> 逆に、`export`で宣言されていないものも含め、もしコンポーネントに渡されたすべてのプロパティ(props)を参照する必要がある場合は、`$$props`で直接参照することができます。これは、Svelteの最適化が難しいため、一般的には推奨されませんが、ごくまれなケースでは便利です。

0 commit comments

Comments
 (0)