Skip to content

Commit 41295be

Browse files
committed
docs: translate sfc spec
1 parent b36e53d commit 41295be

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

src/.vuepress/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,19 @@ const sidebar = {
164164
collapsable: false,
165165
children: [
166166
{
167-
title: 'Spec',
167+
title: '仕様',
168168
path: '/api/sfc-spec'
169169
},
170170
{
171-
title: 'Tooling',
171+
title: 'ツール',
172172
path: '/api/sfc-tooling'
173173
},
174174
{
175175
title: '<script setup>',
176176
path: '/api/sfc-script-setup'
177177
},
178178
{
179-
title: '<style> Features',
179+
title: '<style> 機能',
180180
path: '/api/sfc-style'
181181
}
182182
]

src/api/sfc-spec.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# SFC Syntax Specification
1+
# SFC 構文の仕様
22

3-
## Intro
3+
## はじめに
44

5-
A `*.vue` file is a custom file format that uses HTML-like syntax to describe a Vue component. Each `*.vue` file consists of three types of top-level language blocks: `<template>`, `<script>`, and `<style>`, and optionally additional custom blocks:
5+
`*.vue` ファイルは、HTML のような構文を使って Vue コンポーネントを記述するカスタムファイル形式です。各 `*.vue` ファイルは 3 種類のトップレベル言語ブロックから構成されます: `<template>``<script>` `<style>` に、必要に応じてカスタムブロックがあります:
66

77
```vue
88
<template>
@@ -30,63 +30,63 @@ export default {
3030
</custom1>
3131
```
3232

33-
## Language Blocks
33+
## 言語ブロック
3434

3535
### `<template>`
3636

37-
- Each `*.vue` file can contain at most one top-level `<template>` block at a time.
37+
- `*.vue` ファイルは一度に最大 1 つのトップレベル `<template>` ブロックを含めることができます。
3838

39-
- Contents will be extracted and passed on to `@vue/compiler-dom`, pre-compiled into JavaScript render functions, and attached to the exported component as its `render` option.
39+
- コンテンツは抽出され、`@vue/compiler-dom` に渡され、JavaScript の Render 関数にプリコンパイルされ、エクスポートされたコンポーネントの `render` オプションとしてアタッチされます。
4040

4141
### `<script>`
4242

43-
- Each `*.vue` file can contain at most one `<script>` block at a time (excluding [`<script setup>`](/api/sfc-script-setup.html)).
43+
- `*.vue` ファイルは一度に最大 1 つの `<script>` ブロック([`<script setup>`](/api/sfc-script-setup.html) を除く)を含むことができます。
4444

45-
- The script is executed as an ES Module.
45+
- スクリプトは ES モジュールとして実行されます。
4646

47-
- The **default export** should be a Vue component options object, either as a plain object or as the return value of [defineComponent](/api/global-api.html#definecomponent).
47+
- **default export** は、プレーンなオブジェクトとして、または [defineComponent](/api/global-api.html#definecomponent) の戻り値として、Vue コンポーネントのオプションオブジェクトでなければなりません。
4848

4949
### `<script setup>`
5050

51-
- Each `*.vue` file can contain at most one `<script setup>` block at a time (excluding normal `<script>`).
51+
- `*.vue` ファイルは一度に最大 1 つの `<script setup>` ブロック(通常の `<script>` を除く)を含むことができます。
5252

53-
- The script is pre-processed and used as the component's `setup()` function, which means it will be executed **for each instance of the component**. Top-level bindings in `<script setup>` are automatically exposed to the template. For more details, see [dedicated documentation on `<script setup>`](/api/sfc-script-setup).
53+
- スクリプトは事前処理され、コンポーネントの `setup()` 関数として使用されます。つまり、**コンポーネントのインスタンスごとに** 実行されます。`<script setup>` のトップレベルのバインディングは、自動的にテンプレートへ公開されます。詳細については、[`<script setup>` の専用ドキュメント](/api/sfc-script-setup) を参照してください。
5454

5555
### `<style>`
5656

57-
- A single `*.vue` file can contain multiple `<style>` tags.
57+
- 1 つの `*.vue` ファイルには複数の `<style>` タグを含めることができます。
5858

59-
- A `<style>` tag can have `scoped` or `module` attributes (see [SFC Style Features](/api/sfc-style) for more details) to help encapsulate the styles to the current component. Multiple `<style>` tags with different encapsulation modes can be mixed in the same component.
59+
- `<style>` は、現在のコンポーネントにスタイルをカプセル化するのに役立つ `scoped` `module` 属性を持つことができます(詳しくは [SFC Style Features](/api/sfc-style) を参照)。カプセル化モードが異なる複数の `<style>` タグを同じコンポーネントに混在させることができます。
6060

61-
### Custom Blocks
61+
### カスタムブロック
6262

63-
Additional custom blocks can be included in a `*.vue` file for any project-specific needs, for example a `<docs>` block. Some real-world examples of custom blocks include:
63+
様々なプロジェクト固有のニーズ、例えば `<docs>` ブロックなど、追加のカスタムブロックを `*.vue` ファイルに含めることができます。カスタムブロックの実例には、次のようなものがあります:
6464

6565
- [Gridsome: `<page-query>`](https://gridsome.org/docs/querying-data/)
6666
- [vite-plugin-vue-gql: `<gql>`](https://github.com/wheatjs/vite-plugin-vue-gql)
6767
- [vue-i18n: `<i18n>`](https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n#i18n-custom-block)
6868

69-
Handling of Custom Blocks will depend on tooling - if you want to build your own custom block integrations, see [SFC Tooling](/api/sfc-tooling.html#custom-blocks-integration) for more details.
69+
カスタムブロックの処理はツールに依存します。もし独自のカスタムブロック統合を構築したいなら、[SFC ツール](/api/sfc-tooling.html#custom-blocks-integration) で詳細について参照してください。
7070

71-
## Automatic `name` Inference
71+
## 自動 `name` 推論
7272

73-
An SFC automatically infers the component's name from its **filename** in the following cases:
73+
SFC は次のようなケースで **ファイル名** からコンポーネント名を自動で推測します:
7474

75-
- Dev warning formatting
76-
- DevTools inspection
77-
- Recursive self-reference. E.g. a file named `FooBar.vue` can refer to itself as `<FooBar/>` in its template. This has lower priority than explicity registered/imported components.
75+
- 開発警告のフォーマット
76+
- DevTools のインスペクタ
77+
- 再帰的な自己参照。例えば `FooBar.vue` というファイル名は、そのテンプレート内で `<FooBar/>` というようにそれ自体を参照できます。これは明示的に登録・インポートされたコンポーネントよりは優先度が低くなります。
7878

79-
## Pre-Processors
79+
## プリプロセッサ
8080

81-
Blocks can declare pre-processor languages using the `lang` attribute. The most common case is using TypeScript for the `<script>` block:
81+
ブロックは `lang` 属性を使ってプリプロセッサの言語を宣言することができます。もっとも一般的なケースは `<script>` ブロックで TypeScript を使用することです:
8282

8383
```html
8484
<script lang="ts">
85-
// use TypeScript
85+
// TypeScript を使用
8686
</script>
8787
```
8888

89-
`lang` can be applied to any block - for example we can use `<style>` with [SASS](https://sass-lang.com/) and `<template>` with [Pug](https://pugjs.org/api/getting-started.html):
89+
`lang` はどのブロックにも適用できます。例えば `<style>` [SASS](https://sass-lang.com/) `<template>` [Pug](https://pugjs.org/api/getting-started.html) を使えます:
9090

9191
```html
9292
<template lang="pug">
@@ -101,39 +101,39 @@ p {{ msg }}
101101
</style>
102102
```
103103

104-
Note the intergration with pre-processors may differ based on the toolchain. Check out the respective documentations for examples:
104+
プリプロセッサとの統合はツールチェーンによって異なる場合があることに注意してください。例については、各ドキュメントを参照してください:
105105

106106
- [Vite](https://vitejs.dev/guide/features.html#css-pre-processors)
107107
- [Vue CLI](https://cli.vuejs.org/guide/css.html#pre-processors)
108108
- [webpack + vue-loader](https://vue-loader.vuejs.org/guide/pre-processors.html#using-pre-processors)
109109

110110
## Src Imports
111111

112-
If you prefer splitting up your `*.vue` components into multiple files, you can use the `src` attribute to import an external file for a language block:
112+
`*.vue` コンポーネントを複数のファイルに分割したい場合は、`src` 属性を使って、言語ブロックに外部ファイルをインポートできます:
113113

114114
```vue
115115
<template src="./template.html"></template>
116116
<style src="./style.css"></style>
117117
<script src="./script.js"></script>
118118
```
119119

120-
Beware that `src` imports follow the same path resolution rules as webpack module requests, which means:
120+
`src` インポートは webpack のモジュールリクエストと同じパス解決ルールに従うことに注意してください。つまり次のことです:
121121

122-
- Relative paths need to start with `./`
123-
- You can import resources from npm dependencies:
122+
- 相対パスは `./` から始まる必要があります
123+
- npm の依存関係からリソースをインポートできます:
124124

125125
```vue
126-
<!-- import a file from the installed "todomvc-app-css" npm package -->
126+
<!-- インストールされた "todomvc-app-css" npm パッケージのファイルをインポート -->
127127
<style src="todomvc-app-css/index.css">
128128
```
129129

130-
`src` imports also work with custom blocks, e.g.:
130+
`src` インポートはカスタムブロックでも機能します。例えば:
131131

132132
```vue
133133
<unit-test src="./unit-test.js">
134134
</unit-test>
135135
```
136136

137-
## Comments
137+
## コメント
138138

139-
Inside each block you shall use the comment syntax of the language being used (HTML, CSS, JavaScript, Pug, etc.). For top-level comments, use HTML comment syntax: `<!-- comment contents here -->`
139+
各ブロック内では、使用している言語(HTMLCSSJavaScriptPug など)のコメント構文を使用してください。トップレベルのコメントには、HTML コメント構文を使用します: `<!-- comment contents here -->`

0 commit comments

Comments
 (0)