Skip to content

Commit 42dcf3a

Browse files
committed
Translate Template View
1 parent aa7345d commit 42dcf3a

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

README-ja-jp.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ _このドキュメントは[AngularJS in Patterns](https://github.com/mgechev/a
2727
* [ディレクティブ](#ディレクティブ-1)
2828
* [コンポジット](#コンポジット)
2929
* [インタープリタ](#インタープリタ)
30-
* [Template View](#template-view)
30+
* [テンプレート・ビュー](#テンプレート・ビュー)
3131
* [Scope](#scope-1)
3232
* [Observer](#observer)
3333
* [Chain of Responsibilities](#chain-of-responsibilities)
@@ -732,20 +732,19 @@ AngularJSのサンプルの式です:
732732
(foo) ? bar : baz | toUpperCase
733733
```
734734

735-
#### Template View
735+
#### テンプレート・ビュー
736736

737-
> Renders information into HTML by embedding markers in an HTML page.
737+
> ページの中にマーカーを埋め込むことにより情報をHTMLにレンダーします。
738738
739739
![Template View](https://rawgit.com/mgechev/angularjs-in-patterns/master/images/template-view.svg "Fig. 8")
740740

741-
The dynamic page rendering is not that trivial thing. It is connected with a lot of string concatenations, manipulations and frustration. Far easier way to build your dynamic page is to write your markup and embed little expressions inside it, which are lately evaluated in given context and so the whole template is being compiled to its end format. In our case this format is going to be HTML (or even DOM). This is exactly what the template engines do - they take given DSL, evaluate it in the appropriate context and then turn it into its end format.
741+
動的なページのレンダリングはそんなに簡単なことではありません。たくさんの文字列の連結や操作やいらいらと結びついています。動的なページを構築するとても簡単な方法はマークアップとちょっとした式をページに書き込んでしまうことです。それはコンテキスト内で評価されテンプレートは最終的な形にコンパイルされます。今回そのフォーマットはHTML(DOM)になります。これはまさにテンプレート・エンジンそのものです - 与えられたDSLを適切なコンテキスト内で評価し、最終的な形に変換します。
742742

743-
Templates are very commonly used especially in the back-end.
744-
For example, you can embed PHP code inside HTML and create a dynamic page, you can use Smarty or you can use eRuby with Ruby in order to embed Ruby code inside your static pages.
743+
テンプレートはバックエンド環境ではよく使われています。例えば、Smartyを使ってPHPコードをHTMLに埋め込んで動的なページを作ることができます。RubyではeRubyを使って静的なページにコードを埋め込むことができます。
745744

746-
For JavaScript there are plenty of template engines, such as mustache.js, handlebars, etc. Most of these engines manipulate the template as a string. The template could be located in different places - as static file, which is fetched with AJAX, as `script` embedded inside your view or even inlined into your JavaScript.
745+
JavaScriptにはmustache.jsやhandlebarsなどたくさんのテンプレートエンジンがあります。これらのエンジンの殆どは文字列としてテンプレートを操作します。テンプレートは別の場所に静的ファイルとして置いてAJAXで取得します。また、 `script` としてビューやJavaScriptの中に埋め込まれます。
747746

748-
For example:
747+
例えばこのように:
749748

750749
```html
751750
<script type="template/mustache">
@@ -756,9 +755,9 @@ For example:
756755
</script>
757756
```
758757

759-
The template engine turns this string into DOM elements by compiling it within a given context. This way all the expressions embedded in the markup are evaluated and replaced by their value.
758+
テンプレートエンジンはコンテキストの中でコンパイルすることにより文字列をDOM要素に変換します。このように全てのマークアップに埋め込まれている全ての式は評価されそれらの値に変換されます。
760759

761-
For example if we evaluate the template above in the context of the following object: `{ names: ['foo', 'bar', 'baz'] }`, so we will get:
760+
例えば、上記のテンプレートを次のオブジェクト・コンテキスト `{ names: ['foo', 'bar', 'baz'] }` の状態で評価するとこのような結果を得ることができます:
762761

763762
```html
764763
<h2>Names</h2>
@@ -767,25 +766,25 @@ For example if we evaluate the template above in the context of the following ob
767766
<strong>baz</strong>
768767
```
769768

770-
AngularJS templates are actually HTML, they are not in an intermediate format like the traditional templates are.
771-
What AngularJS compiler does is to traverse the DOM tree and look for already known directives (elements, attributes, classes or even comments). When AngularJS finds any of these directives it invokes the logic associated with them, which may involve evaluation of different expressions in the context of the current scope.
769+
AngularJSのテンプレートは本物のHTMLです。同等的なテンプレートエンジンがするような中間フォーマットではありません。
772770

773-
For example:
771+
AngularJSコンパイラはDOMツリーを行き来し、既に知っているディレクティブ(要素、アトリビュート、クラス、コメント)を探すことです。AngularJSがこれらのディレクティブを見つけると、それと関連付けられたロジックを実行します。現在のスコープ・コンテキストの中で別の式を評価することもあります。
772+
773+
例えば:
774774

775775
```html
776776
<ul ng-repeat="name in names">
777777
<li>{{name}}</li>
778778
</ul>
779779
```
780780

781-
in the context of the scope:
781+
スコープのコンテキストの中は:
782782

783783
```javascript
784784
$scope.names = ['foo', 'bar', 'baz'];
785785
```
786786

787-
will produce the same result as the one above. The main difference here is that the template is not wrapped inside a `script` tag but is HTML instead.
788-
787+
これは、上記のものと同じ結果を出力します。ここでの主な違いはテンプレートが `script` にラップされていず、HTMLのままであるということです。
789788

790789
### Scope
791790

0 commit comments

Comments
 (0)