fix: 修复合并错误和遗漏的翻译

This commit is contained in:
Zhicheng WANG 2019-02-17 09:47:12 +08:00
parent 73d7c58d5e
commit 5be0566951
5 changed files with 45 additions and 20 deletions

View File

@ -562,6 +562,8 @@ Here are the features which may require additional polyfills:
[Router](guide/router) [Router](guide/router)
when using [hash-based routing](guide/router#appendix-locationstrategy-and-browser-url-styles) when using [hash-based routing](guide/router#appendix-locationstrategy-and-browser-url-styles)
当使用[基于 hash 的路由](guide/router#appendix-locationstrategy-and-browser-url-styles)时。
</td> </td>
<td> <td>

View File

@ -774,6 +774,7 @@ the string of names.
* The function takes a winning `Hero` and a `HeroService` as arguments. * The function takes a winning `Hero` and a `HeroService` as arguments.
这个返回的函数需要一个 `Hero` 和一个 `HeroService` 参数。 这个返回的函数需要一个 `Hero` 和一个 `HeroService` 参数。
Angular supplies these arguments from injected values identified by Angular supplies these arguments from injected values identified by
the two *tokens* in the `deps` array. the two *tokens* in the `deps` array.

View File

@ -481,6 +481,7 @@ Angular 提供了一些以 `ng` 为前缀的内置指令。你也可以创建新
A special-purpose library or API; see [Domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language). A special-purpose library or API; see [Domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language).
一种特殊用途的库或 API参见[领域特定语言](https://en.wikipedia.org/wiki/Domain-specific_language)词条。 一种特殊用途的库或 API参见[领域特定语言](https://en.wikipedia.org/wiki/Domain-specific_language)词条。
Angular extends TypeScript with domain-specific languages for a number of domains relevant to Angular apps, defined in NgModules such as [animations](guide/animations), [forms](guide/forms), and [routing and navigation](guide/router). Angular extends TypeScript with domain-specific languages for a number of domains relevant to Angular apps, defined in NgModules such as [animations](guide/animations), [forms](guide/forms), and [routing and navigation](guide/router).
Angular 使用领域特定语言扩展了 TypeScript用于与 Angular 应用相关的许多领域。这些 DSL 都定义在 NgModule 中,比如 [动画](guide/animations)、[表单](guide/forms)和[路由与导航](guide/router)。 Angular 使用领域特定语言扩展了 TypeScript用于与 Angular 应用相关的许多领域。这些 DSL 都定义在 NgModule 中,比如 [动画](guide/animations)、[表单](guide/forms)和[路由与导航](guide/router)。
@ -784,9 +785,11 @@ A library isn't a complete Angular app and can't run independently.
* Application developers can use the [Angular CLI](guide/glossary#cli) to `add` a published library for use with an application in the same [workspace](guide/glossary#workspace). * Application developers can use the [Angular CLI](guide/glossary#cli) to `add` a published library for use with an application in the same [workspace](guide/glossary#workspace).
应用开发者可以使用 [CLI](guide/glossary#cli) 来把一个已发布的库 `add` 进这个应用所在的[工作空间](guide/glossary#workspace)。
See also [schematic](#schematic). See also [schematic](#schematic).
应用开发者可以使用 [CLI](guide/glossary#cli) 来把一个已发布的库 `add` 进这个应用所在的[工作空间](guide/glossary#workspace)。 参见 [原理图schematic](#schematic)。
{@a lifecycle-hook} {@a lifecycle-hook}
@ -1089,6 +1092,7 @@ A tool that configures and implements navigation among states and [views](guide/
The `Router` module is an [NgModule](guide/glossary#ngmodule) that provides the necessary service providers and directives for navigating through application views. A [routing component](guide/glossary#routing-component) is one that imports the `Router` module and whose template contains a `RouterOutlet` element where it can display views produced by the router. The `Router` module is an [NgModule](guide/glossary#ngmodule) that provides the necessary service providers and directives for navigating through application views. A [routing component](guide/glossary#routing-component) is one that imports the `Router` module and whose template contains a `RouterOutlet` element where it can display views produced by the router.
`Router` 模块是一个 [NgModule](guide/glossary#ngmodule),它提供在应用视图间导航时需要的服务提供商和指令。[路由组件](guide/glossary#routing-component)是一种组件,它导入了 `Router` 模块,并且其模板中包含 `RouterOutlet` 元素,路由器生成的视图就会被显示在那里。 `Router` 模块是一个 [NgModule](guide/glossary#ngmodule),它提供在应用视图间导航时需要的服务提供商和指令。[路由组件](guide/glossary#routing-component)是一种组件,它导入了 `Router` 模块,并且其模板中包含 `RouterOutlet` 元素,路由器生成的视图就会被显示在那里。
The router defines navigation among views on a single page, as opposed to navigation among pages. It interprets URL-like links to determine which views to create or destroy, and which components to load or unload. It allows you to take advantage of [lazy loading](guide/glossary#lazy-load) in your Angular apps. The router defines navigation among views on a single page, as opposed to navigation among pages. It interprets URL-like links to determine which views to create or destroy, and which components to load or unload. It allows you to take advantage of [lazy loading](guide/glossary#lazy-load) in your Angular apps.
路由器定义了在单页面中的各个视图之间导航的方式,而不是在页面之间。它会解释类似 URL 的链接,以决定该创建或销毁哪些视图,以及要加载或卸载哪些组件。它让你可以在 Angular 应用中获得[惰性加载](guide/glossary#lazy-load)的好处。 路由器定义了在单页面中的各个视图之间导航的方式,而不是在页面之间。它会解释类似 URL 的链接,以决定该创建或销毁哪些视图,以及要加载或卸载哪些组件。它让你可以在 Angular 应用中获得[惰性加载](guide/glossary#lazy-load)的好处。
@ -1147,9 +1151,11 @@ Angular [CLI](guide/glossary#cli) 使用原理图来生成和修改 [Angular 项
* [Library](#library) developers can use the [Schematics CLI](#schematics-cli) to create schematics that enable the Angular CLI to add and update their published libraries, and to generate artifacts the library defines. * [Library](#library) developers can use the [Schematics CLI](#schematics-cli) to create schematics that enable the Angular CLI to add and update their published libraries, and to generate artifacts the library defines.
公共库的开发者可以创建原理图,来让 CLI 生成他们自己的发布的库。欲知详情,参见 [devkit 文档](https://www.npmjs.com/package/@angular-devkit/schematics)。
For more information, see [devkit documentation](https://www.npmjs.com/package/@angular-devkit/schematics). For more information, see [devkit documentation](https://www.npmjs.com/package/@angular-devkit/schematics).
公共库的开发者可以创建原理图,来让 CLI 生成他们自己的发布的库。欲知详情,参见 [devkit 文档](https://www.npmjs.com/package/@angular-devkit/schematics)。 欲知详情,参见 [devkit 文档](https://www.npmjs.com/package/@angular-devkit/schematics)。
{@a schematics-cli} {@a schematics-cli}

View File

@ -184,18 +184,29 @@ Notice that all of the files the browser needs to render this application are ca
构建结果JS 和 CSS 包)。 构建结果JS 和 CSS 包)。
* Anything under `assets`. * Anything under `assets`.
`assets` 下的一切。
* Images and fonts directly under the configured `outputPath` (by default `./dist/<project-name>/`) or `resourcesOutputPath`. See [`ng build`](cli/build) for more information about these options. * Images and fonts directly under the configured `outputPath` (by default `./dist/<project-name>/`) or `resourcesOutputPath`. See [`ng build`](cli/build) for more information about these options.
图片和字体直接位于所配置的 `outputPath` (默认为 `./dist/<project-name>/`) 或 `resourcesOutputPath` 下。
关于这些配置的更多信息,请参见 [`ng build`](cli/build) 。
<div class="alert is-helpful"> <div class="alert is-helpful">
Pay attention to two key points: Pay attention to two key points:
注意如下两个关键点:
1. The generated `ngsw-config.json` includes a limited list of cachable fonts and images extentions. In some cases, you might want to modify the glob pattern to suit your needs. 1. The generated `ngsw-config.json` includes a limited list of cachable fonts and images extentions. In some cases, you might want to modify the glob pattern to suit your needs.
所生成的 `ngsw-config.json` 包括一个可缓存字体和图像的有限列表。在某些情况下,你可能要按需修改这些 glob 模式。
1. If `resourcesOutputPath` or `assets` paths are modified after the generation of configuration file, you need to change the paths manually in `ngsw-config.json`. 1. If `resourcesOutputPath` or `assets` paths are modified after the generation of configuration file, you need to change the paths manually in `ngsw-config.json`.
如果在生成了配置文件之后修改了 `resourcesOutputPath``assets` 的路径,那么就要在 `ngsw-config.json` 中手动修改这些路径。
</div> </div>
`assets` 下的所有文件。
### Making changes to your application ### Making changes to your application

View File

@ -68,13 +68,19 @@ Begin with the first form of data binding&mdash;interpolation&mdash;to see how m
## Interpolation and Template Expressions ## Interpolation and Template Expressions
## 插值与模板表达式
Interpolation allows you to incorporate calculated strings into the text Interpolation allows you to incorporate calculated strings into the text
between HTML element tags and within attribute assignments. Template between HTML element tags and within attribute assignments. Template
expressions are what you use to calculate those strings. expressions are what you use to calculate those strings.
插值能让你把计算后的字符串合并到 HTML 元素标签之间和属性赋值语句内的文本中。模板表达式则是用来供你求出这些字符串的。
The interpolation <live-example></live-example> demonstrates all of The interpolation <live-example></live-example> demonstrates all of
the syntax and code snippets described in this section. the syntax and code snippets described in this section.
这个关于插值的<live-example></live-example>演示了本节所讲的全部语法和代码片段。
### Interpolation `{{...}}` ### Interpolation `{{...}}`
### 插值表达式 `{{...}}` ### 插值表达式 `{{...}}`
@ -141,7 +147,7 @@ You appear to be inserting the result between element tags and assigning it to a
However, interpolation is a special syntax that Angular converts into a However, interpolation is a special syntax that Angular converts into a
property binding. property binding.
但是,插值表达式其实是一个特殊语法Angular 会把它转换为属性绑定。 但是插值其实是一个特殊语法Angular 会把它转换为属性绑定。
If you'd like to use something other than `{{` and `}}`, you can If you'd like to use something other than `{{` and `}}`, you can
configure the interpolation delimiter via the configure the interpolation delimiter via the
@ -231,9 +237,7 @@ In the following snippets, the `recommended` within double curly braces and the
An expression may also refer to properties of the _template's_ context An expression may also refer to properties of the _template's_ context
such as a template input variable, such as a template input variable,
<!-- link to built-in-directives#template-input-variables -->
`let customer`, or a template reference variable, `#customerInput`. `let customer`, or a template reference variable, `#customerInput`.
<!-- link to guide/template-ref-variables -->
表达式的上下文可以包括组件之外的对象。 表达式的上下文可以包括组件之外的对象。
比如[模板输入变量](guide/template-syntax#template-input-variable) (`let hero`)和[模板引用变量](guide/template-syntax#ref-vars)(`#heroInput`)就是备选的上下文对象之一。 比如[模板输入变量](guide/template-syntax#template-input-variable) (`let hero`)和[模板引用变量](guide/template-syntax#ref-vars)(`#heroInput`)就是备选的上下文对象之一。
@ -256,13 +260,14 @@ and, lastly, the component's member names.
The previous example presents such a name collision. The component has a `customer` The previous example presents such a name collision. The component has a `customer`
property and the `*ngFor` defines a `customer` template variable. property and the `*ngFor` defines a `customer` template variable.
上一个例子中就体现了这种命名冲突。组件具有一个名叫 `customer` 的属性,而 `*ngFor` 声明了一个也叫 `customer` 的模板变量。
<div class="alert is-helpful"> <div class="alert is-helpful">
The `customer` in `{{customer.name}}` The `customer` in `{{customer.name}}`
refers to the template input variable, not the component's property. refers to the template input variable, not the component's property.
上一个例子中就体现了这种命名冲突。组件具有一个名叫 `hero` 的属性,而 `*ngFor` 声明了一个也叫 `hero` 的模板变量。 `{{customer.name}}` 表达式中的 `customer` 实际引用的是模板变量,而不是组件的属性。
`{{hero.name}}` 表达式中的 `hero` 实际引用的是模板变量,而不是组件的属性。
Template expressions cannot refer to anything in Template expressions cannot refer to anything in
the global namespace, except `undefined`. They can't refer to the global namespace, except `undefined`. They can't refer to
@ -297,7 +302,7 @@ When using template expressions follow these guidelines:
### No visible side effects ### No visible side effects
#### 没有可见的副作用 ### 没有可见的副作用
A template expression should not change any application state other than the value of the A template expression should not change any application state other than the value of the
target property. target property.
@ -497,7 +502,7 @@ Now that you have a feel for template expressions and statements,
you're ready to learn about the varieties of data binding syntax beyond interpolation. you're ready to learn about the varieties of data binding syntax beyond interpolation.
现在,对模板表达式和语句有了一点感觉了吧。 现在,对模板表达式和语句有了一点感觉了吧。
除插值表达式外,还有各种各样的数据绑定语法,是学习它们是时候了。 除插值外,还有各种各样的数据绑定语法,是学习它们是时候了。
<hr/> <hr/>
@ -596,7 +601,7 @@ from the _source-to-view_, from _view-to-source_, and in the two-way sequence: _
Class<br> Class<br>
Style Style
插值表达式<br> 插值<br>
属性<br> 属性<br>
Attribute<br> Attribute<br>
CSS 类<br> CSS 类<br>
@ -683,7 +688,7 @@ from the _source-to-view_, from _view-to-source_, and in the two-way sequence: _
Binding types other than interpolation have a **target name** to the left of the equal sign, Binding types other than interpolation have a **target name** to the left of the equal sign,
either surrounded by punctuation (`[]`, `()`) or preceded by a prefix (`bind-`, `on-`, `bindon-`). either surrounded by punctuation (`[]`, `()`) or preceded by a prefix (`bind-`, `on-`, `bindon-`).
除了插值表达式之外的绑定类型,在等号左边是**目标名** 除了插值之外的绑定类型,在等号左边是**目标名**
无论是包在括号中 (`[]``()`) 还是用前缀形式 (`bind-``on-``bindon-`) 。 无论是包在括号中 (`[]``()`) 还是用前缀形式 (`bind-``on-``bindon-`) 。
The target name is the name of a _property_. It may look like the name of an _attribute_ but it never is. The target name is the name of a _property_. It may look like the name of an _attribute_ but it never is.
@ -1320,12 +1325,12 @@ The `[hero]` binding, on the other hand, remains a live binding to the component
### Property binding or interpolation? ### Property binding or interpolation?
### 属性绑定还是插值表达式 ### 属性绑定还是插值?
You often have a choice between interpolation and property binding. You often have a choice between interpolation and property binding.
The following binding pairs do the same thing: The following binding pairs do the same thing:
你通常得在插值表达式和属性绑定之间做出选择。 你通常得在插值和属性绑定之间做出选择。
下列这几对绑定做的事情完全相同: 下列这几对绑定做的事情完全相同:
<code-example path="template-syntax/src/app/app.component.html" region="property-binding-vs-interpolation" header="src/app/app.component.html" linenums="false"> <code-example path="template-syntax/src/app/app.component.html" region="property-binding-vs-interpolation" header="src/app/app.component.html" linenums="false">
@ -1333,7 +1338,7 @@ The following binding pairs do the same thing:
_Interpolation_ is a convenient alternative to _property binding_ in many cases. _Interpolation_ is a convenient alternative to _property binding_ in many cases.
在多数情况下,插值表达式是更方便的备选项。 在多数情况下,插值是更方便的备选项。
When rendering data values as strings, there is no technical reason to prefer one form to the other. When rendering data values as strings, there is no technical reason to prefer one form to the other.
You lean toward readability, which tends to favor interpolation. You lean toward readability, which tends to favor interpolation.
@ -1341,7 +1346,7 @@ You suggest establishing coding style rules and choosing the form that
both conforms to the rules and feels most natural for the task at hand. both conforms to the rules and feels most natural for the task at hand.
当要渲染的数据类型是字符串时,没有技术上的理由证明哪种形式更好。 当要渲染的数据类型是字符串时,没有技术上的理由证明哪种形式更好。
你倾向于可读性,所以倾向于插值表达式 你倾向于可读性,所以倾向于插值。
建议建立代码风格规则,选择一种形式, 建议建立代码风格规则,选择一种形式,
这样,既遵循了规则,又能让手头的任务做起来更自然。 这样,既遵循了规则,又能让手头的任务做起来更自然。
@ -1367,7 +1372,7 @@ nor property binding.
幸运的是Angular 数据绑定对危险 HTML 有防备。 幸运的是Angular 数据绑定对危险 HTML 有防备。
在显示它们之前,它对内容先进行*消毒*。 在显示它们之前,它对内容先进行*消毒*。
不管是插值表达式还是属性绑定,都**不会**允许带有 script 标签的 HTML 泄漏到浏览器中。 不管是插值还是属性绑定,都**不会**允许带有 script 标签的 HTML 泄漏到浏览器中。
<code-example path="template-syntax/src/app/app.component.html" region="property-binding-vs-interpolation-sanitization" header="src/app/app.component.html" linenums="false"> <code-example path="template-syntax/src/app/app.component.html" region="property-binding-vs-interpolation-sanitization" header="src/app/app.component.html" linenums="false">
</code-example> </code-example>
@ -1375,7 +1380,7 @@ nor property binding.
Interpolation handles the script tags differently than property binding but both approaches render the Interpolation handles the script tags differently than property binding but both approaches render the
content harmlessly. content harmlessly.
插值表达式处理 script 标签与属性绑定有所不同,但是二者都只渲染没有危害的内容。 插值处理 script 标签与属性绑定有所不同,但是二者都只渲染没有危害的内容。
<figure> <figure>
<img src='generated/images/guide/template-syntax/evil-title.png' alt="evil title made safe"> <img src='generated/images/guide/template-syntax/evil-title.png' alt="evil title made safe">
@ -1450,7 +1455,7 @@ It has the "colspan" *attribute*, but
interpolation and property binding can set only *properties*, not attributes. interpolation and property binding can set only *properties*, not attributes.
正如提示中所说,`<td>` 元素没有 `colspan` 属性。 正如提示中所说,`<td>` 元素没有 `colspan` 属性。
但是插值表达式和属性绑定只能设置*属性*,不能设置 attribute。 但是插值和属性绑定只能设置*属性*,不能设置 attribute。
You need attribute bindings to create and bind to such attributes. You need attribute bindings to create and bind to such attributes.
@ -2461,7 +2466,7 @@ Here it is referenced first in an interpolation
and then passed in a binding to the `hero` property of the `<hero-detail>` component. and then passed in a binding to the `hero` property of the `<hero-detail>` component.
你可以在 `ngFor` 的宿主元素(及其子元素)中引用模板输入变量 `hero`,从而访问该英雄的属性。 你可以在 `ngFor` 的宿主元素(及其子元素)中引用模板输入变量 `hero`,从而访问该英雄的属性。
这里的第一个语句示范了如何在一个插值表达式中引用它,第二个语句则示范了如何用一个输入绑定把它传给 `<hero-detail>` 组件的 `hero` 属性。 这里的第一个语句示范了如何在一个插值中引用它,第二个语句则示范了如何用一个输入绑定把它传给 `<hero-detail>` 组件的 `hero` 属性。
<code-example path="template-syntax/src/app/app.component.html" region="NgFor-1-2" header="src/app/app.component.html" linenums="false"> <code-example path="template-syntax/src/app/app.component.html" region="NgFor-1-2" header="src/app/app.component.html" linenums="false">
</code-example> </code-example>