diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000000..e06f7d8b67 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,265 @@ +{ + "projectName": "svelte.dev", + "projectOwner": "svelte-jp", + "repoType": "github", + "repoHost": "https://github.com/", + "files": ["README.md"], + "imageSize": 100, + "commit": false, + "commitConvention": "angular", + "contributors": [ + { + "login": "tomoam", + "name": "tomoam", + "avatar_url": "https://avatars.githubusercontent.com/u/29677552?v=4", + "profile": "https://github.com/tomoam", + "contributions": ["doc"] + }, + { + "login": "myLifeAsaDog", + "name": "myLifeAsaDog", + "avatar_url": "https://avatars.githubusercontent.com/u/18300178?v=4", + "profile": "https://github.com/myLifeAsaDog", + "contributions": ["doc"] + }, + { + "login": "Makohan", + "name": "mkin", + "avatar_url": "https://avatars.githubusercontent.com/u/32333141?v=4", + "profile": "https://github.com/Makohan", + "contributions": ["doc"] + }, + { + "login": "jay-es", + "name": "Jun Shindo", + "avatar_url": "https://avatars.githubusercontent.com/u/46585162?v=4", + "profile": "https://qiita.com/jay-es", + "contributions": ["doc"] + }, + { + "login": "kkeeth", + "name": "Keeth Kuwahara", + "avatar_url": "https://avatars.githubusercontent.com/u/4125257?v=4", + "profile": "https://speakerdeck.com/clown0082", + "contributions": ["doc"] + }, + { + "login": "oekazuma", + "name": "Kazuma Oe", + "avatar_url": "https://avatars.githubusercontent.com/u/29580221?v=4", + "profile": "https://github.com/oekazuma", + "contributions": ["doc"] + }, + { + "login": "Shunpoco", + "name": "Shunpoco", + "avatar_url": "https://avatars.githubusercontent.com/u/25903627?v=4", + "profile": "https://github.com/Shunpoco", + "contributions": ["doc"] + }, + { + "login": "ampcpmgp", + "name": "ampcpmgp", + "avatar_url": "https://avatars.githubusercontent.com/u/13173632?v=4", + "profile": "https://github.com/ampcpmgp", + "contributions": ["doc"] + }, + { + "login": "takoyaro", + "name": "Jimmy", + "avatar_url": "https://avatars.githubusercontent.com/u/54836677?v=4", + "profile": "https://github.com/takoyaro", + "contributions": ["doc"] + }, + { + "login": "jdkfx", + "name": "Haruki Tazoe", + "avatar_url": "https://avatars.githubusercontent.com/u/40142697?v=4", + "profile": "https://github.com/jdkfx", + "contributions": ["doc"] + }, + { + "login": "shin1127", + "name": "shin1127", + "avatar_url": "https://avatars.githubusercontent.com/u/56531152?v=4", + "profile": "https://shin1127.github.io/myPortfolio/", + "contributions": ["doc"] + }, + { + "login": "manak1", + "name": "manaki", + "avatar_url": "https://avatars.githubusercontent.com/u/32151765?v=4", + "profile": "https://twilink.click/mikeanakida", + "contributions": ["doc"] + }, + { + "login": "knj4484", + "name": "knj4484", + "avatar_url": "https://avatars.githubusercontent.com/u/11140280?v=4", + "profile": "https://github.com/knj4484", + "contributions": ["doc"] + }, + { + "login": "miily8310s", + "name": "miruoo", + "avatar_url": "https://avatars.githubusercontent.com/u/42486288?v=4", + "profile": "https://katanugramer.hatenablog.com/", + "contributions": ["doc"] + }, + { + "login": "mouse484", + "name": "mouse_484", + "avatar_url": "https://avatars.githubusercontent.com/u/38714187?v=4", + "profile": "https://portfolio.mouse484.tk/", + "contributions": ["doc"] + }, + { + "login": "dynamis", + "name": "dynamis", + "avatar_url": "https://avatars.githubusercontent.com/u/188166?v=4", + "profile": "http://dynamis.jp/", + "contributions": ["financial", "infra"] + }, + { + "login": "Murayu0225", + "name": "Yu Muramatsu", + "avatar_url": "https://avatars.githubusercontent.com/u/37988559?v=4", + "profile": "https://github.com/Murayu0225", + "contributions": ["doc"] + }, + { + "login": "lunain84", + "name": "HirosuguTakeshita", + "avatar_url": "https://avatars.githubusercontent.com/u/52437973?v=4", + "profile": "https://qiita.com/fuwasegu", + "contributions": ["doc"] + }, + { + "login": "yamanoku", + "name": "Okuto Oyama", + "avatar_url": "https://avatars.githubusercontent.com/u/1996642?v=4", + "profile": "https://yamanoku.net/", + "contributions": ["doc"] + }, + { + "login": "baseballyama", + "name": "Yuichiro Yamashita", + "avatar_url": "https://avatars.githubusercontent.com/u/19153718?v=4", + "profile": "https://github.com/baseballyama", + "contributions": ["doc"] + }, + { + "login": "nullnyat", + "name": "Nullcat chan!", + "avatar_url": "https://avatars.githubusercontent.com/u/89781396?v=4", + "profile": "https://keybase.io/nullnyat", + "contributions": ["doc"] + }, + { + "login": "komura-c", + "name": "Yuki Ishii", + "avatar_url": "https://avatars.githubusercontent.com/u/37304826?v=4", + "profile": "https://github.com/komura-c", + "contributions": ["doc"] + }, + { + "login": "torish14", + "name": "torish14", + "avatar_url": "https://avatars.githubusercontent.com/u/49876561?v=4", + "profile": "https://sukimakakumei.co.jp/", + "contributions": ["doc"] + }, + { + "login": "kokko-san", + "name": "kokko-san", + "avatar_url": "https://avatars.githubusercontent.com/u/36446753?v=4", + "profile": "https://github.com/kokko-san", + "contributions": ["doc"] + }, + { + "login": "ota-meshi", + "name": "Yosuke Ota", + "avatar_url": "https://avatars.githubusercontent.com/u/16508807?v=4", + "profile": "https://ota-meshi.github.io/", + "contributions": ["doc"] + }, + { + "login": "dajiaji", + "name": "Ajitomi Daisuke", + "avatar_url": "https://avatars.githubusercontent.com/u/3192030?v=4", + "profile": "https://github.com/dajiaji", + "contributions": ["doc"] + }, + { + "login": "mitsu-ksgr", + "name": "mitsu-ksgr", + "avatar_url": "https://avatars.githubusercontent.com/u/3091232?v=4", + "profile": "http://mitsu-ksgr.github.io/", + "contributions": ["doc"] + }, + { + "login": "tatsuyafw", + "name": "Tatsuya Hoshino", + "avatar_url": "https://avatars.githubusercontent.com/u/1162665?v=4", + "profile": "http://tatsuyafw.hatenablog.jp/", + "contributions": ["doc"] + }, + { + "login": "kimdj2", + "name": "bondee", + "avatar_url": "https://avatars.githubusercontent.com/u/38813699?v=4", + "profile": "https://github.com/kimdj2", + "contributions": ["doc"] + }, + { + "login": "dito", + "name": "dito", + "avatar_url": "https://avatars.githubusercontent.com/u/4264269?v=4", + "profile": "https://github.com/dito", + "contributions": ["doc"] + }, + { + "login": "shuuji3", + "name": "TAKAHASHI Shuuji", + "avatar_url": "https://avatars.githubusercontent.com/u/1425259?v=4", + "profile": "https://shuuji3.xyz/", + "contributions": ["doc"] + }, + { + "login": "yo-goto", + "name": "PADAone", + "avatar_url": "https://avatars.githubusercontent.com/u/50942816?v=4", + "profile": "https://github.com/yo-goto", + "contributions": ["doc"] + }, + { + "login": "yuki0418", + "name": "Yuki Ishii", + "avatar_url": "https://avatars.githubusercontent.com/u/45615348?v=4", + "profile": "https://github.com/yuki0418", + "contributions": ["doc"] + }, + { + "login": "tada-tsu", + "name": "Tadatsugu Ohno", + "avatar_url": "https://avatars.githubusercontent.com/u/34794025?v=4", + "profile": "https://github.com/tada-tsu", + "contributions": ["doc"] + }, + { + "login": "akku1139", + "name": "-akku-", + "avatar_url": "https://avatars.githubusercontent.com/u/151517253?v=4", + "profile": "https://github.com/akku1139", + "contributions": ["doc"] + }, + { + "login": "jill64", + "name": "jill64", + "avatar_url": "https://avatars.githubusercontent.com/u/143883742?v=4", + "profile": "https://github.com/jill64", + "contributions": ["doc"] + } + ], + "contributorsPerLine": 7 +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index d632634540..0000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -open_collective: svelte diff --git a/.github/ISSUE_TEMPLATE/improve_translation.md b/.github/ISSUE_TEMPLATE/improve_translation.md new file mode 100644 index 0000000000..c4b2c17994 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/improve_translation.md @@ -0,0 +1,40 @@ +--- +name: 誤字・脱字・誤訳報告、翻訳改善要望(report typos and mistranslations, or request improvements in translation) +about: 誤字・脱字・誤訳の報告や翻訳改善の要望 +title: "{対象ドキュメント}の翻訳改善要望" +labels: documentation, translation +assignees: '' +--- + +## 対象ドキュメント + + + +## 対象箇所 + + + + +## 修正したい/してほしい + + +- 修正したい +- 修正してほしい + + +## 備考 + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/other.md b/.github/ISSUE_TEMPLATE/other.md new file mode 100644 index 0000000000..f01e8f9f12 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other.md @@ -0,0 +1,9 @@ +--- +name: その他 +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + diff --git a/.github/ISSUE_TEMPLATE/request_translation.md b/.github/ISSUE_TEMPLATE/request_translation.md new file mode 100644 index 0000000000..e3bd3357a4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request_translation.md @@ -0,0 +1,29 @@ +--- +name: 翻訳ドキュメント追加(add the document to be translated) +about: 翻訳したい/してほしいドキュメント +title: "{対象ドキュメント}の翻訳" +labels: documentation, translation +assignees: '' + +--- + +## 対象ドキュメント + + + + +## 翻訳したい/してほしい + + +- 翻訳したい +- 翻訳してほしい + + +## 備考 + + \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 1b601151d9..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,9 +0,0 @@ -### A note on documentation PRs - -If this is a documentation PR (i.e. changing content within `apps/svelte.dev/content/docs`), then this is the wrong repository to make those changes. The content in this folder is synced from other repositories. Therefore, these changes should be made in their respective repositories (at https://github.com/sveltejs/svelte or https://github.com/sveltejs/kit, or example). - -### Before submitting the PR, please make sure you do the following - -- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. -- [ ] Prefix your PR title with `feat:`, `fix:`, `chore:`, or `docs:`. -- [ ] This message body should clearly illustrate what problems it solves. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index bf47827d68..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: CI -on: - push: - branches: [main] - pull_request: -permissions: - contents: read # to fetch code (actions/checkout) - -env: - # We only install Chromium manually - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - -jobs: - # unskip once we have tutorial here which runs playwright tests - # Tests: - # runs-on: ${{ matrix.os }} - # timeout-minutes: 15 - # strategy: - # matrix: - # include: - # - node-version: 18 - # os: windows-latest - # - node-version: 18 - # os: macOS-latest - # - node-version: 18 - # os: ubuntu-latest - # - node-version: 20 - # os: ubuntu-latest - # - node-version: 22 - # os: ubuntu-latest - - # steps: - # - uses: actions/checkout@v3 - # - uses: pnpm/action-setup@v4 - # - uses: actions/setup-node@v3 - # with: - # node-version: ${{ matrix.node-version }} - # cache: pnpm - # - run: pnpm install --frozen-lockfile - # - run: pnpm playwright install chromium - # - run: pnpm test - # env: - # CI: true - Lint: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: pnpm - - name: install - run: pnpm install --frozen-lockfile - - name: type check - run: pnpm -r package && pnpm check - - name: lint - if: (${{ success() }} || ${{ failure() }}) # ensures this step runs even if previous steps fail (avoids multiple runs uncovering different issues at different steps) - run: pnpm lint diff --git a/.github/workflows/docs-preview-create.yml b/.github/workflows/docs-preview-create.yml deleted file mode 100644 index 5c9f983245..0000000000 --- a/.github/workflows/docs-preview-create.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Docs preview create - -on: - workflow_dispatch: - inputs: - repo: - description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)' - required: true - type: string - pr: - description: 'PR number' - required: true - type: string - owner: - description: 'Owner (eg. sveltejs)' - required: true - type: string - branch: - description: 'Branch (eg. my-feature-branch)' - required: true - type: string - -permissions: - contents: write - -env: - BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }} - -jobs: - Sync: - name: Sync - runs-on: ubuntu-latest - - concurrency: - group: preview-${{ inputs.repo }}-${{ inputs.pr }} # can't reference env here - cancel-in-progress: true - - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN }} - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile - - - name: Checkout - run: git fetch origin ${{ env.BRANCH }} && git checkout ${{ env.BRANCH }} || git checkout -b ${{ env.BRANCH }} - - - name: Sync - run: cd apps/svelte.dev && pnpm sync-docs --owner="${{ inputs.owner }}" -p "${{ inputs.repo }}#${{ inputs.branch }}" - - - name: Configure Git - run: | - git config --global user.name "GitHub Actions Bot" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - - name: Push - id: push - run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }} - - - name: Request preview comment - uses: peter-evans/repository-dispatch@v3 - with: - event-type: 'request-preview-comment' - client-payload: |- - { - "repo": "${{ inputs.repo }}", - "pr": "${{ inputs.pr }}" - } diff --git a/.github/workflows/docs-preview-delete.yml b/.github/workflows/docs-preview-delete.yml deleted file mode 100644 index faa13fbade..0000000000 --- a/.github/workflows/docs-preview-delete.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Docs preview delete - -on: - workflow_dispatch: - inputs: - repo: - description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)' - required: true - type: string - pr: - description: 'PR number' - required: true - type: string - -env: - BRANCH: preview-${{ inputs.repo }}-${{ inputs.pr }} - -jobs: - Sync: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN }} - - - name: Delete branch - run: git push origin :${{ env.BRANCH }} diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml deleted file mode 100644 index 79b5a9727f..0000000000 --- a/.github/workflows/sync-docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Sync docs - -on: - workflow_dispatch: - inputs: - repo: - description: 'Repository name (not fully-qualified, eg. `svelte` or `kit`)' - required: true - type: string - -permissions: - contents: write - pull-requests: write - -jobs: - Sync: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile - - - name: Sync - run: cd apps/svelte.dev && pnpm sync-docs -p ${{ inputs.repo }} - - - name: Create or update pull request - uses: peter-evans/create-pull-request@v7 - with: - commit-message: sync ${{ inputs.repo }} docs - title: Sync `${{ inputs.repo }}` docs - body: This is an automated pull request. See the [README](../tree/main/apps/svelte.dev/scripts/sync-docs/README.md) for more information - branch: sync-${{ inputs.repo }} - base: main diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..7a94bfbac8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,202 @@ +# svelte-jp/svelte.dev への貢献について + +svelte-jp/svelte.dev はSvelte公式ドキュメントサイトの日本語化プロジェクトです。 + +このリポジトリは[sveltejs/svelte.dev](https://github.com/sveltejs/svelte.dev)をフォークして作成されており、ライセンスやコミュニティ・コラボレーションの精神についてはSvelte本体のそれを引き継ぎます。 + +Svelte公式のCONTRIBUTING.mdはこちらです、是非ご一読ください。 + +- [CONTRIBUTING.md - sveltejs/svelte](https://github.com/sveltejs/svelte/blob/main/CONTRIBUTING.md) + + +## 貢献するには + +貢献する方法はたくさんあり、その多くはコードを書く必要もなければ、いきなり翻訳する必要もありません。 + +- 日本語ドキュメントサイト([https://svelte.jp/](https://svelte.jp/))を使ってみてください。気になるところや改善点があれば[Issueを開いて](#issueを作成する)お知らせください。 +- 翻訳で貢献されたい場合は[翻訳作業について](#翻訳作業について)をチェックしてみてください。翻訳にはみなさんの協力が必要です。誤訳があっても誤字・脱字があっても単語が統一できていなくても構いません、後からみんなで良くしていければと考えています。 + +貢献は大歓迎です!もし貢献を迷っていたり、貢献に助けが必要であれば[Svelte日本のDiscord](https://discord.com/invite/YTXq3ZtBbx)で知らせてください。 + + +## ディレクトリ構成・翻訳の仕組み + +ドキュメントのファイルはこのリポジトリの [`apps/svelte.dev/content`](https://github.com/svelte-jp/svelte.dev/tree/main/apps/svelte.dev/content) ディレクトリにあります。 + +- **blog** + - Blogは apps/svelte.dev/content/blog 配下にあります。 +- **docs** + - Docsは apps/svelte.dev/content/docs 配下にあります。CLI、SvelteKit、Svelte本体のドキュメントがそれぞれディレクトリで分かれています。 + - cli: CLI ツールのドキュメントがあります。 + - kit: SvelteKit のドキュメントがあります。 + - svelte: Svelte のドキュメントがあります +- **tutorial** + - tutorial は apps/svelte.dev/content/tutorial 配下のそれぞれの章ごとに `index.md` というファイルがあります。 + +``` +apps/svelte.dev/content +├── blog +│ ├── 2016-11-26-frameworks-without-the-framework.md # <- blog +│ ... +│ +├── docs +│ ├── cli +│ │ ├── 10-introduction +│ │ │ ├── 10-overview.md # <- CLI のドキュメント +│ │ │ ... +│ │ ... +│ │ +│ ├── kit +│ │ ├── 10-getting-started +│ │ │ ├── 10-introduction.md # <- SvelteKit のドキュメント +│ │ │ ... +│ │ ... +│ │ +│ ├── svelte +│ │ ├── 01-introduction +│ │ │ ├── 01-introduction.md # <- Svelte のドキュメント +│ │ │ ... +│ │ ... +│ ... +│ +├── examples +│ +└── tutorial + ├── 01-svelte + │ ├── 01-introduction + │ │ ├── 01-welcome-to-svelte + │ │ │ ├── +assets... + │ │ │ └── index.md # <- tutorial + │ │ ... + │ ... + ... +``` + +サイトのソース、TOPページの日本語訳は [apps/svelte.dev/src](https://github.com/svelte-jp/svelte.dev/tree/main/apps/svelte.dev/src) にあります。 + + +## 翻訳の流れ + +### 1. 翻訳するドキュメントを選ぶ + +翻訳が必要な文書は[issue](https://github.com/svelte-jp/svelte.dev/issues?q=is%3Aopen+is%3Aissue)が作成されています。 + +まだ誰も着手していないIssueには`翻訳者募集中`というLabelがついています。翻訳したいものがあれば、Issueのコメントで知らせてください(堅苦しい挨拶などは不要です。「この翻訳やりましょうか?」と言っていただけたらそれだけでとても嬉しいです!)。 + +運営側から依頼する旨をコメントで返信しますので、その後に作業を開始してください。 + +もし翻訳したいドキュメントのIssueがなければ、Issueを作成してください。 + + +### 2. 翻訳作業 + +このリポジトリをForkし、ローカルにcloneしてください。 + +``` +git clone https://github.com/{USER}/svelte.dev.git +``` + +[ディレクトリ構成・翻訳の仕組み](#ディレクトリ構成翻訳の仕組み)を参考に、担当する文書を見つけてください。 + +実際の翻訳については[翻訳のガイドライン](#翻訳のガイドライン)を参考にしてください。 + +> いきなり完璧な翻訳を目指さなくても大丈夫です。PRに間違いや誤字・脱字があっても大丈夫です。ちゃんとレビューをしますし、レビューで怒ったりしませんのでご安心ください。それより、あなたがこのプロジェクトに貢献するため時間と労力を割いてくれたことに感謝しかありません。 + + +#### 2-1. 見出しの翻訳について + +マークダウンでは、行の先頭に `#` が付けられた行は見出し要素になります。 +この見出し要素には自動で id が割り付けられ、ページ内の特定の位置にフォーカスさせることができるようになっています。 + +例えば、以下のようなマークダウンの場合... + +```markdown +## Alternatives to SvelteKit +``` + +...以下のような HTML に変換されます。 + +```html +
tomoam 📗📘📖 |
+ myLifeAsaDog 📗📘 |
+ mkin 📗 |
+ Jun Shindo 📗 |
+ Keeth Kuwahara 📗 |
+ Kazuma Oe 📗📘📖 |
+ Shunpoco 📗 |
+
ampcpmgp 📗 |
+ Jimmy 📗 |
+ Haruki Tazoe 📗 |
+ shin1127 📗 |
+ manaki 📗 |
+ knj4484 📗 |
+ miruoo 📗📘 |
+
mouse_484 📗 |
+ dynamis 💵 🚇 |
+ Yu Muramatsu 📗 |
+ HirosuguTakeshita 📗 |
+ Okuto Oyama 📗📘 |
+ Yuichiro Yamashita 📗 |
+ Nullcat chan! 📗 |
+
Yuki Ishii 📗 |
+ torish14 📗 |
+ kokko-san 📗 |
+ Yosuke Ota 📗 |
+ Ajitomi Daisuke 📘 |
+ mitsu-ksgr 📗 |
+ Tatsuya Hoshino 📗 |
+
bondee 📘 |
+ dito 📘 |
+ TAKAHASHI Shuuji 📗 |
+ PADAone 📗 |
+ Yuki Ishii 📖 |
+ Tadatsugu Ohno 📖 |
+ -akku- 📖 |
+
jill64 📖 |
+
{data.a} + {data.b} = {data.c}
``` -> [!NOTE] Notice that the `load` function in `+page.js` receives the merged data from both layout `load` functions, not just the immediate parent. +> [!NOTE] `+page.js` の `load` 関数が、直接の親だけなく、両方のレイアウトの `load` 関数からマージされたデータを受け取っていることにご注意ください。 -Inside `+page.server.js` and `+layout.server.js`, `parent` returns data from parent `+layout.server.js` files. +`+page.server.js` と `+layout.server.js` の中では、`parent` は親の `+layout.server.js` ファイルからデータを取得します。 -In `+page.js` or `+layout.js` it will return data from parent `+layout.js` files. However, a missing `+layout.js` is treated as a `({ data }) => data` function, meaning that it will also return data from parent `+layout.server.js` files that are not 'shadowed' by a `+layout.js` file +`+page.js` や `+layout.js` では、親の `+layout.js` ファイルからデータを返します。しかし、`+layout.js` が見つからない場合は `({ data }) => data` 関数として扱われます。つまり、`+layout.js` ファイルによって'シャドウ(shadowed)'されていない親の `+layout.server.js` ファイルからデータを返します。 -Take care not to introduce waterfalls when using `await parent()`. Here, for example, `getData(params)` does not depend on the result of calling `parent()`, so we should call it first to avoid a delayed render. +`await parent()` を使用する際はウォータフォールを発生させないよう注意してください。例えば、こちらの `getData(params)` は `parent()` の呼び出しの結果には依存しないので、レンダリングの遅延を避けるために最初に呼び出すほうが良いでしょう。 ```js /// file: +page.js @@ -426,7 +426,7 @@ export async function load({ params, parent }) { ## Errors -If an error is thrown during `load`, the nearest [`+error.svelte`](routing#error) will be rendered. For [_expected_](errors#Expected-errors) errors, use the `error` helper from `@sveltejs/kit` to specify the HTTP status code and an optional message: +`load` 中にエラーがスローされた場合、最も近くにある [`+error.svelte`](routing#error) がレンダリングされます。[想定されるエラー](errors#Expected-errors)には、`@sveltejs/kit` からインポートできる `error` ヘルパーを使用して HTTP ステータスコードとオプションのメッセージを指定できます: ```js /// file: src/routes/admin/+layout.server.js @@ -456,15 +456,15 @@ export function load({ locals }) { } ``` -Calling `error(...)` will throw an exception, making it easy to stop execution from inside helper functions. +`error(...)` を呼び出すと例外がスローされるため、ヘルパー関数の内側から簡単に実行を止めることができます。 -If an [_unexpected_](errors#Unexpected-errors) error is thrown, SvelteKit will invoke [`handleError`](hooks#Shared-hooks-handleError) and treat it as a 500 Internal Error. +[予期せぬエラー](errors#Unexpected-errors)がスローされた場合、SvelteKit は [`handleError`](hooks#Shared-hooks-handleError) を呼び出し、それを 500 Internal Error として処理します。 -> [!NOTE] [In SvelteKit 1.x](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you) you had to `throw` the error yourself +> [!NOTE] [SvelteKit 1.x 系では](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you)、ご自分で error を `throw` する必要がありました ## Redirects -To redirect users, use the `redirect` helper from `@sveltejs/kit` to specify the location to which they should be redirected alongside a `3xx` status code. Like `error(...)`, calling `redirect(...)` will throw an exception, making it easy to stop execution from inside helper functions. +ユーザーをリダイレクトさせるには、`@sveltejs/kit` からインポートできる `redirect` ヘルパーを使用して、ステータスコード `3xx` と一緒にリダイレクト先の location を指定します。`error(...)` と同じように、`redirect(...)` を呼び出すと例外がスローされるため、ヘルパー関数の内側から簡単に実行を止めることができます。 ```js /// file: src/routes/user/+layout.server.js @@ -489,15 +489,15 @@ export function load({ locals }) { } ``` -> [!NOTE] Don't use `redirect()` inside a `try {...}` block, as the redirect will immediately trigger the catch statement. +> [!NOTE] `try {...}` ブロックの中で `redirect()` を使用してはいけません。redirect がすぐにその catch ステートメントをトリガーしてしまうからです。 -In the browser, you can also navigate programmatically outside of a `load` function using [`goto`]($app-navigation#goto) from [`$app.navigation`]($app-navigation). +ブラウザでは、[`$app.navigation`]($app-navigation) からインポートできる [`goto`]($app-navigation#goto) を使うことで、`load` 関数の外側でプログラム的にナビゲーションを行うことができます。 -> [!NOTE] [In SvelteKit 1.x](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you) you had to `throw` the `redirect` yourself +> [!NOTE] [SvelteKit 1.x 系では](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you)、ご自分で `redirect` を `throw` する必要がありました ## Streaming with promises -When using a server `load`, promises will be streamed to the browser as they resolve. This is useful if you have slow, non-essential data, since you can start rendering the page before all the data is available: +server `load` を使用する場合、promise が解決されると同時にブラウザにストリームされます。これにより、遅くて重要でないデータがある場合でも、すべてのデータが利用可能になる前にページのレンダリングを開始することができます: ```js /// file: src/routes/blog/[slug]/+page.server.js @@ -522,7 +522,7 @@ export async function load({ params }) { } ``` -This is useful for creating skeleton loading states, for example: +これはロード状態(loading states)のスケルトンを作成するのに便利です、例えば: ```svelte @@ -545,7 +545,7 @@ This is useful for creating skeleton loading states, for example: {/await} ``` -When streaming data, be careful to handle promise rejections correctly. More specifically, the server could crash with an "unhandled promise rejection" error if a lazy-loaded promise fails before rendering starts (at which point it's caught) and isn't handling the error in some way. When using SvelteKit's `fetch` directly in the `load` function, SvelteKit will handle this case for you. For other promises, it is enough to attach a noop-`catch` to the promise to mark it as handled. +データをストリーミングする場合は、promise の reject を正しく処理するようにしてください。具体的には、レンダリングの開始時点 (本来この時点で catch される) より前に遅延ロード (lazy-loaded) された promise が失敗し、エラーを処理していない場合、server が "unhandled promise rejection" エラーでクラッシュする可能性があります。SvelteKit の `fetch` を `load` 関数で直接使用する場合は SvelteKit がこのケースを処理してくれます。それ以外の promise の場合は、何もしない `catch` (noop-`catch`) をアタッチし、処理済であることを明示するだけで十分です。 ```js /// file: src/routes/+page.server.js @@ -562,23 +562,23 @@ export function load({ fetch }) { } ``` -> [!NOTE] On platforms that do not support streaming, such as AWS Lambda or Firebase, responses will be buffered. This means the page will only render once all promises resolve. If you are using a proxy (e.g. NGINX), make sure it does not buffer responses from the proxied server. +> [!NOTE] AWS Lambda や Firebase のような ストリーミングをサポートしないプラットフォームでは、レスポンスはバッファされます。つまり、すべての promise が解決してからでないとページがレンダリングされないということです。もしプロキシ (例えば NGINX) を使用している場合は、プロキシされたサーバーからのレスポンスをバッファしないようにしてください。 -> [!NOTE] Streaming data will only work when JavaScript is enabled. You should avoid returning promises from a universal `load` function if the page is server rendered, as these are _not_ streamed — instead, the promise is recreated when the function reruns in the browser. +> [!NOTE] ストリーミングデータは JavaScript が有効なときにのみ動作します。ページがサーバーでレンダリングされる場合、universal `load` 関数からは promise を返すのは避けたほうがよいでしょう、ストリーミングされないからです (代わりに、関数がブラウザで再実行されるときに promise が再作成されます)。 -> [!NOTE] The headers and status code of a response cannot be changed once the response has started streaming, therefore you cannot `setHeaders` or throw redirects inside a streamed promise. +> [!NOTE] レスポンスのヘッダーとステータスコードは、レスポンスがストリーミングを開始すると変更することはできなくなります。そのため、ストリームされた promise の中で `setHeaders` を呼んだりリダイレクトをスローしたりすることはできません。 -> [!NOTE] [In SvelteKit 1.x](migrating-to-sveltekit-2#Top-level-promises-are-no-longer-awaited) top-level promises were automatically awaited, only nested promises were streamed. +> [!NOTE] [SvelteKit 1.x 系では](migrating-to-sveltekit-2#Top-level-promises-are-no-longer-awaited)、トップレベルの promise は自動的に await され、ネストした promise だけがストリーミングされていました。 ## Parallel loading -When rendering (or navigating to) a page, SvelteKit runs all `load` functions concurrently, avoiding a waterfall of requests. During client-side navigation, the result of calling multiple server `load` functions are grouped into a single response. Once all `load` functions have returned, the page is rendered. +ページをレンダリング (またはページにナビゲーション) するとき、SvelteKit はすべての `load` 関数を同時に実行し、リクエストのウォーターフォールを回避します。クライアントサイドナビゲーションのときは、複数の server `load` 関数の呼び出し結果が単一のレスポンスにグループ化されます。すべての `load` 関数が返されると、ページがレンダリングされます。 -## Rerunning load functions +## load 関数の再実行 -SvelteKit tracks the dependencies of each `load` function to avoid rerunning it unnecessarily during navigation. +SvelteKit は それぞれの `load` 関数の依存関係を追跡し、ナビゲーションの際に不必要に再実行されるのを回避します。 -For example, given a pair of `load` functions like these... +例えば、このような `load` 関数のペアがあるとして… ```js /// file: src/routes/blog/[slug]/+page.server.js @@ -618,17 +618,17 @@ export async function load() { } ``` -...the one in `+page.server.js` will rerun if we navigate from `/blog/trying-the-raw-meat-diet` to `/blog/i-regret-my-choices` because `params.slug` has changed. The one in `+layout.server.js` will not, because the data is still valid. In other words, we won't call `db.getPostSummaries()` a second time. +…もし、`/blog/trying-the-raw-meat-diet` から `/blog/i-regret-my-choices` に移動したら、`params.slug` が変更されているので、`+page.server.js` のほうは再実行されるでしょう。`+layout.server.js` のほうは再実行されません、なぜならデータがまだ有効だからです。言い換えると、`db.getPostSummaries()` を2回呼び出すことはないということです。 -A `load` function that calls `await parent()` will also rerun if a parent `load` function is rerun. +`await parent()` を呼び出している `load` 関数は、親の `load` 関数が再実行された場合に再実行されます。 -Dependency tracking does not apply _after_ the `load` function has returned — for example, accessing `params.x` inside a nested [promise](#Streaming-with-promises) will not cause the function to rerun when `params.x` changes. (Don't worry, you'll get a warning in development if you accidentally do this.) Instead, access the parameter in the main body of your `load` function. +依存関係の追跡は、`load` 関数から返したあとには適用されません。例えば、ネストした [promise](#Streaming-with-promises) の内側で `params.x` にアクセスしている場合、`params.x` が変更されても関数の再実行は行われません (ご心配なく、誤ってこれを行っても開発中に警告が表示されます)。代わりに、`load` 関数の本体部分でパラメータにアクセスしてください。 -Search parameters are tracked independently from the rest of the url. For example, accessing `event.url.searchParams.get("x")` inside a `load` function will make that `load` function re-run when navigating from `?x=1` to `?x=2`, but not when navigating from `?x=1&y=1` to `?x=1&y=2`. +search parameter は url の他の部分とは独立し追跡されます。例えば、`load` 関数の中で `event.url.searchParams.get("x")` にアクセスすると、`?x=1` から `?x=2` にナビゲーションするときにその `load` 関数が再実行されますが、`?x=1&y=1` から `?x=1&y=2` にナビゲーションするときには再実行されません。 ### Untracking dependencies -In rare cases, you may wish to exclude something from the dependency tracking mechanism. You can do this with the provided `untrack` function: +まれに、依存関係の追跡メカニズムからなにかを除外したいケースがあります。このような場合、`untrack` 関数を使用します: ```js /// file: src/routes/+page.js @@ -643,9 +643,9 @@ export async function load({ untrack, url }) { ### Manual invalidation -You can also rerun `load` functions that apply to the current page using [`invalidate(url)`]($app-navigation#invalidate), which reruns all `load` functions that depend on `url`, and [`invalidateAll()`]($app-navigation#invalidateAll), which reruns every `load` function. Server load functions will never automatically depend on a fetched `url` to avoid leaking secrets to the client. +現在のページに適用される `load` 関数は、[`invalidate(url)`]($app-navigation#invalidate) を使用することで再実行させることもできます。これは `url` に依存しているすべての `load` 関数を再実行させるものです。[`invalidateAll()`]($app-navigation#invalidateAll) は、すべての `load` 関数を再実行させます。server load 関数の場合は、クライアントに秘情報が漏れるのを防ぐため、取得した `url` に自動的に依存することはありません。 -A `load` function depends on `url` if it calls `fetch(url)` or `depends(url)`. Note that `url` can be a custom identifier that starts with `[a-z]:`: +`load` 関数が `fetch(url)` や `depends(url)` を呼び出している場合、その `load` 関数は `url` に依存しています。`url` には `[a-z]:` から始まるカスタムの識別子を指定することができることにご注意ください: ```js /// file: src/routes/random-number/+page.js @@ -684,35 +684,34 @@ export async function load({ fetch, depends }) { ``` -### When do load functions rerun? +### load 関数はいつ再実行されるのか -To summarize, a `load` function will rerun in the following situations: +まとめると、`load` 関数は以下のシチュエーションで再実行されます: -- It references a property of `params` whose value has changed -- It references a property of `url` (such as `url.pathname` or `url.search`) whose value has changed. Properties in `request.url` are _not_ tracked -- It calls `url.searchParams.get(...)`, `url.searchParams.getAll(...)` or `url.searchParams.has(...)` and the parameter in question changes. Accessing other properties of `url.searchParams` will have the same effect as accessing `url.search`. -- It calls `await parent()` and a parent `load` function reran -- A child `load` function calls `await parent()` and is rerunning, and the parent is a server load function -- It declared a dependency on a specific URL via [`fetch`](#Making-fetch-requests) (universal load only) or [`depends`](@sveltejs-kit#LoadEvent), and that URL was marked invalid with [`invalidate(url)`]($app-navigation#invalidate) -- All active `load` functions were forcibly rerun with [`invalidateAll()`]($app-navigation#invalidateAll) +- `params` のプロパティを参照していて、その値が変更された場合 +- `url` のプロパティ (例えば `url.pathname` や `url.search`) を参照していて、その値が変更された場合。`request.url` のプロパティは追跡されません +- `url.searchParams.get(...)` や `url.searchParams.getAll(...)` や `url.searchParams.has(...)` を呼び出しており、その該当するパラメータが変更された場合。`url.searchParams` の他のプロパティにアクセスした場合は、`url.search` にアクセスした場合と同じ効果になる。 +- `await parent()` を呼び出していて、親の `load` 関数が再実行されたとき +- [`fetch`](#Making-fetch-requests) (universal load のみ) や [`depends`](@sveltejs-kit#LoadEvent) を介して特定の URL に対する依存を宣言していて、その URL が [`invalidate(url)`]($app-navigation#invalidate) で無効(invalid)であるとマークされた場合 +- [`invalidateAll()`]($app-navigation#invalidateAll) によって全ての有効な `load` 関数が強制的に再実行された場合 -`params` and `url` can change in response to a `` link click, a [` ``` -The returned data must be serializable as JSON. Beyond that, the structure is entirely up to you. For example, if you had multiple forms on the page, you could distinguish which `{message}
``` -The parent component doesn't _have_ to use `bind:` — it can just pass a normal prop. Some parents don't want to listen to what their children have to say. +親コンポーネントは必ずしも `bind:` を使用する必要はありません — その場合、通常の props を渡すだけで構いません。子の発言を聞きたくない親もいるかもしれません。 -In this case, you can specify a fallback value for when no prop is passed at all: +この場合、何も props が渡されないときのフォールバック値を指定することができます: ```js /// file: FancyInput.svelte diff --git a/apps/svelte.dev/content/docs/svelte/02-runes/07-$inspect.md b/apps/svelte.dev/content/docs/svelte/02-runes/07-$inspect.md index f2998f949d..b6d2997168 100644 --- a/apps/svelte.dev/content/docs/svelte/02-runes/07-$inspect.md +++ b/apps/svelte.dev/content/docs/svelte/02-runes/07-$inspect.md @@ -3,16 +3,16 @@ NOTE: do not edit this file, it is generated in apps/svelte.dev/scripts/sync-doc title: $inspect --- -> [!NOTE] `$inspect` only works during development. In a production build it becomes a noop. +> [!NOTE] `$inspect` は開発中のみ動作します。本番ビルドでは何もしない (noop) ものになります。 -The `$inspect` rune is roughly equivalent to `console.log`, with the exception that it will re-run whenever its argument changes. `$inspect` tracks reactive state deeply, meaning that updating something inside an object or array using fine-grained reactivity will cause it to re-fire ([demo](/playground/untitled#H4sIAAAAAAAACkWQ0YqDQAxFfyUMhSotdZ-tCvu431AXtGOqQ2NmmMm0LOK_r7Utfby5JzeXTOpiCIPKT5PidkSVq2_n1F7Jn3uIcEMSXHSw0evHpAjaGydVzbUQCmgbWaCETZBWMPlKj29nxBDaHj_edkAiu12JhdkYDg61JGvE_s2nR8gyuBuiJZuDJTyQ7eE-IEOzog1YD80Lb0APLfdYc5F9qnFxjiKWwbImo6_llKRQVs-2u91c_bD2OCJLkT3JZasw7KLA2XCX31qKWE6vIzNk1fKE0XbmYrBTufiI8-_8D2cUWBA_AQAA)): +`$inspect` rune はおおむね `console.log` と同等ですが、引数が変更されるたびに再実行される点が異なります。`$inspect` はリアクティブな state を深く追跡し、オブジェクトや配列内のプロパティやアイテムなどをきめ細やかなリアクティビティで更新すると、再度発火します ([デモ](/playground/untitled#H4sIAAAAAAAACkWQ0YqDQAxFfyUMhSotdZ-tCvu431AXtGOqQ2NmmMm0LOK_r7Utfby5JzeXTOpiCIPKT5PidkSVq2_n1F7Jn3uIcEMSXHSw0evHpAjaGydVzbUQCmgbWaCETZBWMPlKj29nxBDaHj_edkAiu12JhdkYDg61JGvE_s2nR8gyuBuiJZuDJTyQ7eE-IEOzog1YD80Lb0APLfdYc5F9qnFxjiKWwbImo6_llKRQVs-2u91c_bD2OCJLkT3JZasw7KLA2XCX31qKWE6vIzNk1fKE0XbmYrBTufiI8-_8D2cUWBA_AQAA)): ```svelte @@ -21,7 +21,7 @@ The `$inspect` rune is roughly equivalent to `console.log`, with the exception t ## $inspect(...).with -`$inspect` returns a property `with`, which you can invoke with a callback, which will then be invoked instead of `console.log`. The first argument to the callback is either `"init"` or `"update"`; subsequent arguments are the values passed to `$inspect` ([demo](/playground/untitled#H4sIAAAAAAAACkVQ24qDMBD9lSEUqlTqPlsj7ON-w7pQG8c2VCchmVSK-O-bKMs-DefKYRYx6BG9qL4XQd2EohKf1opC8Nsm4F84MkbsTXAqMbVXTltuWmp5RAZlAjFIOHjuGLOP_BKVqB00eYuKs82Qn2fNjyxLtcWeyUE2sCRry3qATQIpJRyD7WPVMf9TW-7xFu53dBcoSzAOrsqQNyOe2XUKr0Xi5kcMvdDB2wSYO-I9vKazplV1-T-d6ltgNgSG1KjVUy7ZtmdbdjqtzRcphxMS1-XubOITJtPrQWMvKnYB15_1F7KKadA_AQAA)): +`$inspect` は `with` プロパティを返します。このプロパティにはコールバックを渡すことができ、`console.log` の代わりにそのコールバックが呼び出されます。コールバックの最初の引数は `"init"` または `"update"` で、以降の引数には `$inspect` に渡された値が含まれます ([デモ](/playground/untitled#H4sIAAAAAAAACkVQ24qDMBD9lSEUqlTqPlsj7ON-w7pQG8c2VCchmVSK-O-bKMs-DefKYRYx6BG9qL4XQd2EohKf1opC8Nsm4F84MkbsTXAqMbVXTltuWmp5RAZlAjFIOHjuGLOP_BKVqB00eYuKs82Qn2fNjyxLtcWeyUE2sCRry3qATQIpJRyD7WPVMf9TW-7xFu53dBcoSzAOrsqQNyOe2XUKr0Xi5kcMvdDB2wSYO-I9vKazplV1-T-d6ltgNgSG1KjVUy7ZtmdbdjqtzRcphxMS1-XubOITJtPrQWMvKnYB15_1F7KKadA_AQAA)): ```svelte ``` -`$inspect.trace` takes an optional first argument which will be used as the label. +`$inspect.trace` はオプションで第1引数を受け取り、これがラベルとして使用されます。 diff --git a/apps/svelte.dev/content/docs/svelte/02-runes/08-$host.md b/apps/svelte.dev/content/docs/svelte/02-runes/08-$host.md index 2128c5ab89..dceed1ea23 100644 --- a/apps/svelte.dev/content/docs/svelte/02-runes/08-$host.md +++ b/apps/svelte.dev/content/docs/svelte/02-runes/08-$host.md @@ -3,7 +3,7 @@ NOTE: do not edit this file, it is generated in apps/svelte.dev/scripts/sync-doc title: $host --- -When compiling a component as a [custom element](custom-elements), the `$host` rune provides access to the host element, allowing you to (for example) dispatch custom events ([demo](/playground/untitled#H4sIAAAAAAAAE41Ry2rDMBD8FSECtqkTt1fHFpSSL-ix7sFRNkTEXglrnTYY_3uRlDgxTaEHIfYxs7szA9-rBizPPwZOZwM89wmecqxbF70as7InaMjltrWFR3mpkQDJ8pwXVnbKkKiwItUa3RGLVtk7gTHQXRDR2lXda4CY1D0SK9nCUk0QPyfrCovsRoNFe17aQOAwGncgO2gBqRzihJXiQrEs2csYOhQ-7HgKHaLIbpRhhBG-I2eD_8ciM4KnnOCbeE5dD2P6h0Dz0-Yi_arNhPLJXBtSGi2TvSXdbpqwdsXvjuYsC1veabvvUTog2ylrapKH2G2XsMFLS4uDthQnq2t1cwKkGOGLvYU5PvaQxLsxOkPmsm97Io1Mo2yUPF6VnOZFkw1RMoopKLKAE_9gmGxyDFMwMcwN-Bx_ABXQWmOtAgAA)): +コンポーネントを[カスタム要素 (custom element)](custom-elements) としてコンパイルする際、`$host` rune を使用するとホスト要素 (host element) にアクセスでき、(例えば)custom event をディスパッチすることができます ([デモ](/playground/untitled#H4sIAAAAAAAAE41Ry2rDMBD8FSECtqkTt1fHFpSSL-ix7sFRNkTEXglrnTYY_3uRlDgxTaEHIfYxs7szA9-rBizPPwZOZwM89wmecqxbF70as7InaMjltrWFR3mpkQDJ8pwXVnbKkKiwItUa3RGLVtk7gTHQXRDR2lXda4CY1D0SK9nCUk0QPyfrCovsRoNFe17aQOAwGncgO2gBqRzihJXiQrEs2csYOhQ-7HgKHaLIbpRhhBG-I2eD_8ciM4KnnOCbeE5dD2P6h0Dz0-Yi_arNhPLJXBtSGi2TvSXdbpqwdsXvjuYsC1veabvvUTog2ylrapKH2G2XsMFLS4uDthQnq2t1cwKkGOGLvYU5PvaQxLsxOkPmsm97Io1Mo2yUPF6VnOZFkw1RMoopKLKAE_9gmGxyDFMwMcwN-Bx_ABXQWmOtAgAA)): ```svelte diff --git a/apps/svelte.dev/content/docs/svelte/03-template-syntax/01-basic-markup.md b/apps/svelte.dev/content/docs/svelte/03-template-syntax/01-basic-markup.md index bc98d60573..a8a53175e2 100644 --- a/apps/svelte.dev/content/docs/svelte/03-template-syntax/01-basic-markup.md +++ b/apps/svelte.dev/content/docs/svelte/03-template-syntax/01-basic-markup.md @@ -3,11 +3,11 @@ NOTE: do not edit this file, it is generated in apps/svelte.dev/scripts/sync-doc title: Basic markup --- -Markup inside a Svelte component can be thought of as HTML++. +Svelte コンポーネント内のマークアップは、HTML++ と考えることができます。 ## Tags -A lowercase tag, like `` element is empty and the npm link is broken.
+この演習では、`App.svelte` で `PackageInfo.svelte` が期待する `name` prop を指定し忘れているため、`` 要素が空になり、npm link が壊れています。
-We _could_ fix it by adding the prop...
+以下のように prop を追加することで、これを修正できます…
```svelte
/// file: App.svelte
@@ -16,26 +16,26 @@ We _could_ fix it by adding the prop...
/>
```
-...but since the properties of `pkg` correspond to the component's expected props, we can 'spread' them onto the component instead:
+…ただ、`pkg` のプロパティはこのコンポーネントが期待する props と一致しているので、代わりに 'spread' 構文を使用することができます:
```svelte
/// file: App.svelte
```
-> [!NOTE] Conversely, in `PackageInfo.svelte` you can get an object containing all the props that were passed into a component using a rest property...
+> [!NOTE] 逆に `PackageInfo.svelte` で、rest プロパティを使用して、そのコンポーネントに渡されたオブジェクトの props を全て受け取ることができます...
>
> ```js
> let { name, ...stuff } = $props();
> ```
>
-> ...or by skipping [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) altogether:
+> ...もしくは、[destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) を完全にスキップします:
>
> ```js
> let stuff = $props();
> ```
>
-> ...in which case you can access the properties by their object paths:
+> ...こうすると、これらのオブジェクトパスからプロパティにアクセスできます:
>
> ```js
> console.log(stuff.name, stuff.version, stuff.description, stuff.website);
diff --git a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/01-if-blocks/index.md b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/01-if-blocks/index.md
index 30a2c2e4e3..b6177e3b70 100644
--- a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/01-if-blocks/index.md
+++ b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/01-if-blocks/index.md
@@ -2,9 +2,9 @@
title: If blocks
---
-HTML doesn't have a way of expressing _logic_, like conditionals and loops. Svelte does.
+HTML には条件式やループのような _ロジック_ を表現する方法がありません。Svelteにはあります。
-To conditionally render some markup, we wrap it in an `if` block. Let's add some text that appears when `count` is greater than `10`:
+条件付きでマークアップをレンダリングする場合は、そのマークアップを `if` ブロックで囲みます。`count` が 10 より大きいときに表示されるテキストを追加してみましょう:
```svelte
/// file: App.svelte
@@ -18,4 +18,4 @@ To conditionally render some markup, we wrap it in an `if` block. Let's add some
{/if}+++
```
-Try it — update the component, and click on the button a few times.
+試してみてください。コンポーネントを更新し、ボタンを何回かクリックしてみてください。
diff --git a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/02-else-blocks/index.md b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/02-else-blocks/index.md
index 52cfc5564e..142a390004 100644
--- a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/02-else-blocks/index.md
+++ b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/02-else-blocks/index.md
@@ -2,7 +2,7 @@
title: Else blocks
---
-Just like in JavaScript, an `if` block can have an `else` block:
+JavaScript と同じように、`if` ブロックには `else` ブロックを置くことができます:
```svelte
/// file: App.svelte
@@ -13,4 +13,4 @@ Just like in JavaScript, an `if` block can have an `else` block:
{/if}
```
-`{#...}` opens a block. `{/...}` closes a block. `{:...}` _continues_ a block. Congratulations — you've already learned almost all the syntax Svelte adds to HTML.
+`{#...}` はブロックを開始します。`{/...}` はブロックを終了します。`{:...}` はブロックを継続します。おめでとうございます!あなたは既にSvelteがHTMLに追加した構文のほとんどを学びました。
diff --git a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/03-else-if-blocks/index.md b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/03-else-if-blocks/index.md
index 22ea202a96..72718d256d 100644
--- a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/03-else-if-blocks/index.md
+++ b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/03-else-if-blocks/index.md
@@ -2,7 +2,7 @@
title: Else-if blocks
---
-Multiple conditions can be 'chained' together with `else if`:
+複数の条件を `else if` と一緒に '連結' することができます。
```svelte
/// file: App.svelte
diff --git a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/04-each-blocks/index.md b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/04-each-blocks/index.md
index 3154fb74be..3b85c89d6b 100644
--- a/apps/svelte.dev/content/tutorial/01-svelte/04-logic/04-each-blocks/index.md
+++ b/apps/svelte.dev/content/tutorial/01-svelte/04-logic/04-each-blocks/index.md
@@ -2,9 +2,9 @@
title: Each blocks
---
-When building user interfaces you'll often find yourself working with lists of data. In this exercise, we've repeated the `
- Backed by Vercel and countless donors, - developed by full-time and part-time maintainers, Svelte is here to stay. + Vercel と数え切れない貢献者による支援、 + そしてフルタイムまたはパートタイムのメンテナーによる開発のおかげで、Svelte はここに存在しています。
- Svelte is a UI framework that uses a compiler to let you write breathtakingly concise - components that do minimal work in the browser, using languages you already know — HTML, CSS - and JavaScript. It’s a love letter to web development. + Svelte はコンパイラを使用する UI フレームワークで、息を呑むほど簡潔にコンポーネントを記述でき、 + ブラウザで最小限の動作となるようにしてくれます。開発者には既知の言語である HTML、CSS、JavaScript を使うことができます。 + これは、web 開発へのラブレターです。
- But don’t take our word for it. Developers consistently rank Svelte as the framework they’re - most excited about using. + 私たちだけでなく、常に開発者たちからも、Svelte は使用する上で最もエキサイティングなフレームワークとしてランク付けされています。
- Head to the Svelte or SvelteKit reference docs,
- or choose your adventure:
+ Svelte または SvelteKit のリファレンスドキュメントに移動するか、
+
あなたに合った冒険を以下から選択してください: