Skip to content

Commit d4bf917

Browse files
committed
translate 04-advanced-sveltekit/05-environment-variables into Japanese
1 parent 294ed6a commit d4bf917

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

content/tutorial/04-advanced-sveltekit/04-advanced-loading/01-await-parent/README.md

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

5-
As we saw in the introduction to [layout data](/tutorial/layout-data), `+page.svelte` and `+layout.svelte` components have access to everything returned from their parent `load` functions.
5+
[layout data](/tutorial/layout-data) のイントロダクションで見たように、`+page.svelte` コンポーネントと `+layout.svelte` コンポーネント は、親の `load` 関数から返された全てにアクセスすることができます。
66

7-
Occasionally it's useful for the `load` functions themselves to access data from their parents. This can be done with `await parent()`.
7+
時には、`load` 関数の中で親のデータにアクセスできると便利なことがあります。`await parent()` でこれを実現することができます。
88

9-
To show how it works, we'll sum two numbers that come from different `load` functions. First, return some data from `src/routes/+layout.server.js`:
9+
どのように動作するかを示すため、異なる `load` 関数で取得した2つの数値を足してみましょう。まず、`src/routes/+layout.server.js` からデータを返します。
1010

1111
```js
1212
/// file: src/routes/+layout.server.js
@@ -15,7 +15,7 @@ export function load() {
1515
}
1616
```
1717

18-
Then, get that data in `src/routes/sum/+layout.js`:
18+
次に、`src/routes/sum/+layout.js` でそのデータを取得します。
1919

2020
```js
2121
/// file: src/routes/sum/+layout.js
@@ -25,9 +25,9 @@ export async function load(+++{ parent }+++) {
2525
}
2626
```
2727

28-
> Notice that a [universal](/tutorial/universal-load-functions) `load` function can get data from a parent _server_ `load` function. The reverse is not true — a server load function can only get parent data from another server load function.
28+
> [ユニバーサル](/tutorial/universal-load-functions) `load` 関数は親の _サーバー_ `load` 関数からデータを取得することができます。その逆は真ではありません。サーバー load 関数は、別のサーバーロード関数からのみ親のデータを取得することができます。
2929
30-
Finally, in `src/routes/sum/+page.js`, get parent data from both `load` functions:
30+
最後に、`src/routes/sum/+page.js` で、両方の `load` 関数から返される親のデータを取得しましょう。
3131

3232
```js
3333
/// file: src/sum/+page.js
@@ -37,4 +37,4 @@ export async function load(+++{ parent }+++) {
3737
}
3838
```
3939

40-
> Take care not to introduce waterfalls when using `await parent()`. If you can `fetch` other data that is not dependent on parent data, do that first.
40+
> `await parent()` を使用する際はウォーターフォールを発生させないよう注意してください。親のデータに依存しない他のデータを取得(`fetch`)できるのであれば、そちらを先に行ってください。

content/tutorial/04-advanced-sveltekit/04-advanced-loading/02-using-both-load-functions/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: Using both load functions
33
---
44

5-
Occasionally, you might need to use a server load function and a universal load function together. For example, you might need to return data from the server, but also return a value that can't be serialized as server data.
5+
サーバー load 関数とユニバーサル load 関数を一緒に使うことが必要なときもあるでしょう。例えば、サーバーからデータを返す必要がある一方で、サーバーのデータとしてシリアライズできない値も返す必要があるケースです。
66

7-
In this example we want to return a different component from `load` depending on whether the data we got from `src/routes/+page.server.js` is `cool` or not.
7+
この例では、`src/routes/+page.server.js` から返されるデータが `cool` かそうでないかに応じて、`load` から異なるコンポーネントを返したいと思います。
88

9-
We can access server data in `src/routes/+page.js` via the `data` property:
9+
`src/routes/+page.js` で、`data` プロパティを使ってサーバーのデータにアクセスすることができます。
1010

1111
```js
1212
/// file: src/routes/+page.js
@@ -22,4 +22,4 @@ export async function load(+++{ data }+++) {
2222
}
2323
```
2424

25-
> Note that the data isn't merged — we must explicitly return `message` from the universal `load` function.
25+
> データがマージされていないことにご注意ください — 明示的にユニバーサル `load` 関数から `message` を返さなければなりません。

content/tutorial/04-advanced-sveltekit/04-advanced-loading/03-invalidation/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: Invalidation
33
path: /Europe/London
44
---
55

6-
When the user navigates from one page to another, SvelteKit calls your `load` functions, but only if it thinks something has changed.
6+
ユーザーがあるページから別のページに移動するとき、SvelteKit はなにか変更があったと判断した場合にのみ `load` 関数を呼び出します。
77

8-
In this example, navigating between timezones causes the `load` function in `src/routes/[...timezone]/+page.js` to re-run because `params.timezone` is invalid. But the `load` function in `src/routes/+layout.js` does _not_ re-run, because as far as SvelteKit is concerned it wasn't invalidated by the navigation.
8+
この例では、タイムゾーン間の移動によって `src/routes/[...timezone]/+page.js` にある `load` 関数が再実行されます。`load` 関数の `params.timezone` が無効(invalid)になるからです。しかし、`src/routes/+layout.js` にある `load` 関数は再実行されません。なぜなら、SvelteKit から見れば、ナビゲーションでは何も変わらなかったからです。
99

10-
We can fix that by manually invalidating it using the [`invalidate(...)`](https://kit.svelte.dev/docs/modules#$app-navigation-invalidate) function, which takes a URL and re-runs any `load` functions that depend on it. Because the `load` function in `src/routes/+layout.js` calls `fetch('http://github.com/api/now')`, it depends on `/api/now`.
10+
[`invalidate(...)`](https://kit.svelte.jp/docs/modules#$app-navigation-invalidate) 関数を使って、手動で無効化・最新化(invalidate)することでこれを修正できます。この関数は、URL を 引数に取り、それに依存している `load` 関数を再実行させます。`src/routes/+layout.js` にある `load` 関数は `fetch('http://github.com/api/now')` を呼び出しているため、`/api/now` に依存しています。
1111

12-
In `src/routes/[...timezone]/+page.svelte`, add an `onMount` callback that calls `invalidate('/api/now')` once a second:
12+
`src/routes/[...timezone]/+page.svelte` に、1秒に1回 `invalidate('/api/now')` を呼び出す `onMount` コールバックを追加します。
1313

1414
```svelte
1515
/// file: src/routes/[...timezone]/+page.svelte
@@ -38,4 +38,4 @@ In `src/routes/[...timezone]/+page.svelte`, add an `onMount` callback that calls
3838
</h1>
3939
```
4040

41-
> You can also pass a function to `invalidate`, in case you want to invalidate based on a pattern and not specific URLs
41+
> 特定の URL ではなくパターンに基づいて `invalidate` を実行したい場合、`invalidate` に関数を渡すこともできます。

content/tutorial/04-advanced-sveltekit/04-advanced-loading/04-custom-dependencies/README.md

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

5-
Calling `fetch(url)` inside a `load` function registers `url` as a dependency. Sometimes it's not appropriate to use `fetch`, in which case you can specify a dependency manually with the [`depends(url)`](https://kit.svelte.dev/docs/load#invalidation-manual-invalidation) function.
5+
`load` 関数の中で `fetch(url)` を呼ぶと、`url` を依存関係(dependency)として登録します。`fetch` を使用するのが適切でない場合もありますが、その場合は [`depends(url)`](https://kit.svelte.jp/docs/load#invalidation-manual-invalidation) 関数を使って手動で依存関係を指定することができます。
66

7-
Since any string that begins with an `[a-z]+:` pattern is a valid URL, we can create custom invalidation keys like `data:now`.
7+
`[a-z]+:` パターンで始まる文字列であれば有効な URL であるため、`data:now` のようなカスタムの invalidation key を作ることができます。
88

9-
Update `src/routes/+layout.js` to return a value directly rather than making a `fetch` call, and add the `depends`:
9+
`src/routes/+layout.js` を更新します。`fetch` を呼び出すのではなく値を直接返すようにし、そして `depends` を追加します。
1010

1111
```js
1212
/// file: src/routes/+layout.js
@@ -19,7 +19,7 @@ export async function load({ +++depends+++ }) {
1919
}
2020
```
2121

22-
Now, update the `invalidate` call in `src/routes/[...timezone]/+page.svelte`:
22+
そして、`src/routes/[...timezone]/+page.svelte` にある `invalidate` 呼び出しも更新します。
2323

2424
```svelte
2525
/// file: src/routes/[...timezone]/+page.svelte

content/tutorial/04-advanced-sveltekit/04-advanced-loading/05-invalidate-all/README.md

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

5-
Finally, there's the nuclear option `invalidateAll()`. This will indiscriminately re-run all `load` functions for the current page, regardless of what they depend on.
5+
そして、最後の手段があります `invalidateAll()` です。これは現在のページに関係する全ての `load` 関数を、何に依存しているかに関係なく全て再実行させます。
66

7-
Update `src/routes/[...timezone]/+page.svelte` from the previous exercise:
7+
前回の練習問題から `src/routes/[...timezone]/+page.svelte` を更新します
88

99
```svelte
1010
/// file: src/routes/[...timezone]/+page.svelte
@@ -26,7 +26,7 @@ Update `src/routes/[...timezone]/+page.svelte` from the previous exercise:
2626
</script>
2727
```
2828

29-
The `depends` call in `src/routes/+layout.js` is no longer necessary:
29+
`src/routes/+layout.js` にある `depends` 呼び出しはもう必要ありません。
3030

3131
```js
3232
/// file: src/routes/+layout.js
@@ -39,4 +39,4 @@ export async function load(---{ depends }---) {
3939
}
4040
```
4141

42-
> `invalidate(() => true)` and `invalidateAll` are _not_ the same. `invalidateAll` also re-runs `load` functions without any `url` dependencies, which `invalidate(() => true)` does not.
42+
> `invalidate(() => true)` `invalidateAll` は同じではありません。`invalidateAll` `url` の依存関係を持たない `load` 関数も再実行させますが、`invalidate(() => true)` はそうではありません。

0 commit comments

Comments
 (0)