more glossary translation.

This commit is contained in:
Rex 2016-04-14 16:30:46 +01:00
parent 1fe5d7ccf1
commit 5bf1d4f248
1 changed files with 78 additions and 9 deletions

View File

@ -183,7 +183,7 @@ include _util-fns
to a [View](#view) and handling most of the views display to a [View](#view) and handling most of the views display
and user-interaction logic. and user-interaction logic.
组件是一个用来在[视图](#view)中显示数据并处理几乎所有视图显示以及用户交互逻辑的Angular类Angular Class 组件是一个用来展示数据到[视图](#view)并处理几乎所有视图显示以及用户交互逻辑的Angular类Angular Class
The Component is one of the most important building blocks in the Angular system. The Component is one of the most important building blocks in the Angular system.
It is, in fact, an Angular [Directive](#directive) with a companion [Template](#template). It is, in fact, an Angular [Directive](#directive) with a companion [Template](#template).
@ -233,7 +233,7 @@ include _util-fns
Applications display data values to a user and respond to user Applications display data values to a user and respond to user
actions (clicks, touches, keystrokes). actions (clicks, touches, keystrokes).
应用程序一般将数据示给用户,并对用户的操作(点击、触屏、按键)做出回应。 应用程序一般将数据示给用户,并对用户的操作(点击、触屏、按键)做出回应。
We could push application data values into HTML, attach We could push application data values into HTML, attach
event listeners, pull changed values from the screen, and event listeners, pull changed values from the screen, and
@ -289,7 +289,7 @@ include _util-fns
Decorators are a JavaScript language [feature](https://github.com/wycats/javascript-decorators), implemented in TypeScript and proposed for ES2016 (AKA ES7). Decorators are a JavaScript language [feature](https://github.com/wycats/javascript-decorators), implemented in TypeScript and proposed for ES2016 (AKA ES7).
装饰器是一个Javascript的语言[特性](https://github.com/wycats/javascript-decorators)装饰器在TypeScript里面已经采纳并实施了它也被推荐到ES2016也就是ES7 装饰器是一个Javascript的语言[特征](https://github.com/wycats/javascript-decorators)装饰器在TypeScript里面已经采用并实施了它也被推荐到ES2016也就是ES7
We apply a decorator by positioning it We apply a decorator by positioning it
immediately above or to the left of the thing it decorates. immediately above or to the left of the thing it decorates.
@ -460,7 +460,7 @@ include _util-fns
1. [Structural Directives](#structural-directive), a directive responsible for 1. [Structural Directives](#structural-directive), a directive responsible for
shaping or re-shaping HTML layout, typically by adding, removing, or manipulating shaping or re-shaping HTML layout, typically by adding, removing, or manipulating
elements and their children. elements and their children.
[结构型指](#structural-directive)负责塑造或重塑HTML布局。一般都是通过添加、删除或者操作HTML元素和他的子级元素来实现的。 [结构型指](#structural-directive)负责塑造或重塑HTML布局。一般都是通过添加、删除或者操作HTML元素和他的子级元素来实现的。
// #enddocregion d2 // #enddocregion d2
// #docregion e1 // #docregion e1
@ -612,15 +612,22 @@ include _util-fns
[Directives](#directive) and [Components](#component) have a lifecycle [Directives](#directive) and [Components](#component) have a lifecycle
managed by Angular as it creates, updates and destroys them. managed by Angular as it creates, updates and destroys them.
[指令Directives](#directive)和[组件Components](#component)有生命周期由Angular在新建、更新和销毁的过程中管理。 [指令Directives](#directive)和[组件Components](#component)有生命周期由Angular在新建、更新和销毁他们的过程中管理。
Developers can tap into key moments in that lifecycle by implementing Developers can tap into key moments in that lifecycle by implementing
one or more of the "Lifecycle Hook" interfaces. one or more of the "Lifecycle Hook" interfaces.
开发者可以通过实现一个或多个“生命周期钩子”接口,切入到这个生命周期的关键时间点中。
Each interface has a single hook method whose name is the interface name prefixed with `ng`. Each interface has a single hook method whose name is the interface name prefixed with `ng`.
For example, the `OnInit` interface has a hook method names `ngOnInit`. For example, the `OnInit` interface has a hook method names `ngOnInit`.
每个接口有一个唯一的钩子函数方法方法,它的名字一般是接口的名字加前缀 `ng`。比如,`OnInit`接口的钩子函数方法方法名字为 `ngOnInit`。
Angular calls these hook methods in the following order: Angular calls these hook methods in the following order:
Angular会按照下面的顺序调用钩子函数方法
* `ngOnChanges` - called when an [input](#input)/[output](#output) binding values change * `ngOnChanges` - called when an [input](#input)/[output](#output) binding values change
* `ngOnInit` - after the first `ngOnChanges` * `ngOnInit` - after the first `ngOnChanges`
* `ngDoCheck` - developer's custom change detection * `ngDoCheck` - developer's custom change detection
@ -630,7 +637,18 @@ include _util-fns
* `ngAfterViewChecked` - after every check of a component's view(s) * `ngAfterViewChecked` - after every check of a component's view(s)
* `ngOnDestroy` - just before the directive is destroyed. * `ngOnDestroy` - just before the directive is destroyed.
* `ngOnChanges` - 在[输入input](#input)/[输出output](#output)绑定的值变化的时候调用。
* `ngOnInit` - 在第一个`ngOnChanges`后调用。
* `ngDoCheck` - 开发者自定义变化监测器。
* `ngAfterContentInit` - 在组件初始化以后调用。
* `ngAfterContentChecked` - 在检查每个组件内容后调用。
* `ngAfterViewInit` - 在组件试图初始化后调用。
* `ngAfterViewChecked` - 在检查每个组件试图后调用
* `ngOnDestroy` - 在指令销毁前调用。
Learn more in the [Lifecycle Hooks](guide/lifecycle-hooks.html) chapter. Learn more in the [Lifecycle Hooks](guide/lifecycle-hooks.html) chapter.
请看[生命周期钩子Lifecycle Hooks](guide/lifecycle-hooks.html)章节。
// #enddocregion f-l // #enddocregion f-l
// #docregion m1 // #docregion m1
@ -640,38 +658,60 @@ include _util-fns
.l-main-section .l-main-section
:marked :marked
## Module ## Module
## 模块
.l-sub-section .l-sub-section
:marked :marked
Angular apps are modular. Angular apps are modular.
Angular应用程序是模块化的。
In general, we assemble our application from many modules, both the ones we write ourselves In general, we assemble our application from many modules, both the ones we write ourselves
and the ones we acquire from others. and the ones we acquire from others.
一般来说,我们用模块来组装我们的应用程序,这些模块包含我们自己编写的模块和从其他地方获取的模块。
A typical module is a cohesive block of code dedicated to a single purpose. A typical module is a cohesive block of code dedicated to a single purpose.
一个典型的模块,是单一用途的代码块的凝聚。
A module **exports** something of value in that code, typically one thing such as a class. A module **exports** something of value in that code, typically one thing such as a class.
A module that needs that thing, **imports** it. A module that needs that thing, **imports** it.
模块**输出**一些东西,一般都是一个东西:类。
模块如果需要什么东西,那就**导入**它。
The structure of Angular modules and the import/export syntax The structure of Angular modules and the import/export syntax
is based on the [ES2015](#es2015) module standard is based on the [ES2015](#es2015) module standard
described [here](http://www.2ality.com/2014/09/es6-modules-final.html). described [here](http://www.2ality.com/2014/09/es6-modules-final.html).
Angular的模块结构和输出/导入语法是基于[ES2015](#es2015)模块标准上的,请看[这里](http://www.2ality.com/2014/09/es6-modules-final.html).
An application that adheres to this standard requires a module loader to An application that adheres to this standard requires a module loader to
load modules on request and resolve inter-module dependencies. load modules on request and resolve inter-module dependencies.
Angular does not ship with a module loader and does not have a preference Angular does not ship with a module loader and does not have a preference
for any particular 3rd party library (although most samples use SystemJS). for any particular 3rd party library (although most samples use SystemJS).
Application developers may pick any module library that conforms to the standard Application developers may pick any module library that conforms to the standard
采取这个标准的应用程序需要一个模块装载器来按需装载模块并解析模块的依赖关系。Angular不包含任何模块装载器也不推荐任何第三方库(虽然几乎所有例子都使用SystemJs)。
应用程序开发者可以自己选择任何与这个标准兼容的模块装置库。
Modules are typically named after the file in which the exported thing is defined. Modules are typically named after the file in which the exported thing is defined.
The Angular [DatePipe](https://github.com/angular/angular/blob/master/modules/angular2/src/common/pipes/date_pipe.ts) The Angular [DatePipe](https://github.com/angular/angular/blob/master/modules/angular2/src/common/pipes/date_pipe.ts)
class belongs to a feature module named `date_pipe` in the file `date_pipe.ts`. class belongs to a feature module named `date_pipe` in the file `date_pipe.ts`.
模块一般与他输出的东西的所在文件同名。比如, Angular的[日期管道DatePipe](https://github.com/angular/angular/blob/master/modules/angular2/src/common/pipes/date_pipe.ts)类属于名叫`date_pipe`的特性模块,在文件`date_pipe.ts`里。
Developers rarely access Angular feature modules directly. Developers rarely access Angular feature modules directly.
We usually import them from public-facing **library modules** We usually import them from public-facing **library modules**
called [**barrels**](#barrel). Barrels are groups of logically related modules. called [**barrels**](#barrel). Barrels are groups of logically related modules.
The `angular2/core` barrel is a good example. The `angular2/core` barrel is a good example.
开发者很少需要直接访问Angular的特性模块。我们通常从名为[**封装桶**](#barrel)的公共**模块库**里面导入他们。封装通是有逻辑关联的模块的集合。封装通`angular2/core`是一个很好的例子。
Learn more in "[Modules, barrels and bundles](https://github.com/angular/angular/blob/master/modules/angular2/docs/bundles/overview.md)". Learn more in "[Modules, barrels and bundles](https://github.com/angular/angular/blob/master/modules/angular2/docs/bundles/overview.md)".
更多信息请看"[模块、封装桶和捆绑包](https://github.com/angular/angular/blob/master/modules/angular2/docs/bundles/overview.md)".
// #enddocregion m2 // #enddocregion m2
// #docregion n-s // #docregion n-s
@ -683,6 +723,7 @@ include _util-fns
.l-main-section .l-main-section
:marked :marked
## Output ## Output
## 输出
.l-sub-section .l-sub-section
:marked :marked
A directive property that can be the ***target*** of an A directive property that can be the ***target*** of an
@ -690,22 +731,34 @@ include _util-fns
Events stream *out* of this property to the receiver identified Events stream *out* of this property to the receiver identified
in the template expression to the right of the equal sign. in the template expression to the right of the equal sign.
输出Output是一个指令属性它可以一个[事件绑定Event Binding](guide/template-syntax.html#property-binding)的**标靶**。
事件流可以通过指令属性,流到接收者(模板表达式等号的右边就是接收者)
See the [Template Syntax](guide/template-syntax.html#inputs-outputs) chapter. See the [Template Syntax](guide/template-syntax.html#inputs-outputs) chapter.
请看[模板语法Template Syntax](guide/template-syntax.html#inputs-outputs)章节。
.l-main-section .l-main-section
<a id="P"></a> <a id="P"></a>
:marked :marked
## PascalCase ## PascalCase
## 帕斯卡命名法
.l-sub-section .l-sub-section
:marked :marked
The practice of writing compound words or phrases such that each word or abbreviation begins with a capital letter. The practice of writing compound words or phrases such that each word or abbreviation begins with a capital letter.
Class names are typically spelled in PascalCase. Examples include: `Person` and `Customer`. Class names are typically spelled in PascalCase. Examples include: `Person` and `Customer`.
按照每一个单词都是以大写开头的规则的编写复合词或短语的命名方法叫做帕斯卡命名法。类的名字一般都采用帕斯卡命名法。比如`Person`和`Customer`
This form is also known as **upper camel case**, to distinguish it from **lower camel case** which we simply call [camelCase](#camelcase). This form is also known as **upper camel case**, to distinguish it from **lower camel case** which we simply call [camelCase](#camelcase).
In this documentation, "PascalCase" means *upper camel case* and "camelCase" means *lower camel case*. In this documentation, "PascalCase" means *upper camel case* and "camelCase" means *lower camel case*.
这种命名法也被叫做**大驼峰式命名法**,便于与**小驼峰式命名法”或[驼峰式命名法camelCase](#camelCase)。
在本教程中,“帕斯卡命名法”都是指的*大驼峰式命名法”,“驼峰式命名法”指的都是“小驼峰式命名法”
:marked :marked
## Pipe ## Pipe
## 管道
.l-sub-section .l-sub-section
:marked :marked
An Angular pipe is a function that transforms input values to output values for An Angular pipe is a function that transforms input values to output values for
@ -713,16 +766,24 @@ include _util-fns
to associate the pipe function with a name. We then can use that to associate the pipe function with a name. We then can use that
name in our HTML to declaratively transform values on screen. name in our HTML to declaratively transform values on screen.
Angular的管道是一个函数用来把输入值转变为输出值给视图 [view](#view)。我们使用 `#{atSym}Pipe` !{decorator}来把管道函数链接到它的名字上。
然后我们可以在HTML中使用它的名字来用声明的形式在屏幕上把输入值转变输出值。
Here's an example that uses the built-in `currency` pipe to display Here's an example that uses the built-in `currency` pipe to display
a numeric value in the local currency. a numeric value in the local currency.
下面是一个使用内建`货币`管道来把数字值显示为本地货币的例子。
code-example(language="html" escape="html"). code-example(language="html" escape="html").
<label>Price: </label>{{product.price | currency}} <label>Price: </label>{{product.price | currency}}
:marked :marked
Learn more in the chapter on [pipes](guide/pipes.html) . Learn more in the chapter on [pipes](guide/pipes.html) .
到[管道pipes](guide/pipes.html)章节获取更多。
:marked :marked
## Provider ## Provider
## 提供者
.l-sub-section .l-sub-section
:marked :marked
A Provider creates a new instance of a dependency for the Dependency Injection system. A Provider creates a new instance of a dependency for the Dependency Injection system.
@ -739,6 +800,7 @@ include _util-fns
<a id="R"></a> <a id="R"></a>
:marked :marked
## Router ## Router
## 路由器
.l-sub-section .l-sub-section
:marked :marked
Most applications consist of many screens or [views](#view). Most applications consist of many screens or [views](#view).
@ -751,6 +813,7 @@ include _util-fns
of views. of views.
:marked :marked
## Routing Component ## Routing Component
## 路由组件
.l-sub-section .l-sub-section
:marked :marked
A [Component](#component) with an attached router. A [Component](#component) with an attached router.
@ -766,6 +829,7 @@ include _util-fns
.l-main-section .l-main-section
:marked :marked
## Structural Directive ## Structural Directive
## 结构型指令
.l-sub-section .l-sub-section
:marked :marked
A category of [Directive](#directive) that can A category of [Directive](#directive) that can
@ -781,6 +845,7 @@ include _util-fns
.l-main-section .l-main-section
:marked :marked
## Template ## Template
## 模板
.l-sub-section .l-sub-section
:marked :marked
A template is a chunk of HTML that Angular uses to render a [view](#view) with A template is a chunk of HTML that Angular uses to render a [view](#view) with
@ -791,6 +856,7 @@ include _util-fns
:marked :marked
## Template Expression ## Template Expression
## 模板表达式
.l-sub-section .l-sub-section
:marked :marked
An expression in a JavaScript-like syntax that Angular evaluates within An expression in a JavaScript-like syntax that Angular evaluates within
@ -801,6 +867,7 @@ include _util-fns
// #docregion t2 // #docregion t2
:marked :marked
## Transpile ## Transpile
## 编译
.l-sub-section .l-sub-section
:marked :marked
The process of transforming code written in one form of JavaScript The process of transforming code written in one form of JavaScript
@ -833,6 +900,7 @@ include _util-fns
.l-main-section .l-main-section
:marked :marked
## View ## View
## 视图
.l-sub-section .l-sub-section
:marked :marked
A view is a portion of the screen that displays information and responds A view is a portion of the screen that displays information and responds
@ -853,7 +921,8 @@ include _util-fns
<a id="Y"></a> <a id="Y"></a>
<a id="Z"></a> <a id="Z"></a>
:marked :marked
## Zone ## Zones
## 区域
.l-sub-section .l-sub-section
:marked :marked
Zones are a mechanism for encapsulating and intercepting Zones are a mechanism for encapsulating and intercepting