Skip to content

Commit 42c21ce

Browse files
committed
translate 03-advanced-svelte/09-special-elements into Japanese
1 parent 240bcfb commit 42c21ce

File tree

8 files changed

+42
-42
lines changed

8 files changed

+42
-42
lines changed

content/tutorial/03-advanced-svelte/09-special-elements/01-svelte-self/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: <svelte:self>
33
---
44

5-
Svelte provides a variety of built-in elements. The first, `<svelte:self>`, allows a component to contain itself recursively.
5+
Svelteは様々な組み込み要素を提供します。最初に `<svelte:self>` はコンポーネントがそれ自身を再帰的に含むことを可能にします。
66

7-
It's useful for things like this folder tree view, where folders can contain _other_ folders. In `Folder.svelte` we want to be able to do this...
7+
これはこのフォルダツリービューのように、フォルダの中に *他の* フォルダを含むことができるようにするのに便利です。`Folder.svelte` では、このようなことができるようにしたいのですが…
88

99
```svelte
1010
{#if file.files}
@@ -14,7 +14,7 @@ It's useful for things like this folder tree view, where folders can contain _ot
1414
{/if}
1515
```
1616

17-
...but that's impossible, because a module can't import itself. Instead, we use `<svelte:self>`:
17+
…しかし、モジュールは自分自身をインポートすることができないので、それは不可能です。代わりに `<svelte:self>` を使います。
1818

1919
```svelte
2020
{#if file.files}

content/tutorial/03-advanced-svelte/09-special-elements/02-svelte-component/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: <svelte:component>
33
---
44

5-
A component can change its category altogether with `<svelte:component>`. Instead of a sequence of `if` blocks...
5+
コンポーネントは `<svelte:component>` でカテゴリを完全に変更することができます。一連の `if` ブロックの代わりに…
66

77
```svelte
88
{#if selected.color === 'red'}
@@ -14,10 +14,10 @@ A component can change its category altogether with `<svelte:component>`. Instea
1414
{/if}
1515
```
1616

17-
...we can have a single dynamic component:
17+
…我々は単一の動的なコンポーネントを持つことができます。
1818

1919
```svelte
2020
<svelte:component this={selected.component}/>
2121
```
2222

23-
The `this` value can be any component constructor, or a falsy value — if it's falsy, no component is rendered.
23+
`this` 値には任意のコンポーネントコンストラクタ、または falsy な値を指定できます。falsy の値を指定した場合、コンポーネントはレンダリングされません。

content/tutorial/03-advanced-svelte/09-special-elements/03-svelte-window/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
title: <svelte:window>
33
---
44

5-
Just as you can add event listeners to any DOM element, you can add event listeners to the `window` object with `<svelte:window>`.
5+
イベントリスナーを任意の DOM 要素に追加できるのと同じように、`window` オブジェクトにも `<svelte:window>` でイベントリスナーを追加できます。
66

7-
On line 11, add the `keydown` listener:
7+
11行目に `keydown` リスナーを追加します。
88

99
```svelte
1010
<svelte:window on:keydown={handleKeydown}/>
1111
```
1212

13-
> As with DOM elements, you can add [event modifiers](/tutorial/event-modifiers) like `preventDefault`.
13+
> DOM要素と同様に `preventDefault` のような[イベント修飾子](/tutorial/event-modifiers)を追加することができます。

content/tutorial/03-advanced-svelte/09-special-elements/04-svelte-window-bindings/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
title: <svelte:window> bindings
33
---
44

5-
We can also bind to certain properties of `window`, such as `scrollY`. Update line 7:
5+
また、`window` の特定のプロパティ、例えば `scrollY` のようなプロパティにバインドすることもできます。7行目を更新してください。
66

77
```svelte
88
<svelte:window bind:scrollY={y}/>
99
```
1010

11-
The list of properties you can bind to is as follows:
11+
バインドできるプロパティの一覧は以下の通りです。
1212

13-
- `innerWidth`
14-
- `innerHeight`
15-
- `outerWidth`
16-
- `outerHeight`
17-
- `scrollX`
18-
- `scrollY`
19-
- `online`an alias for `window.navigator.onLine`
13+
* `innerWidth`
14+
* `innerHeight`
15+
* `outerWidth`
16+
* `outerHeight`
17+
* `scrollX`
18+
* `scrollY`
19+
* `online`これは `window.navigator.onLine` の別名です
2020

21-
All except `scrollX` and `scrollY` are readonly.
21+
`scrollX` `scrollY` 以外はすべて読み込み専用です。

content/tutorial/03-advanced-svelte/09-special-elements/05-svelte-body/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: <svelte:body>
33
---
44

5-
Similar to `<svelte:window>`, the `<svelte:body>` element allows you to listen for events that fire on `document.body`. This is useful with the `mouseenter` and `mouseleave` events, which don't fire on `window`.
5+
`<svelte:window>` と同様に、`<svelte:body>` 要素では `document.body` で発生するイベントをリッスンすることができます。これは `window` では発生しない `mouseenter` `mouseleave` イベントを利用する際に便利です。
66

7-
Add the `mouseenter` and `mouseleave` handlers to the `<svelte:body>` tag:
7+
`<svelte:body>` タグに `mouseenter` `mouseleave` ハンドラを追加してください。
88

99
```svelte
1010
<svelte:body
1111
on:mouseenter={handleMouseenter}
1212
on:mouseleave={handleMouseleave}
1313
/>
14-
```
14+
```

content/tutorial/03-advanced-svelte/09-special-elements/06-svelte-head/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
title: <svelte:head>
33
---
44

5-
The `<svelte:head>` element allows you to insert elements inside the `<head>` of your document:
5+
`<svelte:head>` 要素を使うと、ドキュメントの `<head>` 内に要素を挿入することができます。
66

77
```svelte
88
<svelte:head>
99
<link rel="stylesheet" href="tutorial/dark-theme.css">
1010
</svelte:head>
1111
```
1212

13-
> In server-side rendering (SSR) mode, contents of `<svelte:head>` are returned separately from the rest of your HTML.
13+
> サーバサイドレンダリング (SSR) モードでは、`<svelte:head>` の内容は残りのHTMLとは別に返されます。

content/tutorial/03-advanced-svelte/09-special-elements/07-svelte-options/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
title: <svelte:options>
33
---
44

5-
The `<svelte:options>` element allows you to specify compiler options.
5+
`<svelte:options>` 要素はコンパイラのオプションを指定することができます。
66

7-
We'll use the `immutable` option as an example. In this app, the `<Todo>` component flashes whenever it receives new data. Clicking on one of the items toggles its `done` state by creating an updated `todos` array. This causes the _other_ `<Todo>` items to flash, even though they don't end up making any changes to the DOM.
7+
例として `immutable` オプションを使用します。このアプリでは、新しいデータを受け取るたびに `<Todo>` コンポーネントが点滅します。アイテムの1つをクリックすると、更新された `todos` 配列が作成され、`done` 状態が切り替わります。これにより、*他の* `<Todo>` アイテムも点滅しますが、DOM は変更されません。
88

9-
We can optimise this by telling the `<Todo>` component to expect _immutable_ data. This means that we're promising never to _mutate_ the `todo` prop, but will instead create new todo objects whenever things change.
9+
これを最適化するには、`<Todo>` コンポーネントに *immutable* データを期待するように指示します。これは、`todo` プロパティを *変更* しないことを約束していることを意味します。
1010

11-
Add this to the top of the `Todo.svelte` file:
11+
これを `Todo.svelte` ファイルの先頭に追加します。
1212

1313
```svelte
1414
<svelte:options immutable={true}/>
1515
```
1616

17-
> You can shorten this to `<svelte:options immutable/>` if you prefer.
17+
> お好みであれば、これを `<svelte:options immutable/>` と短くしても構いません。
1818
19-
Now, when you toggle todos by clicking on them, only the updated component flashes.
19+
これで、Todos をクリックして切り替えると、更新されたコンポーネントだけが点滅するようになりました。
2020

21-
The options that can be set here are:
21+
ここで設定できるオプションは
2222

23-
- `immutable={true}`you never use mutable data, so the compiler can do simple referential equality checks to determine if values have changed
24-
- `immutable={false}`the default. Svelte will be more conservative about whether or not mutable objects have changed
25-
- `accessors={true}`adds getters and setters for the component's props
26-
- `accessors={false}`the default
27-
- `namespace="..."`the namespace where this component will be used, most commonly `"svg"`
28-
- `tag="..."`the name to use when compiling this component as a custom element
23+
* `immutable={true}`変更可能なデータは使用できません、コンパイラは値が変更されたかどうかを判断するために単純な参照等価性チェックを行うことができます。
24+
* `immutable={false}`デフォルトです。Svelteは、変更可能なオブジェクトが変更されたかどうかについて、より保守的になります。
25+
* `accessors={true}`コンポーネントのプロパティ(props)のゲッターとセッターを追加します。
26+
* `accessors={false}`デフォルトの値です。
27+
* `namespace="..."` このコンポーネントが使用される名前空間。最も一般的なものは `"svg"` です。
28+
* `tag="..."`このコンポーネントをカスタム要素としてコンパイルする際に使用する名前。
2929

30-
Consult the [API reference](https://svelte.dev/docs) for more information on these options.
30+
これらのオプションの詳細については、[API リファレンス](/docs)を参照してください。

content/tutorial/03-advanced-svelte/09-special-elements/08-svelte-fragment/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: <svelte:fragment>
33
---
44

5-
The `<svelte:fragment>` element allows you to place content in a named slot without wrapping it in a container DOM element. This keeps the flow layout of your document intact.
5+
`<svelte:fragment>` 要素は、コンテナ DOM 要素でラップすることなく、名前のついたスロットにコンテンツを配置する事ができます。これによりドキュメントのフローレイアウトが維持されます。
66

7-
In the example notice how we applied a flex layout with a gap of `1em` to the box.
7+
例では box クラスに `1em` の gap を持つ flex レイアウトを適用しています。
88

99
```sv
1010
<!-- Box.svelte -->
@@ -23,9 +23,9 @@ In the example notice how we applied a flex layout with a gap of `1em` to the bo
2323
</style>
2424
```
2525

26-
However, the content in the footer is not spaced out according to this rhythm because wrapping it in a div created a new flow layout.
26+
しかしながら、footer のコンテンツは新たなフローレイアウトを生成した div 要素でラップされているため、このリズムに沿った配置がされていません。
2727

28-
We can solve this by changing `<div slot="footer">` in the `App` component. Replace the `<div>` with `<svelte:fragment>`:
28+
これは `App` コンポーネントの `<div slot="footer">` を書き換えることで解決できます。この `<div>` `<svelte:fragment>` に書き換えます。
2929

3030
```sv
3131
<svelte:fragment slot="footer">

0 commit comments

Comments
 (0)