@@ -160,19 +201,33 @@ export default {
```
-You can also have modules by exporting a store instance, you will have to add them manually on your store.
+
+
+ストアインスタンスをエクスポートすることでモジュールを持つこともできます。その際にはモジュールをストアに手動で追加する必要があります。
+
+
-## The fetch Method
+## fetch メソッド
-> The fetch method is used to fill the store before rendering the page, it's like the data method except it doesn't set the component data.
+
-More information about the fetch method: [API Pages fetch](/api/pages-fetch)
+fetch メソッドは、ページがレンダリングされる前に、データをストアに入れるために使われます。コンポーネントのデータをセットしないという点を除いては data メソッドとよく似ています。
-## The nuxtServerInit Action
+
-If the action `nuxtServerInit` is defined in the store, nuxt.js will call it with the context (only from the server-side). It's useful when we have some data on the server we want to give directly to the client-side.
+fetch メソッドについてより深く理解するためには [API Pages fetch](/api/pages-fetch) を参照してください。
-For example, let's say we have sessions on the server-side and we can access the connected user trough `req.session.user`. To give the authenticated user to our store, we update our `store/index.js` to the following:
+
+
+## nuxtServerInit アクション
+
+
+
+`nuxtServerInit` というアクションがストア内に定義されているときは、Nuxt.js はそれを context とともに呼び出します(サーバーサイドでのみ)。クライアントサイドに直接渡したいデータがサーバー上にあるときに便利です。
+
+
+
+例えば、サーバーサイドでセッションを持っていて、接続しているユーザーに `req.session.user` を通してアクセスできるとします。認証されたユーザーにストアを渡すために `store/index.js` 下記のように書き換えます:
```js
actions: {
@@ -184,6 +239,10 @@ actions: {
}
```
-> If you are using the _Modules_ mode of the Vuex store, only the primary module (in `store/index.js`) will receive this action. You'll need to chain your module actions from there.
+
+
+> もし Vuex ストアの _モジュール_ モードを使っているなら、(`store/index.js` 内の)プライマリモードのみ、このアクションを受け取ることができます。そこからモジュールのアクションをつなぐ必要があります。
The context is given to `nuxtServerInit` as the 2nd argument, it is the same as the `data` or `fetch` method except that `context.redirect()` and `context.error()` are omitted.
+
+context は `nuxtServerInit` へ第二引数として渡されます。`context.redirect()` や `context.error()` が除外される点を除いては `data` メソッドや `fetch` メソッドと共通しています。