Skip to content

Commit b968996

Browse files
authored
Merge pull request #9 from tomoam/translate-04-advanced-loading
色々翻訳
2 parents 09372cb + cc1b439 commit b968996

File tree

33 files changed

+136
-136
lines changed

33 files changed

+136
-136
lines changed

content/tutorial/01-svelte/01-introduction/03-dynamic-attributes/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22
title: Dynamic attributes
33
---
44

5-
Just like you can use curly braces to control text, you can use them to control element attributes.
5+
テキストをコントロールするのに中括弧を使えるのと同じように、要素の属性をコントロールするのに中括弧を使うことができます。
66

7-
Our image is missing a `src` — let's add one:
7+
画像 (image) に `src` がありません。これを追加してみましょう。
88

99
```svelte
1010
<img +++src={src}+++ />
1111
```
1212

13-
That's better. But Svelte is giving us a warning:
13+
これでよくなりました。ただし、まだ警告が表示され続けています。
1414

1515
> A11y: &lt;img&gt; element should have an alt attribute
1616
17-
When building web apps, it's important to make sure that they're _accessible_ to the broadest possible userbase, including people with (for example) impaired vision or motion, or people without powerful hardware or good internet connections. Accessibility (shortened to a11y) isn't always easy to get right, but Svelte will help by warning you if you write inaccessible markup.
17+
Webアプリケーションは、例えば視覚や動作に障害のある方や、高スペックな端末や高速なインターネット回線を持っていない方など、可能な限り幅広いユーザーにとって*使いやすいものである*ことが重要です。アクセシビリティ(Accessibility、略:a11y)を正しく行うことは簡単ではありませんが、Svelteは警告を表示してa11yを正しく行う手助けをしてくれます。
1818

19-
In this case, we're missing the `alt` attribute that describes the image for people using screenreaders, or people with slow or flaky internet connections that can't download the image. Let's add one:
19+
この場合、スクリーンリーダー(画面読み上げソフト)を使用するユーザーやインターネット回線が低速・不安定で画像をダウンロードできないユーザーに必要な`alt`という画像を説明する属性が足りていません。追加しましょう。
2020

2121
```svelte
2222
<img src={src} +++alt="A man dances."+++ />
2323
```
2424

25-
We can use curly braces _inside_ attributes. Try changing it to `"{name} dances."` — remember to declare a `name` variable in the `<script>` block.
25+
要素の**でも中括弧を使用することができます。`<script>`ブロックの中に`name`変数を宣言し、`A man dances.``"{name} dances."`に変更してみましょう。
2626

2727
## Shorthand attributes
2828

29-
It's not uncommon to have an attribute where the name and value are the same, like `src={src}`. Svelte gives us a convenient shorthand for these cases:
29+
`src={src}`のように、属性の名前と値の変数が一致することは珍しくありません。このような場合、Svelteでは省略して書くことができます。
3030

3131
```svelte
3232
<img +++{src}+++ alt="A man dances." />

content/tutorial/01-svelte/01-introduction/04-styling/README.md

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

5-
HTMLと同じように、コンポーネントには `<style>` タグを置くことができます。`<p>` 要素にいくつかスタイルを追加してみましょう。
5+
HTMLと同じように、コンポーネントには`<style>`タグを置くことができます。`<p>`要素にいくつかスタイルを追加してみましょう。
66

77
```svelte
88
<p>This is a paragraph.</p>
@@ -16,4 +16,4 @@ HTMLと同じように、コンポーネントには `<style>` タグを置く
1616
</style>
1717
```
1818

19-
重要なのは、これらのスタイルが _このコンポーネントにのみ適用されるということです_ 。次のステップで説明しますが、別の箇所の `<p>` 要素のスタイルに影響を与えてしまうようなことはありません。
19+
重要なのは、これらのスタイルが*このコンポーネントにのみ適用されるということです*。次のステップで説明しますが、別の箇所の`<p>`要素のスタイルに影響を与えてしまうようなことはありません。

content/tutorial/01-svelte/01-introduction/05-nested-components/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
title: Nested components
33
---
44

5-
It would be impractical to put your entire app in a single component. Instead, we can import components from other files and include them in our markup.
5+
アプリ全体を単一のコンポーネントにまとめるのは現実的ではありません。代わりに、他のファイルからコンポーネントをインポートし、マークアップでそれを使用することができます。
66

7-
Add a `<script>` tag that imports `Nested.svelte`...
7+
`<script>` タグを追加して `Nested.svelte` をインポートしましょう…
88

99
```svelte
1010
+++<script>
1111
import Nested from './Nested.svelte';
1212
</script>+++
1313
```
1414

15-
...and include a `<Nested />` component:
15+
…そして `<Nested />` コンポーネントを使用します。
1616

1717
```svelte
1818
<p>This is a paragraph.</p>
1919
+++<Nested />+++
2020
```
2121

22-
Notice that even though `Nested.svelte` has a `<p>` element, the styles from `App.svelte` don't leak in.
22+
`Nested.svelte` には `<p>` 要素がありますが、`App.svelte` のスタイルが適用されていないことに注目してください。
2323

24-
> Component names are always capitalised, to distinguish them from HTML elements.
24+
> HTML 要素と区別するため、コンポーネントの名前は常に大文字で始まっています

content/tutorial/01-svelte/01-introduction/06-html-tags/README.md

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

5-
Ordinarily, strings are inserted as plain text, meaning that characters like `<` and `>` have no special meaning.
5+
通常、文字列はプレーンテキストとして挿入され、`<``>`のような文字は特別な意味を持ちません。
66

7-
But sometimes you need to render HTML directly into a component. For example, the words you're reading right now exist in a markdown file that gets included on this page as a blob of HTML.
7+
しかし、HTMLをコンポーネントに直接レンダリングする必要がある場合もあります。例えば、あなたが今読んでいる文章はマークダウンファイルに存在し、HTMLのblobとしてこのページに含まれています。
88

9-
In Svelte, you do this with the special `{@html ...}` tag:
9+
Svelteでは、`{@html ...}` という特別なタグを使ってこれを行います。
1010

1111
```svelte
1212
<p>{+++@html+++ string}</p>
1313
```
1414

15-
> Svelte doesn't perform any sanitization of the expression inside `{@html ...}` before it gets inserted into the DOM. In other words, if you use this feature it's critical that you manually escape HTML that comes from sources you don't trust, otherwise you risk exposing your users to XSS attacks.
15+
> Svelte は DOM に挿入される前に `{@html ...}` 内の式のサニタイズを行いません。違う言い方をすれば、この機能を使用する場合は信頼できないソースから来た HTML を手動でエスケープすることが重要です、そうしなければユーザーをXSS攻撃にさらす危険性があります。

content/tutorial/01-svelte/02-reactivity/01-reactive-assignments/README.md

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

5-
At the heart of Svelte is a powerful system of _reactivity_ for keeping the DOM in sync with your application state — for example, in response to an event.
5+
Svelteの中心には、DOMを(例えば、イベントに応じて)アプリケーションの状態に同期し続けさせるための強力な *reactivity* システムがあります。
66

7-
To demonstrate it, we first need to wire up an event handler (we'll learn more about these [later](/tutorial/dom-events)):
7+
これを実演するには、まずイベントハンドラ (これは[後ほど](/tutorial/dom-events)学習します) を定義する必要があります。
88

99
```svelte
1010
<button +++on:click={increment}+++>
1111
```
1212

13-
Inside the `increment` function, all we need to do is change the value of `count`:
13+
`increment` 関数の内側で必要なのは `count` の値を変更することだけです。
1414

1515
```js
1616
function increment() {
1717
+++count += 1;+++
1818
}
1919
```
2020

21-
Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.
21+
Svelteは、DOMが更新される必要があることを伝えるコードをこの代入に'取り付け'ます。

content/tutorial/01-svelte/02-reactivity/02-reactive-declarations/README.md

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

5-
Svelte automatically updates the DOM when your component's state changes. Often, some parts of a component's state need to be computed from _other_ parts (such as a `fullname` derived from a `firstname` and a `lastname`), and recomputed whenever they change.
5+
Svelte は、コンポーネントの状態が変更されると自動的に DOM を更新します。しばしば、コンポーネントの状態には、 _他の_ 状態から計算しなければならない部分があり (例えば、`firstname``lastname` から派生する `fullname`)、それらが変更されるたびに再計算しなければなりません。
66

7-
For these, we have _reactive declarations_. They look like this:
7+
これに対応するために、 _リアクティブ宣言(reactive declarations)_ があります。次のように記述します。
88

99
```js
1010
let count = 0;
1111
+++$: doubled = count * 2;+++
1212
```
1313

14-
> Don't worry if this looks a little alien. It's [valid](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label) (if unconventional) JavaScript, which Svelte interprets to mean 're-run this code whenever any of the referenced values change'. Once you get used to it, there's no going back.
14+
> これが少し異質に見えても心配しないでください。これは(見慣れないかもしれませんが) [正しい](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Statements/label) JavaScript で、Svelte は「参照される値が変わるたびにこのコードを再実行する」という意味だと解釈します。一度慣れてしまえば、もう戻れません。
1515
16-
Let's use `doubled` in our markup:
16+
マークアップで `doubled` を使ってみましょう。
1717

1818
```svelte
1919
<button>...</button>
2020
2121
+++<p>{count} doubled is {doubled}</p>+++
2222
```
2323

24-
Of course, you could just write `{count * 2}` in the markup instead — you don't have to use reactive values. Reactive values become particularly valuable (no pun intended) when you need to reference them multiple times, or you have values that depend on _other_ reactive values.
24+
もちろん、代わりに `{count * 2}` とマークアップに書くだけでもよいでしょう。リアクティブな値を使用する必要はありません。リアクティブな値は、複数回参照する必要がある場合や、*他の* リアクティブな値に依存する値がある場合に特に価値があります。

content/tutorial/01-svelte/02-reactivity/03-reactive-statements/README.md

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

5-
We're not limited to declaring reactive _values_ — we can also run arbitrary _statements_ reactively. For example, we can log the value of `count` whenever it changes:
5+
リアクティブな ** を宣言するだけでなく、任意の *ステートメント* をリアクティブに実行することもできます。例えば、`count` の値が変化するたびにログを取ることができます。
66

77
```js
88
let count = 0;
99

1010
+++$: console.log(`the count is ${count}`);+++
1111
```
1212

13-
You can easily group statements together with a block:
13+
ブロックで簡単にステートメントをグループ化することができます。
1414

1515
```js
1616
$: +++{+++
@@ -19,7 +19,7 @@ $: +++{+++
1919
+++}+++
2020
```
2121

22-
You can even put the `$:` in front of things like `if` blocks:
22+
`if` ブロックなどの前に `$:` を置くこともできます。
2323

2424
```js
2525
$: +++if (count >= 10)+++ {

content/tutorial/01-svelte/02-reactivity/04-updating-arrays-and-objects/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: Updating arrays and objects
33
---
44

5-
Because Svelte's reactivity is triggered by assignments, using array methods like `push` and `splice` won't automatically cause updates. For example, clicking the 'Add a number' button doesn't currently do anything.
5+
Svelte のりアクティビティは代入によってトリガーされるため、`push` `splice` のような配列のメソッドを使用しても更新が自動的に行われません。例えば、'Add a number' ボタンをクリックしても今のところ何も起こりません。
66

7-
One way to fix that is to add an assignment that would otherwise be redundant:
7+
これを修正する方法の1つとして、冗長に見えるかもしれませんが、代入を追加することです。
88

99
```js
1010
function addNumber() {
@@ -13,29 +13,29 @@ function addNumber() {
1313
}
1414
```
1515

16-
But there's a more idiomatic solution:
16+
もう少し慣用的な解決策もあります。
1717

1818
```js
1919
function addNumber() {
2020
numbers = +++[...numbers, numbers.length + 1];+++
2121
}
2222
```
2323

24-
You can use similar patterns to replace `pop`, `shift`, `unshift` and `splice`.
24+
同様のパターンで、`pop``shift``unshift``splice` を置き換えることができます。
2525

26-
Assignments to _properties_ of arrays and objects — e.g. `obj.foo += 1` or `array[i] = x` — work the same way as assignments to the values themselves.
26+
配列やオブジェクトの *プロパティ* への代入(例:`obj.foo += 1` `array[i] = x`)は値自体への代入と同じように動作します。
2727

2828
```js
2929
function addNumber() {
3030
numbers[numbers.length] = numbers.length + 1;
3131
}
3232
```
3333

34-
A simple rule of thumb: the name of the updated variable must appear on the left hand side of the assignment. For example this...
34+
大まかなまとめ: 更新される変数の名前は、代入の左側に置かなければならない。例えばこれは…
3535

3636
```js
3737
const foo = obj.foo;
3838
foo.bar = 'baz';
3939
```
4040

41-
...won't trigger reactivity on `obj.foo.bar`, unless you follow it up with `obj = obj`.
41+
`obj.foo.bar` に対するリアクティビティはトリガーされません。もしトリガーしたければ、`obj = obj` を続けて書く必要があります。

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の最適化が難しいため、一般的には推奨されませんが、ごくまれなケースでは便利です。

content/tutorial/01-svelte/04-logic/01-if-blocks/README.md

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

5-
HTML doesn't have a way of expressing _logic_, like conditionals and loops. Svelte does.
5+
HTML には条件式やループのような *ロジック* を表現する方法がありません。Svelteにはあります。
66

7-
To conditionally render some markup, we wrap it in an `if` block:
7+
条件付きでマークアップをレンダリングするために、私たちはそれを `if` ブロックで囲みます。
88

99
```svelte
1010
+++{#if user.loggedIn}+++
@@ -20,4 +20,4 @@ To conditionally render some markup, we wrap it in an `if` block:
2020
+++{/if}+++
2121
```
2222

23-
Try it — update the component, and click on the buttons.
23+
試してみてください。コンポーネントを更新し、ボタンをクリックしてみてください。

content/tutorial/01-svelte/04-logic/02-else-blocks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Else blocks
33
---
44

5-
Since the two conditions — `if user.loggedIn` and `if !user.loggedIn` — are mutually exclusive, we can simplify this component slightly by using an `else` block:
5+
2つの条件(`if user.loggedIn` `if !user.loggedIn`)は相互に排他的なので、`else` ブロックを使用することでこのコンポーネントを少しシンプルにすることができます。
66

77
```svelte
88
{#if user.loggedIn}
@@ -16,4 +16,4 @@ Since the two conditions — `if user.loggedIn` and `if !user.loggedIn` — are
1616
{/if}
1717
```
1818

19-
> A `#` character always indicates a _block opening_ tag. A `/` character always indicates a _block closing_ tag. A `:` character, as in `{:else}`, indicates a _block continuation_ tag. Don't worry — you've already learned almost all the syntax Svelte adds to HTML.
19+
> `#` の文字は常に *ブロックの開始* タグを示します。 `/` の文字は常に *ブロックの終了* タグを示します。 `:` の文字は `{:else}` のように *ブロックの継続* タグを示します。心配しないでください。あなたは既にSvelteがHTMLに追加する構文のほとんどを学んでいます。

content/tutorial/01-svelte/04-logic/03-else-if-blocks/README.md

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

5-
Multiple conditions can be 'chained' together with `else if`:
5+
複数の条件を `else if` と一緒に '連結' することができます。
66

77
```svelte
88
{#if x > 10}

0 commit comments

Comments
 (0)