Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Reflect "Update doc for 0.10 · nuxt/docs@11d0be2" to Japanese translation #87

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions jp/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ module.exports = {
module.exports = {
build: {
filenames: {
css: 'app.[hash].css',
vendor: 'vendor.[hash].js',
app: 'app.[chunkhash].js'
}
Expand Down Expand Up @@ -281,9 +280,9 @@ module.exports = {

## postcss

<!-- - **Type:** `Array` -->
<!-- - Type: `Array` -->

- **タイプ:** `配列`
- タイプ: `配列`

<!-- \> Customize [postcss](https://github.com/postcss/postcss) options -->

Expand Down Expand Up @@ -320,17 +319,45 @@ module.exports = {
}
```

## publicPath

<!-- - Type: `String` -->
<!-- - Default: `'/_nuxt/'` -->

- タイプ: `文字列`
- デフォルト: `'/_nuxt/'`

<!-- \> Nuxt.js lets you upload your dist files to your CDN for maximum performances, simply set the `publicPath` to your CDN. -->

> 最高のパフォーマンスを発揮させるために dist ディレクトリ内のファイルを CDN へアップロードできます。そのためには単に `publicPath` に利用する CDN をセットするだけです。

<!-- Example (`nuxt.config.js`): -->

例(`nuxt.config.js`):

```js
module.exports = {
build: {
publicPath: 'https://cdn.nuxtjs.org'
}
}
```

<!-- Then, when launching `nuxt build`, upload the content of `.nuxt/dist/` directory to your CDN and voilà! -->

設定すると、`nuxt build` を実行したタイミングで `.nuxt/dist/` ディレクトリの内容が CDN にアップロードされます!

## vendor

<!-- \> Nuxt.js lets you add modules inside the `vendor.bundle.js` file generated to reduce the size of the app bundle. It's really useful when using external modules (like `axios` for example) -->

> Nuxt.js では `vendor.bundle.js` ファイル内にモジュールを追加できます。このファイルは app バンドルファイルのサイズを小さくするために生成します。外部モジュール(例えば `axios` など)を使うときにとても便利です。

<!-- - **Type:** `Array` -->
<!-- - **Items:** `String` -->
<!-- - Type: `Array` -->
<!-- - Items: `String` -->

- **タイプ:** `配列`
- **要素:** `文字列`
- タイプ: `配列`
- 要素: `文字列`

<!-- To add a module/file inside the vendor bundle, add the `build.vendor` key inside `nuxt.config.js`: -->

Expand Down
4 changes: 2 additions & 2 deletions jp/api/configuration-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ description: Nuxt.js はレンダリングのパフォーマンス向上を目

## 使い方

<!-- - **Type:** `Boolean` or `Object` (Default: `false`) -->
<!-- - Type: `Boolean` or `Object` (Default: `false`) -->

- **タイプ:** `ブーリアン` または `オブジェクト`(デフォルト: `false`)
- タイプ: `ブーリアン` または `オブジェクト`(デフォルト: `false`)

<!-- If an object, see [lru-cache options](https://github.com/isaacs/node-lru-cache#options). -->

Expand Down
8 changes: 4 additions & 4 deletions jp/api/configuration-css.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ description: Nuxt.js ではグローバルに適用したい(すべてのペ

> Nuxt.js ではグローバルに適用したい(すべてのページにインクルードしたい)CSS ファイル/モジュール/ライブラリを設定できます。

<!-- - **Type:** `Array` -->
<!-- - **Items:** `String` or `Object` -->
<!-- - Type: `Array` -->
<!-- - Items: `String` or `Object` -->

- **タイプ:** `配列`
- **要素:** `文字列` または `オブジェクト`
- タイプ: `配列`
- 要素: `文字列` または `オブジェクト`

<!-- If the item is an object, the properties are: -->

Expand Down
4 changes: 2 additions & 2 deletions jp/api/configuration-generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ nuxt:generate HTML Files generated in 7.6s +6ms
いいですね。しかし、もし **動的なパラメータ** が必要な場合はどうでしょう?

<!-- 1. Use a `Function` which returns a `Promise` -->
<!-- 2. Use a `Function` with a callback(err, params) -->
<!-- 2. Use a `Function` with a `callback(err, params)` -->

1. `Promise` を返す `関数` を使う
2. コールバックと一緒に `関数` を使う
2. `コールバック` と一緒に `関数` を使う

<!-- ### Function which returns a Promise -->

Expand Down
4 changes: 2 additions & 2 deletions jp/api/configuration-head.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ description: Nuxt.js では nuxt.config.js 内にアプリケーションのデ

Nuxt.js では `nuxt.config.js` 内にアプリケーションのデフォルトのメタ情報を定義できます。それには `head` プロパティを使います:

<!-- - **Type:** `Object` -->
<!-- - Type: `Object` -->

- **タイプ:** `オブジェクト`
- タイプ: `オブジェクト`

```js
module.exports = {
Expand Down
13 changes: 11 additions & 2 deletions jp/api/configuration-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ description: Nuxt.js の plugins オプションで Vue.js プラグインを使
# plugins プロパティ

<!-- - Type: `Array` -->
<!-- - Items: `String` -->
<!-- - Items: `String` or `Object` -->

- タイプ: `配列`
- 要素: `文字列`
- 要素: `文字列` または `オブジェクト`

<!-- If the item is an object, the properties are: -->
<!-- - src: `String` (path of the file) -->
<!-- - ssr: `Boolean` (default to `true`) *If false, the file will be included only on the client-side.* -->

オブジェクトの場合にはプロパティは次のとおり:

- src: `文字列`(ファイルパス)
- ssr: `ブーリアン`(デフォルトは `true`)*false のときは、クライアントサイドでのみファイルがインクルードされます*

<!-- \> The plugins property lets you add vue.js plugins easily to your main application. -->

Expand Down
28 changes: 28 additions & 0 deletions jp/api/configuration-router.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,34 @@ module.exports = {

> このオプションは vue-router の [Router コンストラクタ](https://router.vuejs.org/en/api/options.html) に直接付与されます。

## mode

<!-- - Type: `String` -->
<!-- - Default: `'history'` -->

- タイプ: `文字列`
- デフォルト: `'history'`

<!-- Configure the router mode, this is not recommended to change it due to server-side rendering. -->

ルーティングのモードを設定します。サーバーサイドレンダリングのため、この設定を変更することは非推奨です。

<!-- Example (`nuxt.config.js`): -->

例(`nuxt.config.js`):

```js
module.exports = {
router: {
mode: 'hash'
}
}
```

<!-- \> This option is given directly to the vue-router [Router constructor](https://router.vuejs.org/en/api/options.html). -->

> このオプションは直接 vue-router の [Router コンストラクタ](https://router.vuejs.org/en/api/options.html) に渡されます。

## linkActiveClass

<!-- - Type: `String` -->
Expand Down
3 changes: 3 additions & 0 deletions jp/api/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
{ "name": "loaders", "to": "#loaders" },
{ "name": "plugins", "to": "#plugins" },
{ "name": "postcss", "to": "#postcss" },
{ "name": "publicPath", "to": "#publicpath" },
{ "name": "vendor", "to": "#vendor" }
]
},
Expand All @@ -53,6 +54,7 @@
"to": "/configuration-generate",
"contents": [
{ "name": "dir", "to": "#dir" },
{ "name": "minify", "to": "#minify" },
{ "name": "routes", "to": "#routes" }
]
},
Expand Down Expand Up @@ -81,6 +83,7 @@
"to": "/configuration-router",
"contents": [
{ "name": "base", "to": "#base" },
{ "name": "mode", "to": "#mode" },
{ "name": "linkActiveClass", "to": "#linkactiveclass" },
{ "name": "scrollBehavior", "to": "#scrollbehavior" },
{ "name": "middleware", "to": "#middleware" },
Expand Down
6 changes: 4 additions & 2 deletions jp/api/pages-transition.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export default {
<!-- |------|------|---------|-----------| -->
<!-- | `name` | String | `"page"` | The transition name applied on all the routes transitions. | -->
<!-- | `mode` | String | `"out-in"` | The transition mode applied on all routes, see [Vue.js documentation](http://vuejs.org/v2/guide/transitions.html#Transition-Modes). | -->
<!-- | `css` | Boolean | `true` | Whether to apply CSS transition classes. Defaults to true. If set to false, will only trigger JavaScript hooks registered via component events. | -->
<!-- | `css` | Boolean | `true` | Whether to apply CSS transition classes. Defaults to `true`. If set to false, will only trigger JavaScript hooks registered via component events. | -->
<!-- | `duration` | Integer | `n/a` | The duration (in milliseconds) applied on the transition, see [Vue.js documentation](https://vuejs.org/v2/guide/transitions.html#Explicit-Transition-Durations). | -->
<!-- | `type` | String | `n/a` | Specify the type of transition events to wait for to determine transition end timing. Available values are "transition" and "animation". By default, it will automatically detect the type that has a longer duration. | -->
<!-- | `enterClass` | String | `n/a` | The starting state of the transition class. See [Vue.js documentation](https://vuejs.org/v2/guide/transitions.html#Custom-Transition-Classes) | -->
<!-- | `enterToClass` | String | `n/a` | The ending state for the transition. See [Vue.js documentation](https://vuejs.org/v2/guide/transitions.html#Custom-Transition-Classes) | -->
Expand All @@ -112,7 +113,8 @@ export default {
|------|------|---------|-----------|
| `name` | 文字列 | `"page"` | すべてのトランジション時に適用されるトランジション名 |
| `mode` | 文字列 | `"out-in"` | すべてのトランジション時に適用されるトランジションモード。詳細は [Vue.js のドキュメント](http://vuejs.org/v2/guide/transitions.html#Transition-Modes) 参照 |
| `css` | ブーリアン | `true` | CSS トランジションクラスを適用するか否か。デフォルトは true です。false を設定すると、コンポーネントのイベントで登録された JavaScript フックのみがトリガーになります |
| `css` | ブーリアン | `true` | CSS トランジションクラスを適用するか否か。デフォルトは `true` です。false を設定すると、コンポーネントのイベントで登録された JavaScript フックのみがトリガーになります |
| `duration` | 整数 | `n/a` | トランジションが適用される時間(ミリ秒)です。詳細は [Vue.js のドキュメント](https://vuejs.org/v2/guide/transitions.html#Explicit-Transition-Durations) 参照 |
| `type` | 文字列 | `n/a` | トランジション終了のタイミングを判定するために待ち受けるトランジションのイベントタイプを指定します。"transition" または "animation" を指定できます。デフォルトでは、より時間がかかるほうのタイプが自動的に選ばれます |
| `enterClass` | 文字列 | `n/a` | トランジション開始時の状態のクラスです。詳細は [Vue.js のドキュメント](https://vuejs.org/v2/guide/transitions.html#Custom-Transition-Classes) 参照 |
| `enterToClass` | 文字列 | `n/a` | トランジション終了時の状態のクラスです。詳細は [Vue.js のドキュメント](https://vuejs.org/v2/guide/transitions.html#Custom-Transition-Classes) 参照 |
Expand Down
40 changes: 15 additions & 25 deletions jp/faq/google-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ description: Google アナリティクスを使うには?
Nuxt.js アプリケーションで [Google アナリティクス](https://analytics.google.com/analytics/web/) を使うには `plugins/ga.js` というファイルを作成することを推奨します:

<!-- ```js -->
<!-- import router from '~router' -->
<!-- /* -->
<!-- ** Only run on client-side and only in production mode -->
<!-- */ -->
<!-- if (process.BROWSER_BUILD && process.env.NODE_ENV === 'production') { -->
<!-- if (process.env.NODE_ENV === 'production') { -->
<!-- /* -->
<!-- ** Include Google Analytics Script -->
<!-- */ -->
Expand All @@ -30,30 +31,25 @@ Nuxt.js アプリケーションで [Google アナリティクス](https://analy
<!-- ** Set the current page -->
<!-- */ -->
<!-- ga('create', 'UA-XXXXXXXX-X', 'auto') -->
<!-- ga('send', 'pageview') -->
<!-- /* -->
<!-- ** When the app is mounted -->
<!-- ** Every time the route changes (fired on initialization too) -->
<!-- */ -->
<!-- window.onNuxtReady((app) => { -->
<!-- router.afterEach((to, from) => { -->
<!-- /* -->
<!-- ** Every time the route changes -->
<!-- ** We tell Google Analytic to add a page view -->
<!-- */ -->
<!-- app.$nuxt.$on('routeChanged', (to, from) => { -->
<!-- /* -->
<!-- ** We tell Google Analytic to add a page view -->
<!-- */ -->
<!-- ga('set', 'page', to.fullPath) -->
<!-- ga('send', 'pageview') -->
<!-- }) -->
<!-- ga('set', 'page', to.fullPath) -->
<!-- ga('send', 'pageview') -->
<!-- }) -->
<!-- } -->
<!-- ``` -->

```js
import router from '~router'
/*
** クライアントサイドかつプロダクションモードでのみ実行
*/
if (process.BROWSER_BUILD && process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
/*
** Google アナリティクスのスクリプトをインクルード
*/
Expand All @@ -65,21 +61,15 @@ if (process.BROWSER_BUILD && process.env.NODE_ENV === 'production') {
** 現在のページをセット
*/
ga('create', 'UA-XXXXXXXX-X', 'auto')
ga('send', 'pageview')
/*
** アプリケーションがマウントしたとき
** ルートが変更されるたびに毎回実行(初期化も実行される)
*/
window.onNuxtReady((app) => {
router.afterEach((to, from) => {
/*
** ルートが変更されるたびに
** Google アナリティクスにページビューが追加されたことを伝える
*/
app.$nuxt.$on('routeChanged', (to, from) => {
/*
** Google アナリティクスにページビューが追加されたことを伝える
*/
ga('set', 'page', to.fullPath)
ga('send', 'pageview')
})
ga('set', 'page', to.fullPath)
ga('send', 'pageview')
})
}
```
Expand All @@ -97,7 +87,7 @@ if (process.BROWSER_BUILD && process.env.NODE_ENV === 'production') {
```js
module.exports = {
plugins: [
'~plugins/ga.js'
{ src: '~plugins/ga.js', ssr: false }
]
}
```
Expand Down
24 changes: 17 additions & 7 deletions jp/guide/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,33 @@ module.exports = {

## クライアントサイド限定のプラグイン利用

<!-- Some plugins might work **only for the browser**, you can use the `process.BROWSER_BUILD` variable to check if the plugin will run from the client-side. -->
<!-- Some plugins might work **only for the browser**, you can use the `ssr: false` option in `plugins` to run the file only on the client-side. -->

プラグインのいくつかは **ブラウザでのみ** 動かしたいとします。その場合は `process.BROWSER_BUILD` 変数を使って、あるプラグインをクライアントサイドで動作させることが可能です
プラグインのいくつかは **ブラウザでのみ** 動かしたいとします。その場合は `plugins` 内の `ssr: false` オプションを使うと、プラグインをクライアントサイドでのみ実行させるが可能です

<!-- Example: -->

例:

`nuxt.config.js`:

```js
module.exports = {
plugins: [
{ src: '~plugins/vue-notifications', ssr: false }
]
}
```

`plugins/vue-notifications.js`:

```js
import Vue from 'vue'
import VueNotifications from 'vue-notifications'

if (process.BROWSER_BUILD) {
Vue.use(VueNotifications)
}
Vue.use(VueNotifications)
```

<!-- In case you need to require some libraries only for the server, you can use the `process.SERVER_BUILD` variable set to `true` when webpack is creating the `server.bundle.js` file. -->
<!-- In case you need to require some libraries only for the server, you can use the `process.server` variable set to `true` when webpack is creating the `server.bundle.js` file. -->

逆に、サーバーサイドでのみライブラリを読み込む必要がある場合は、`process.SERVER_BUILD` 変数を使うことができます。これは Webpack が `server.bundle.js` ファイルを作成するタイミングで `true` がセットされる変数です。
逆に、サーバーサイドでのみライブラリを読み込む必要がある場合は、`process.server` 変数を使うことができます。これは Webpack が `server.bundle.js` ファイルを作成するタイミングで `true` がセットされる変数です。
14 changes: 8 additions & 6 deletions jp/guide/views.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ Nuxt.js ではメインレイアウトを拡張したり、カスタムレイア

<!-- <script> -->
<!-- export default { -->
<!-- props: ['error'] -->
<!-- props: ['error'], -->
<!-- layout: 'blog' // you can set a custom layout for the error page -->
<!-- } -->
<!-- </script> -->
<!-- ``` -->
Expand All @@ -179,7 +180,8 @@ Nuxt.js ではメインレイアウトを拡張したり、カスタムレイア

<script>
export default {
props: ['error']
props: ['error'],
layout: 'blog' // エラーページ用のカスタムレイアウトを指定できます
}
</script>
```
Expand Down Expand Up @@ -251,17 +253,17 @@ Nuxt.js では下記のオプションで `vue-meta` を設定します:
<!-- ```js -->
<!-- { -->
<!-- keyName: 'head', // the component option name that vue-meta looks for meta info on. -->
<!-- attribute: 'n-head', // the attribute name vue-meta adds to the tags it observes -->
<!-- ssrAttribute: 'n-head-ssr', // the attribute name that lets vue-meta know that meta info has already been server-rendered -->
<!-- attribute: 'data-n-head', // the attribute name vue-meta adds to the tags it observes -->
<!-- ssrAttribute: 'data-n-head-ssr', // the attribute name that lets vue-meta know that meta info has already been server-rendered -->
<!-- tagIDKeyName: 'hid' // the property name that vue-meta uses to determine whether to overwrite or append a tag -->
<!-- } -->
<!-- ``` -->

```js
{
keyName: 'head', // vue-meta がメタ情報を探すためのコンポーネントオプションの名前
attribute: 'n-head', // vue-meta がタグを監視するためにタグに追加する属性名
ssrAttribute: 'n-head-ssr', // メタ情報が既にサーバーサイドでレンダリングされていることを vue-meta に知らせるための属性名
attribute: 'data-n-head', // vue-meta がタグを監視するためにタグに追加する属性名
ssrAttribute: 'data-n-head-ssr', // メタ情報が既にサーバーサイドでレンダリングされていることを vue-meta に知らせるための属性名
tagIDKeyName: 'hid' // vue-meta がタグを上書きすべきかタグを追加すべきか判断するために用いるプロパティ名
}
```
Expand Down