Skip to content

Commit 7d3709c

Browse files
committed
Translate Data Mapper
1 parent 6b2bc97 commit 7d3709c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README-ja-jp.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _このドキュメントは[AngularJS in Patterns](https://github.com/mgechev/a
3636
* [ページ・コントローラ](#ページ・コントローラ)
3737
* [その他](#その他)
3838
* [モジュール・パターン](#モジュール・パターン)
39-
* [Data Mapper](#data-mapper)
39+
* [データ・マッパ](#データ・マッパ)
4040
* [References](#references)
4141

4242
<!--endtoc-->
@@ -1014,28 +1014,28 @@ app.factory('foo', function () {
10141014
10151015
Once we want to inject `foo` inside any other component we won't be able to use the private methods, but only the public ones. This solution is extremely powerful especially when one is building a reusable library.
10161016
1017-
### Data Mapper
1017+
### データ・マッパ
10181018
1019-
>A Data Mapper is a Data Access Layer that performs bidirectional transfer of data between a persistent data store (often a relational database) and an in memory data representation (the domain layer). The goal of the pattern is to keep the in memory representation and the persistent data store independent of each other and the data mapper itself.
1019+
>データ・マッパは永続データ・ストア(リレーショナル・データベースがよく使われる)とイン・メモリ・データ・リプリゼンテーション(ドメイン・レイヤ)との双方向のやりとりをするためのデータ・アクセス・レイヤです。このパターンの目的はイン・メモリ・リプリゼンテーションと永続データ・ストアとマッパそれ自体をそれぞれ独立させることです。
10201020
10211021
![Data Mapper](https://rawgit.com/mgechev/angularjs-in-patterns/master/images/data-mapper.svg "Fig. 10")
10221022
1023-
As the description above states, the data mapper is used for bidirectional transfer of data between a persistent data store and an in memory data representation. Usually our AngularJS application communicates with API server, which is written in any server-side language (Ruby, PHP, Java, JavaScript, etc.).
1023+
上記の図が示すように、データ・マッパは永続データ・ストアとイン・メモリ・データ・リプレゼンテーションの双方向通信をするために利用されています。普通、AngluarJSアプリケーションでは、サーバ・サイドの言語(Ruby, PHP, Java, JavaScriptなど)で書かれたAPIサーバとやりとりします。
10241024
1025-
Usually, if we have RESTful API `$resource` will help us communicate with the server in Active Record like fashion. Although, in some applications the data entities returned by the server are not in the most appropriate format, which we want to use in the front-end.
1025+
普通、RESTful APIを持っている場合、 `$resource` がアクティブ・レコードのような形でその通信をサポートします。しかし、アプリケーションによってはサーバから返されるデータがフロントエンドで利用するには適切で無いフォーマットで返されることもあります。
10261026
1027-
For instance, lets assume we have application in which each user has:
1027+
例えば、ユーザが次の要素を持つと想定してみてください:
10281028
1029-
- name
1030-
- address
1031-
- list of friends
1029+
- 名前
1030+
- 住所
1031+
- 友達リスト
10321032
1033-
And our API has the methods:
1033+
そして、APIが次のメソッドを持つとします:
10341034
1035-
- `GET /user/:id` - returns the user's name and the address of given user
1036-
- `GET /friends/:id` - returns the list of friends of given user
1035+
- `GET /user/:id` - ユーザの名前と住所を返します
1036+
- `GET /friends/:id` - ユーザの友達リストを返します
10371037
1038-
Possible solution is to have two different services, one for the first method and one for the second one. Probably more useful solution would be if we have a single service called `User`, which loads the user's friends when we request the user:
1038+
解決策としては2つの別々のサービスを作ることです。恐らくもう少し有効な解決策は、 `User` という1つのサービスがあった場合に、ユーザをリクエストした際に、ユーザの友達リストも一緒に読み込むことです。
10391039
10401040
```javascript
10411041
app.factory('User', function ($q) {
@@ -1058,9 +1058,9 @@ app.factory('User', function ($q) {
10581058
});
10591059
```
10601060
1061-
This way we create pseudo-data mapper, which adapts our API according to the SPA requirements.
1061+
この方法でSPAの要求に応じてAPIを適用させた仮のデータ・マッパを作ることができます。
10621062
1063-
We can use the `User` service by:
1063+
`User` サービスはこのように利用することができます:
10641064
10651065
```javascript
10661066
function MainCtrl($scope, User) {
@@ -1071,7 +1071,7 @@ function MainCtrl($scope, User) {
10711071
}
10721072
```
10731073
1074-
And the following partial:
1074+
そして、パーシャルがこちらです:
10751075
10761076
```html
10771077
<div>

0 commit comments

Comments
 (0)