From ac300b3db10d7981d6b57808d35aafc0bb53e313 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Sat, 24 Mar 2018 11:31:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E6=96=B0=E6=94=B6=E9=9B=86?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/tools/translator/dict-latest.json | 12816 +++++++++++++++++------- 1 file changed, 9458 insertions(+), 3358 deletions(-) diff --git a/aio/tools/translator/dict-latest.json b/aio/tools/translator/dict-latest.json index 3666eafc9b..0757e29052 100644 --- a/aio/tools/translator/dict-latest.json +++ b/aio/tools/translator/dict-latest.json @@ -41,12 +41,12 @@ }, { "original": "_Angular_ is the name for the Angular of today and tomorrow.\n_AngularJS_ is the name for all v1.x versions of Angular.", - "translation": "*Angular*这个名字专指现在和未来的Angular版本,而*AngularJS*专指Angular的所有v1.x版本。", + "translation": "*Angular* 这个名字专指现在和未来的 Angular 版本,而 *AngularJS* 专指 Angular 的所有 v1.x 版本。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "This guide helps you transition from AngularJS to Angular\nby mapping AngularJS syntax to the equivalent Angular syntax.", - "translation": "本章提供了一个快速的参考指南,指出一些常用的AngularJS语法及其在Angular中的等价物。", + "translation": "本章提供了一个快速的参考指南,指出一些常用的 AngularJS 语法及其在 Angular 中的等价物。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -61,7 +61,7 @@ }, { "original": "Templates are the user-facing part of an Angular application and are written in HTML.\nThe following table lists some of the key AngularJS template features with their equivalent Angular template syntax.", - "translation": "模板是Angular应用中的门面部分,它是用HTML写的。下表中是一些AngularJS中的关键模板特性及其在Angular中的等价语法。", + "translation": "模板是 Angular 应用中的门面部分,它是用 HTML 写的。下表中是一些 AngularJS 中的关键模板特性及其在 Angular 中的等价语法。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -71,12 +71,12 @@ }, { "original": "In AngularJS, an expression in curly braces denotes one-way binding.\n This binds the value of the element to a property in the controller\n associated with this template.", - "translation": "在AngularJS中,花括号中的表达式代表单向绑定。\n 它把元素的值绑定到了与模板相关控制器的属性上。", + "translation": "在 AngularJS 中,花括号中的表达式代表单向绑定。\n 它把元素的值绑定到了与模板相关控制器的属性上。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "When using the `controller as` syntax,\n the binding is prefixed with the controller alias (`vm` or `$ctrl`) because you\n have to be specific about the source of the binding.", - "translation": "当使用`controller as`语法时,该绑定需要用控制器的别名(`vm`)为前缀,这是因为我们不得不通过它来指定绑定源。", + "translation": "当使用 `controller as` 语法时,该绑定需要用控制器的别名(`vm`)为前缀,这是因为你不得不通过它来指定绑定源。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -86,7 +86,7 @@ }, { "original": "In Angular, a template expression in curly braces still denotes one-way binding.\n This binds the value of the element to a property of the component.\n The context of the binding is implied and is always the\n associated component, so it needs no reference variable.", - "translation": "在Angular中,花括号中的模板表达式同样代表单向绑定。\n 它把元素的值绑定到了组件的属性上。\n 它绑定的上下文变量是隐式的,并且总是关联到组件。\n 所以,它不需要一个引用变量。", + "translation": "在 Angular 中,花括号中的模板表达式同样代表单向绑定。\n 它把元素的值绑定到了组件的属性上。\n 它绑定的上下文变量是隐式的,并且总是关联到组件。\n 所以,它不需要一个引用变量。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -101,12 +101,12 @@ }, { "original": "To filter output in AngularJS templates, use the pipe character (|) and one or more filters.", - "translation": "要在AngularJS中过滤输出,使用管道字符(|)以及一个或多个过滤器。", + "translation": "要在 AngularJS 中过滤输出,使用管道字符(|)以及一个或多个过滤器。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "This example filters the `title` property to uppercase.", - "translation": "这个例子中把`title`属性过滤成了大写形式。", + "translation": "这个例子中把 `title` 属性过滤成了大写形式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -116,7 +116,7 @@ }, { "original": "In Angular you use similar syntax with the pipe (|) character to filter output, but now you call them **pipes**.\n Many (but not all) of the built-in filters from AngularJS are\n built-in pipes in Angular.", - "translation": "在Angular中,我们使用相似的语法 —— 用管道字符(|)来过滤输出,但是现在直接把它叫做**管道**了。\n 很多(但不是所有)AngularJS中的内置过滤器也成了Angular中的内置管道。", + "translation": "在 Angular 中,你使用类似的语法 —— 用管道字符(|)来过滤输出,但是现在直接把它叫做**管道**了。\n 很多(但不是所有)AngularJS 中的内置过滤器也成了 Angular 中的内置管道。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -131,7 +131,7 @@ }, { "original": "Here, `movie` is a user-defined local variable.", - "translation": "这里的`movie`是一个用户定义的局部变量", + "translation": "这里的 `movie` 是一个用户定义的局部变量", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -141,12 +141,12 @@ }, { "original": "Angular has true template input variables that are explicitly defined using the `let` keyword.", - "translation": "Angular 有了真正的模板输入变量,它需要使用`let`关键字进行明确定义。", + "translation": "Angular 有了真正的模板输入变量,它需要使用 `let` 关键字进行明确定义。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For more information, see the [ngFor micro-syntax](guide/template-syntax#microsyntax)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,请参见[模板语法](guide/template-syntax)中的[ngFor微语法](guide/template-syntax#microsyntax)部分。", + "translation": "要了解更多信息,请参见[模板语法](guide/template-syntax)中的[ngFor 微语法](guide/template-syntax#microsyntax)部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -156,7 +156,7 @@ }, { "original": "AngularJS provides more than seventy built-in directives for templates.\nMany of them aren't needed in Angular because of its more capable and expressive binding system.\nThe following are some of the key AngularJS built-in directives and their equivalents in Angular.", - "translation": "AngularJS 为模板提供了七十多个内置指令。\n在 Angular 中,它们很多都已经不需要了,因为 Angular 有了一个更加强大、快捷的绑定系统。\n下面是一些AngularJS 中的关键指令及其在 Angular 中的等价物。", + "translation": "AngularJS 为模板提供了七十多个内置指令。\n在 Angular 中,它们很多都已经不需要了,因为 Angular 有了一个更加强大、快捷的绑定系统。\n下面是一些 AngularJS 中的关键指令及其在 Angular 中的等价物。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -166,7 +166,7 @@ }, { "original": "Although you can bootstrap an AngularJS app in code,\n many applications bootstrap declaratively with the `ng-app` directive,\n giving it the name of the application's module (`movieHunter`).", - "translation": "虽然可以从代码中引导Angular应用,\n 但很多应用都是通过`ng-app`指令进行声明式引导的,只要给它一个应用模块的名字(`movieHunter`)就可以了。", + "translation": "虽然可以从代码中引导 Angular 应用,\n 但很多应用都是通过 `ng-app` 指令进行声明式引导的,只要给它一个应用模块的名字(`movieHunter`)就可以了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -176,17 +176,17 @@ }, { "original": "Angular doesn't have a bootstrap directive.\n To launch the app in code, explicitly bootstrap the application's root module (`AppModule`)\n in `main.ts`\n and the application's root component (`AppComponent`) in `app.module.ts`.", - "translation": "Angular 没有引导指令。\n 总是要通过显式调用一个`bootstrap`函数,并传入应用模块的名字(`AppComponent`)来启动应用。", + "translation": "Angular 没有引导指令。\n 总是要通过显式调用一个 `bootstrap` 函数,并传入应用模块的名字(`AppComponent`)来启动应用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-class` directive includes/excludes CSS classes\n based on an expression. That expression is often a key-value control object with each\n key of the object defined as a CSS class name, and each value defined as a template expression\n that evaluates to a Boolean value.", - "translation": "在AngularJS中,`ng-class`指令会基于一个表达式来包含/排除某些CSS类。该表达式通常是一个“键-值”型的控制对象,\n 对象中的每一个键代表一个CSS类名,每一个值定义为一个返回布尔值的模板表达式。", + "translation": "在 AngularJS 中,`ng-class` 指令会基于一个表达式来包含/排除某些 CSS 类。该表达式通常是一个“键-值”型的控制对象,\n 对象中的每一个键代表一个 CSS 类名,每一个值定义为一个返回布尔值的模板表达式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In the first example, the `active` class is applied to the element if `isActive` is true.", - "translation": "在第一个例子中,如果`isActive`为真,则`active`类被应用到那个元素上。", + "translation": "在第一个例子中,如果 `isActive` 为真,则 `active` 类被应用到那个元素上。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -196,12 +196,12 @@ }, { "original": "In Angular, the `ngClass` directive works similarly.\n It includes/excludes CSS classes based on an expression.", - "translation": "在Angular中,`ngClass`指令用类似的方式工作。\n 它根据一个表达式包含/排除某些CSS类。", + "translation": "在 Angular 中,`ngClass` 指令用类似的方式工作。\n 它根据一个表达式包含/排除某些 CSS 类。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In the first example, the `active` class is applied to the element if `isActive` is true.", - "translation": "在第一个例子中,如果`isActive`为真,则`active`类被应用到那个元素上。", + "translation": "在第一个例子中,如果 `isActive` 为真,则 `active` 类被应用到那个元素上。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -211,57 +211,57 @@ }, { "original": "Angular also has **class binding**, which is a good way to add or remove a single class,\n as shown in the third example.", - "translation": "Angular还有**类绑定**,它是单独添加或移除一个类的好办法 —— 就像第三个例子中展示的。", + "translation": "Angular 还有**类绑定**,它是单独添加或移除一个类的好办法 —— 就像第三个例子中展示的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For more information see the [Attribute, class, and style bindings](guide/template-syntax#other-bindings)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,参见[模板语法](guide/template-syntax)中的[属性、CSS类和样式绑定](guide/template-syntax#other-bindings)部分。", + "translation": "要了解更多信息,参见[模板语法](guide/template-syntax)中的[属性、CSS 类和样式绑定](guide/template-syntax#other-bindings)部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-click` directive allows you to specify custom behavior when an element is clicked.", - "translation": "在AngularJS中,`ng-click`指令指定当元素被点击时的自定义行为。", + "translation": "在 AngularJS 中,`ng-click` 指令指定当元素被点击时的自定义行为。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In the first example, when the user clicks the button, the `toggleImage()` method in the controller referenced by the `vm` `controller as` alias is executed.", - "translation": "在第一个例子中,如果用户点击了这个按钮,那么控制器的`toggleImage()`方法就会被执行,这个控制器是被`controller as`中指定的`vm`别名所引用的。", + "translation": "在第一个例子中,如果用户点击了这个按钮,那么控制器的 `toggleImage()` 方法就会被执行,这个控制器是被 `controller as` 中指定的 `vm` 别名所引用的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The second example demonstrates passing in the `$event` object, which provides details about the event\n to the controller.", - "translation": "第二个例子演示了传入`$event`对象,它提供了事件的详情,并被传到控制器。", + "translation": "第二个例子演示了传入 `$event` 对象,它提供了事件的详情,并被传到控制器。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "### Bind to the `click` event", - "translation": "### 绑定到`click`事件", + "translation": "### 绑定到 `click` 事件", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "AngularJS event-based directives do not exist in Angular.\n Rather, define one-way binding from the template view to the component using **event binding**.", - "translation": "AngularJS基于事件的指令在Angular中已经不存在了。\n 不过,可以使用**事件绑定**来定义从模板视图到组件的单向数据绑定。", + "translation": "AngularJS 基于事件的指令在 Angular 中已经不存在了。\n 不过,可以使用**事件绑定**来定义从模板视图到组件的单向数据绑定。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For event binding, define the name of the target event within parenthesis and\n specify a template statement, in quotes, to the right of the equals. Angular then\n sets up an event handler for the target event. When the event is raised, the handler\n executes the template statement.", - "translation": "要使用事件绑定,把目标事件的名字放在圆括号中,并且使用等号右侧引号中的模板语句对它赋值。\n 然后Angular为这个目标时间设置事件处理器。当事件被触发时,这个处理器就会执行模板语句。", + "translation": "要使用事件绑定,把目标事件的名字放在圆括号中,并且使用等号右侧引号中的模板语句对它赋值。\n 然后 Angular 为这个目标时间设置事件处理器。当事件被触发时,这个处理器就会执行模板语句。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In the first example, when a user clicks the button, the `toggleImage()` method in the associated component is executed.", - "translation": "在第一个例子中,当用户点击此按钮时,相关组件中的`toggleImage()`方法就被执行了。", + "translation": "在第一个例子中,当用户点击此按钮时,相关组件中的 `toggleImage()` 方法就被执行了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The second example demonstrates passing in the `$event` object, which provides details about the event\n to the component.", - "translation": "第二个例子演示了如何传入`$event`对象,它为组件提供了此事件的详情。", + "translation": "第二个例子演示了如何传入 `$event` 对象,它为组件提供了此事件的详情。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For a list of DOM events, see: https://developer.mozilla.org/en-US/docs/Web/Events.", - "translation": "要查看DOM事件的列表,请参见[网络事件](https://developer.mozilla.org/en-US/docs/Web/Events)。", + "translation": "要查看 DOM 事件的列表,请参见[网络事件](https://developer.mozilla.org/en-US/docs/Web/Events)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -271,7 +271,7 @@ }, { "original": "In AngularJS, the `ng-controller` directive attaches a controller to the view.\n Using the `ng-controller` (or defining the controller as part of the routing) ties the\n view to the controller code associated with that view.", - "translation": "在AngularJS中,`ng-controller`指令把控制器附加到视图上。\n 使用`ng-controller`(或把控制器定义为路由的一部分)把视图及其控制器的代码联系在一起。", + "translation": "在 AngularJS 中,`ng-controller` 指令把控制器附加到视图上。\n 使用 `ng-controller`(或把控制器定义为路由的一部分)把视图及其控制器的代码联系在一起。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -281,7 +281,7 @@ }, { "original": "In Angular, the template no longer specifies its associated controller.\n Rather, the component specifies its associated template as part of the component class decorator.", - "translation": "在Angular中,模板不用再指定它相关的控制器。\n 反过来,组件会在组件类的装饰器中指定与它相关的模板。", + "translation": "在 Angular 中,模板不用再指定它相关的控制器。\n 反过来,组件会在组件类的装饰器中指定与它相关的模板。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -291,42 +291,42 @@ }, { "original": "In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).", - "translation": "在AngularJS中,`ng-hide`指令会基于一个表达式显示或隐藏相关的HTML元素。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。", + "translation": "在 AngularJS 中,`ng-hide` 指令会基于一个表达式显示或隐藏相关的 HTML 元素。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "### Bind to the `hidden` property", - "translation": "### 绑定到`hidden`属性", + "translation": "### 绑定到 `hidden` 属性", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In Angular, you use property binding; there is no built-in *hide* directive.\n For more information, see [ng-show](guide/ajs-quick-reference#ng-show).", - "translation": "在Angular中,并没有一个内置的*hide*指令,可以改用属性绑定。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。", + "translation": "在 Angular 中,并没有一个内置的 *hide* 指令,可以改用属性绑定。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The `ng-href` directive allows AngularJS to preprocess the `href` property so that it\n can replace the binding expression with the appropriate URL before the browser\n fetches from that URL.", - "translation": "`ng-href`指令允许AngularJS对`href`属性进行预处理,以便它能在浏览器获取那个URL之前,使用一个返回适当URL的绑定表达式替换它。", + "translation": "`ng-href` 指令允许 AngularJS 对 `href` 属性进行预处理,以便它能在浏览器获取那个 URL 之前,使用一个返回适当 URL 的绑定表达式替换它。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-href` is often used to activate a route as part of navigation.", - "translation": "在AngularJS 中,`ng-href`通常用来作为导航的一部分,激活一个路由。", + "translation": "在 AngularJS 中,`ng-href` 通常用来作为导航的一部分,激活一个路由。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Routing is handled differently in Angular.", - "translation": "路由在Angular中的处理方式不同。", + "translation": "路由在 Angular 中的处理方式不同。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "### Bind to the `href` property", - "translation": "### 绑定到`href`属性", + "translation": "### 绑定到 `href` 属性", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Angular uses property binding; there is no built-in *href* directive.\n Place the element's `href` property in square brackets and set it to a quoted template expression.", - "translation": "在Angular中,并没有内置的*href*指令,改用属性绑定。\n 我们把元素的`href`属性放在方括号中,并把它设成一个引号中的模板表达式。", + "translation": "在 Angular 中,并没有内置的 *href* 指令,改用属性绑定。\n 把元素的 `href` 属性放在方括号中,并把它设成一个引号中的模板表达式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -336,72 +336,72 @@ }, { "original": "In Angular, `href` is no longer used for routing. Routing uses `routerLink`, as shown in the following example.", - "translation": "在Angular中,`href`不再用作路由,而是改用第三个例子中所展示的`routerLink`指令。", + "translation": "在 Angular 中,`href` 不再用作路由,而是改用第三个例子中所展示的 `routerLink` 指令。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For more information on routing, see the [RouterLink binding](guide/router#router-link)\n section of the [Routing & Navigation](guide/router) page.", - "translation": "要了解关于路由的更多信息,请参见[路由与导航](guide/router)的[RouterLink绑定](guide/router#router-link)部分。", + "translation": "要了解关于路由的更多信息,请参见[路由与导航](guide/router)的[RouterLink 绑定](guide/router#router-link)部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-if` directive removes or recreates a portion of the DOM,\n based on an expression. If the expression is false, the element is removed from the DOM.", - "translation": "在AngularJS中,`ng-if`指令会根据一个表达式来移除或重建DOM中的一部分。如果表达式为假,元素就会被从DOM中移除。", + "translation": "在 AngularJS 中,`ng-if` 指令会根据一个表达式来移除或重建 DOM 中的一部分。如果表达式为假,元素就会被从 DOM 中移除。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, the `` element is removed from the DOM unless the `movies` array has a length greater than zero.", - "translation": "在这个例子中,除非`movies`数组的长度大于0,否则`
`元素就会被从DOM中移除。", + "translation": "在这个例子中,除非 `movies` 数组的长度大于 0,否则 `
` 元素就会被从 DOM 中移除。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The `*ngIf` directive in Angular works the same as the `ng-if` directive in AngularJS. It removes\n or recreates a portion of the DOM based on an expression.", - "translation": "Angular中的`*ngIf`指令与AngularJS中的`ng-if`指令一样,\n 它根据表达式的值移除或重建DOM中的一部分。", + "translation": "Angular 中的 `*ngIf` 指令与 AngularJS 中的 `ng-if` 指令一样,\n 它根据表达式的值移除或重建 DOM 中的一部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, the `
` element is removed from the DOM unless the `movies` array has a length.", - "translation": "在这个例子中,除非`movies`数组的长度大于0,否则`
`元素就会被从DOM中移除。", + "translation": "在这个例子中,除非 `movies` 数组的长度大于 0,否则 `
` 元素就会被从 DOM 中移除。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The (*) before `ngIf` is required in this example.\n For more information, see [Structural Directives](guide/structural-directives).", - "translation": "在这个例子中`ngIf`前的星号(*)是必须的。\n 要了解更多信息,参见[结构型指令](guide/structural-directives)。", + "translation": "在这个例子中 `ngIf` 前的星号(*)是必须的。\n 要了解更多信息,参见[结构型指令](guide/structural-directives)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-model` directive binds a form control to a property in the controller associated with the template.\n This provides **two-way binding**, whereby any change made to the value in the view is synchronized with the model, and any change to the model is synchronized with the value in the view.", - "translation": "在Angular1中,`ng-model`指令把一个表单控件绑定到了模板相关控制器的一个属性上。\n 这提供了**双向绑定**功能,因此,任何对视图中值的改动,都会同步到模型中,对模型的改动,也会同步到视图中。", + "translation": "在 Angular1 中,`ng-model` 指令把一个表单控件绑定到了模板相关控制器的一个属性上。\n 这提供了**双向绑定**功能,因此,任何对视图中值的改动,都会同步到模型中,对模型的改动,也会同步到视图中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In Angular, **two-way binding** is denoted by `[()]`, descriptively referred to as a \"banana in a box\". This syntax is a shortcut for defining both property binding (from the component to the view)\n and event binding (from the view to the component), thereby providing two-way binding.", - "translation": "在Angular中,**双向绑定**使用[()]标记出来,它被形象的比作“盒子中的香蕉”。\n 这种语法是一个简写形式,用来同时定义一个属性绑定(从组件到视图)和一个事件绑定(从视图到组件),因此,我们得到了双向绑定。", + "translation": "在 Angular 中,**双向绑定**使用[()]标记出来,它被形象的比作“盒子中的香蕉”。\n 这种语法是一个简写形式,用来同时定义一个属性绑定(从组件到视图)和一个事件绑定(从视图到组件),就成了双向绑定。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For more information on two-way binding with `ngModel`, see the [NgModel—Two-way binding to\n form elements with `[(ngModel)]`](../guide/template-syntax.html#ngModel)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解使用ngModel进行双向绑定的更多知识,参见[模板语法](guide/template-syntax)中的[NgModel—使用`[(ngModel)]`进行双向绑定](../guide/template-syntax.html#ngModel)部分。", + "translation": "要了解使用 ngModel 进行双向绑定的更多知识,参见[模板语法](guide/template-syntax)中的[NgModel—使用 `[(ngModel)]` 进行双向绑定](../guide/template-syntax.html#ngModel)部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-repeat` directive repeats the associated DOM element\n for each item in the specified collection.", - "translation": "在Angular1中,`ng-repeat`指令会为指定集合中的每一个条目重复渲染相关的DOM元素。", + "translation": "在 Angular1 中,`ng-repeat` 指令会为指定集合中的每一个条目重复渲染相关的 DOM 元素。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, the table row (``) element repeats for each movie object in the collection of movies.", - "translation": "在这个例子中,对`movies`集合中的每一个`movie`对象重复渲染了这个表格行元素(``)。", + "translation": "在这个例子中,对 `movies` 集合中的每一个 `movie` 对象重复渲染了这个表格行元素(``)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The `*ngFor` directive in Angular is similar to the `ng-repeat` directive in AngularJS. It repeats\n the associated DOM element for each item in the specified collection.\n More accurately, it turns the defined element (`` in this example) and its contents into a template and\n uses that template to instantiate a view for each item in the list.", - "translation": "Angular中的`*ngFor`指令类似于AngularJS中的`ng-repeat`指令。\n 它为指定集合中的每一个条目重复渲染了相关的DOM元素。\n 更准确的说,它把被界定出来的元素(这个例子中是``)及其内容转成了一个模板,并使用那个模板来为列表中的每一个条目实例化一个视图。", + "translation": "Angular 中的 `*ngFor` 指令类似于 AngularJS 中的 `ng-repeat` 指令。\n 它为指定集合中的每一个条目重复渲染了相关的 DOM 元素。\n 更准确的说,它把被界定出来的元素(这个例子中是 ``)及其内容转成了一个模板,并使用那个模板来为列表中的每一个条目实例化一个视图。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Notice the other syntax differences:\n The (*) before `ngFor` is required;\n the `let` keyword identifies `movie` as an input variable;\n the list preposition is `of`, not `in`.", - "translation": "请注意其它语法上的差异:\n 在`ngFor`前面的星号(*)是必须的;`let`关键字把`movie`标记成一个输入变量;列表中使用的介词是`of`,而不再是`in`。", + "translation": "请注意其它语法上的差异:\n 在 `ngFor` 前面的星号(*)是必须的;`let` 关键字把 `movie` 标记成一个输入变量;列表中使用的介词是 `of`,而不再是 `in`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -411,32 +411,32 @@ }, { "original": "In AngularJS, the `ng-show` directive shows or hides the associated DOM element, based on\n an expression.", - "translation": "在AngularJS中,`ng-show`指令根据一个表达式来显示或隐藏相关的DOM元素。", + "translation": "在 AngularJS 中,`ng-show` 指令根据一个表达式来显示或隐藏相关的 DOM 元素。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, the `
` element is shown if the `favoriteHero` variable is truthy.", - "translation": "在这个例子中,如果`favoriteHero`变量为真,`
`元素就会显示出来。", + "translation": "在这个例子中,如果 `favoriteHero` 变量为真,`
` 元素就会显示出来。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "### Bind to the `hidden` property", - "translation": "### 绑定到`hidden`属性", + "translation": "### 绑定到 `hidden` 属性", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Angular uses property binding; there is no built-in *show* directive.\n For hiding and showing elements, bind to the HTML `hidden` property.", - "translation": "在Angular中,并没有内置的*show*指令,可以改用属性绑定。\n 要隐藏或显示一个元素,绑定到它的`hidden`属性就可以了。", + "translation": "在 Angular 中,并没有内置的 *show* 指令,可以改用属性绑定。\n 要隐藏或显示一个元素,绑定到它的 `hidden` 属性就可以了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "To conditionally display an element, place the element's `hidden` property in square brackets and\n set it to a quoted template expression that evaluates to the *opposite* of *show*.", - "translation": "要想有条件的显示一个元素,就把该元素的`hidden`属性放到一个方括号里,并且把它设置为引号中的模板表达式,它的结果应该是与*显示*时*相反*的值。", + "translation": "要想有条件的显示一个元素,就把该元素的 `hidden` 属性放到一个方括号里,并且把它设置为引号中的模板表达式,它的结果应该是与*显示*时*相反*的值。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, the `
` element is hidden if the `favoriteHero` variable is not truthy.", - "translation": "在这个例子中,如果`favoriteHero`变量不是真值,`
`元素就会被隐藏。", + "translation": "在这个例子中,如果 `favoriteHero` 变量不是真值,`
` 元素就会被隐藏。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -446,17 +446,17 @@ }, { "original": "The `ng-src` directive allows AngularJS to preprocess the `src` property so that it\n can replace the binding expression with the appropriate URL before the browser\n fetches from that URL.", - "translation": "`ng-src`指令允许AngularJS对`src`属性进行预处理,以便它能够在浏览器获取此URL之前,用一个返回适当URL的绑定表达式替换它。", + "translation": "`ng-src` 指令允许 AngularJS 对 `src` 属性进行预处理,以便它能够在浏览器获取此 URL 之前,用一个返回适当 URL 的绑定表达式替换它。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "### Bind to the `src` property", - "translation": "### 绑定到`src`属性", + "translation": "### 绑定到 `src` 属性", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Angular uses property binding; there is no built-in *src* directive.\n Place the `src` property in square brackets and set it to a quoted template expression.", - "translation": "在Angular中,并没有一个内置的*src*指令,可以使用属性绑定。\n 把`src`属性放到方括号中,并且把它设为一个引号中的绑定表达式。", + "translation": "在 Angular 中,并没有一个内置的 *src* 指令,可以使用属性绑定。\n 把 `src` 属性放到方括号中,并且把它设为一个引号中的绑定表达式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -466,27 +466,27 @@ }, { "original": "In AngularJS, the `ng-style` directive sets a CSS style on an HTML element\n based on an expression. That expression is often a key-value control object with each\n key of the object defined as a CSS property, and each value defined as an expression\n that evaluates to a value appropriate for the style.", - "translation": "在AngularJS中,`ng-style`指令根据一个绑定表达式设置一个HTML元素的CSS样式。\n 该表达式通常是一个“键-值”形式的控制对象,对象的每个键都是一个CSS属性,每个值都是一个能计算为此样式的合适值的表达式。", + "translation": "在 AngularJS 中,`ng-style` 指令根据一个绑定表达式设置一个 HTML 元素的 CSS 样式。\n 该表达式通常是一个“键-值”形式的控制对象,对象的每个键都是一个 CSS 属性,每个值都是一个能计算为此样式的合适值的表达式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In the example, the `color` style is set to the current value of the `colorPreference` variable.", - "translation": "在这个例子中,`color`样式被设置为`colorPreference`变量的当前值。", + "translation": "在这个例子中,`color` 样式被设置为 `colorPreference` 变量的当前值。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In Angular, the `ngStyle` directive works similarly. It sets a CSS style on an HTML element based on an expression.", - "translation": "在Angular中,`ngStyle`指令的工作方式与此类似。它根据一个表达式设置HTML元素上的CSS样式。", + "translation": "在 Angular 中,`ngStyle` 指令的工作方式与此类似。它根据一个表达式设置 HTML 元素上的 CSS 样式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In the first example, the `color` style is set to the current value of the `colorPreference` variable.", - "translation": "在第一个例子中,`color`样式被设置成了`colorPreference`变量的当前值。", + "translation": "在第一个例子中,`color` 样式被设置成了 `colorPreference` 变量的当前值。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Angular also has **style binding**, which is good way to set a single style. This is shown in the second example.", - "translation": "Angular还有**样式绑定**语法,它是单独设置一个样式的好方法。它展示在第二个例子中。", + "translation": "Angular 还有**样式绑定**语法,它是单独设置一个样式的好方法。它展示在第二个例子中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -496,37 +496,37 @@ }, { "original": "For more information on the `ngStyle` directive, see [NgStyle](guide/template-syntax#ngStyle)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解关于`ngStyle`指令的更多知识,参见[模板语法](guide/template-syntax)中的[NgStyle](guide/template-syntax#ngStyle)部分。", + "translation": "要了解关于 `ngStyle` 指令的更多知识,参见[模板语法](guide/template-syntax)中的[NgStyle](guide/template-syntax#ngStyle)部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, the `ng-switch` directive swaps the contents of\n an element by selecting one of the templates based on the current value of an expression.", - "translation": "在Angular1中,`ng-switch`指令根据一个表达式的当前值把元素的内容替换成几个模板之一。", + "translation": "在 Angular1 中,`ng-switch` 指令根据一个表达式的当前值把元素的内容替换成几个模板之一。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, if `favoriteHero` is not set, the template displays \"Please enter ...\".\n If `favoriteHero` is set, it checks the movie hero by calling a controller method.\n If that method returns `true`, the template displays \"Excellent choice!\".\n If that methods returns `false`, the template displays \"No movie, sorry!\".", - "translation": "在这个例子中,如果`favoriteHero`没有设置,则模板显示“Please enter ...”。\n 如果`favoriteHero`设置过,它就会通过调用一个控制其方法来检查它是否电影里的英雄。\n 如果该方法返回`true`,模板就会显示“Excellent choice!”。\n 如果该方法返回`false`,该模板就会显示“No movie, sorry!”。", + "translation": "在这个例子中,如果 `favoriteHero` 没有设置,则模板显示“Please enter ...”。\n 如果 `favoriteHero` 设置过,它就会通过调用一个控制其方法来检查它是否电影里的英雄。\n 如果该方法返回 `true`,模板就会显示“Excellent choice!”。\n 如果该方法返回 `false`,该模板就会显示“No movie, sorry!”。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In Angular, the `ngSwitch` directive works similarly.\n It displays an element whose `*ngSwitchCase` matches the current `ngSwitch` expression value.", - "translation": "在Angular中,`ngSwitch`指令的工作方式与此类似。\n 它会显示那个与`ngSwitch`表达式的当前值匹配的那个`*ngSwitchCase`所在的元素。", + "translation": "在 Angular 中,`ngSwitch` 指令的工作方式与此类似。\n 它会显示那个与 `ngSwitch` 表达式的当前值匹配的那个 `*ngSwitchCase` 所在的元素。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In this example, if `favoriteHero` is not set, the `ngSwitch` value is `null`\n and `*ngSwitchDefault` displays, \"Please enter ...\".\n If `favoriteHero` is set, the app checks the movie hero by calling a component method.\n If that method returns `true`, the app selects `*ngSwitchCase=\"true\"` and displays: \"Excellent choice!\"\n If that methods returns `false`, the app selects `*ngSwitchCase=\"false\"` and displays: \"No movie, sorry!\"", - "translation": "在这个例子中,如果`favoriteHero`没有设置,则`ngSwitch`的值是`null`,我们会看到\n `*ngSwitchDefault`中的段落“Please enter ...”。\n 如果`favoriteHero`被设置了,它就会通过调用一个组件方法来检查电影英雄。\n 如果该方法返回`true`,我们就会看到“Excellent choice!”。\n 如果该方法返回`false`,我们就会看到“No movie, sorry!”。", + "translation": "在这个例子中,如果 `favoriteHero` 没有设置,则 `ngSwitch` 的值是 `null`,\n `*ngSwitchDefault` 中会显示 “Please enter ...”。\n 如果设置了 `favoriteHero`,应用就会通过调用一个组件方法来检查电影英雄。\n 如果该方法返回 `true`,就会显示 “Excellent choice!”。\n 如果该方法返回 `false`,就会显示 “No movie, sorry!”。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The (*) before `ngSwitchCase` and `ngSwitchDefault` is required in this example.", - "translation": "在这个例子中,`ngSwitchCase`和`ngSwitchDefault`前面的星号(*)是必须的。", + "translation": "在这个例子中,`ngSwitchCase` 和 `ngSwitchDefault` 前面的星号(*)是必须的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "For more information, see [The NgSwitch directives](guide/template-syntax#ngSwitch)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,参见[模板语法](guide/template-syntax)中的[NgSwitch指令](guide/template-syntax#ngSwitch)部分。", + "translation": "要了解更多信息,参见[模板语法](guide/template-syntax)中的[NgSwitch 指令](guide/template-syntax#ngSwitch)部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -536,7 +536,7 @@ }, { "original": "Angular **pipes** provide formatting and transformation for data in the template, similar to AngularJS **filters**.\nMany of the built-in filters in AngularJS have corresponding pipes in Angular.\nFor more information on pipes, see [Pipes](guide/pipes).", - "translation": "Angular中的**管道**为模板提供了格式化和数据转换功能,类似于AngularJS中的**过滤器**。\nAngularJS中的很多内置过滤器在Angular中都有对应的管道。\n要了解管道的更多信息,参见[Pipes](guide/pipes)。", + "translation": "Angular 中的**管道**为模板提供了格式化和数据转换功能,类似于 AngularJS 中的**过滤器**。\nAngularJS 中的很多内置过滤器在 Angular 中都有对应的管道。\n要了解管道的更多信息,参见[Pipes](guide/pipes)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -546,7 +546,7 @@ }, { "original": "The Angular `currency` pipe is similar although some of the parameters have changed.", - "translation": "Angular的`currency`管道和1中很相似,只是有些参数变化了。", + "translation": "Angular 的 `currency` 管道和 1 中很相似,只是有些参数变化了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -556,7 +556,7 @@ }, { "original": "The Angular `date` pipe is similar.", - "translation": "Angular的`date`管道和它很相似。", + "translation": "Angular 的 `date` 管道和它很相似。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -571,17 +571,17 @@ }, { "original": "For performance reasons, no comparable pipe exists in Angular. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.", - "translation": "在Angular中,出于性能的考虑,并没有一个类似的管道。\n 过滤逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", + "translation": "在 Angular 中,出于性能的考虑,并没有一个类似的管道。\n 过滤逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Converts a JavaScript object into a JSON string. This is useful for debugging.", - "translation": "把一个JavaScript对象转换成一个JSON字符串。这对调试很有用。", + "translation": "把一个 JavaScript 对象转换成一个 JSON 字符串。这对调试很有用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "The Angular `json` pipe does the same thing.", - "translation": "Angular的`json`管道做完全相同的事。", + "translation": "Angular 的 `json` 管道做完全相同的事。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -591,7 +591,7 @@ }, { "original": "The `SlicePipe` does the same thing but the *order of the parameters is reversed*, in keeping\n with the JavaScript `Slice` method.\n The first parameter is the starting index; the second is the limit.\n As in AngularJS, coding this operation within the component instead could improve performance.", - "translation": "`SlicePipe`做同样的事,但是*两个参数的顺序是相反的*,以便于JavaScript中的`slice`方法保持一致。\n 第一个参数是起始索引号,第二个参数是限制的数量。\n 和AngularJS中一样,如果们改用组件中的代码实现此操作,性能将会提升。", + "translation": "`SlicePipe` 做同样的事,但是*两个参数的顺序是相反的*,以便于 JavaScript 中的 `slice` 方法保持一致。\n 第一个参数是起始索引号,第二个参数是限制的数量。\n 和 AngularJS 中一样,如果们改用组件中的代码实现此操作,性能将会提升。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -601,7 +601,7 @@ }, { "original": "The Angular `lowercase` pipe does the same thing.", - "translation": "Angular的`lowercase`管道和1中的功能完全相同。", + "translation": "Angular 的 `lowercase` 管道和 1 中的功能完全相同。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -611,17 +611,17 @@ }, { "original": "The Angular `number` pipe is similar.\n It provides more functionality when defining\n the decimal places, as shown in the second example above.", - "translation": "Angular的`number`管道很相似。\n 但在指定小数点位置时,它提供了更多的功能,如第二个范例所示。", + "translation": "Angular 的 `number` 管道很相似。\n 但在指定小数点位置时,它提供了更多的功能,如第二个范例所示。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Angular also has a `percent` pipe, which formats a number as a local percentage\n as shown in the third example.", - "translation": "Angular还有一个`percent`管道,它把一个数组格式化为本地化的(local)百分比格式,如第三个范例所示。", + "translation": "Angular 还有一个 `percent` 管道,它把一个数组格式化为本地化的(local)百分比格式,如第三个范例所示。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Displays the collection in the order specified by the expression.\n In this example, the movie title orders the `movieList`.", - "translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList`被根据movie的title排序了。", + "translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList` 被根据 movie 的 title 排序了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -631,7 +631,7 @@ }, { "original": "For performance reasons, no comparable pipe exists in Angular.\n Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.", - "translation": "在Angular中,出于性能的考虑,并没有一个类似的管道。\n 排序逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", + "translation": "在 Angular 中,出于性能的考虑,并没有一个类似的管道。\n 排序逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -641,22 +641,22 @@ }, { "original": "In both AngularJS and Angular, modules help you organize your application into cohesive blocks of functionality.", - "translation": "无论在AngularJS还是Angular中,我们都要借助“模块”来把应用拆分成一些紧密相关的功能块。", + "translation": "无论在 AngularJS 还是 Angular 中,你都要借助“模块”来把应用拆分成一些紧密相关的功能块。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, you write the code that provides the model and the methods for the view in a **controller**.\nIn Angular, you build a **component**.", - "translation": "在AngularJS中,我们在**控制器**中写代码,来为视图提供模型和方法。\n在Angular中,我们创建**组件**。", + "translation": "在 AngularJS 中,你要在**控制器**中写代码,来为视图提供模型和方法。\n在 Angular 中,你要创建**组件**。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "Because much AngularJS code is in JavaScript, JavaScript code is shown in the AngularJS column.\nThe Angular code is shown using TypeScript.", - "translation": "因为很多AngularJS的代码是用JavaScript写的,所以在AngularJS列显示的是JavaScript代码,而Angular列显示的是TypeScript代码。", + "translation": "因为很多 AngularJS 的代码是用 JavaScript 写的,所以在 AngularJS 列显示的是 JavaScript 代码,而 Angular 列显示的是 TypeScript 代码。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, an immediately invoked function expression (or IIFE) around controller code\n keeps it out of the global namespace.", - "translation": "在AngularJS中,用立即调用的函数表达式(IIFE)来包裹控制器代码可以让控制器代码不会污染全局命名空间。", + "translation": "在 AngularJS 中,用立即调用的函数表达式(IIFE)来包裹控制器代码可以让控制器代码不会污染全局命名空间。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -666,7 +666,7 @@ }, { "original": "This is a nonissue in Angular because ES 2015 modules\n handle the namespacing for you.", - "translation": "在Angular中我们不用担心这个问题,因为使用ES 2015的模块,模块会替我们处理命名空间问题。", + "translation": "在 Angular 中不用担心这个问题,因为使用 ES 2015 的模块,模块会替你处理命名空间问题。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -676,17 +676,17 @@ }, { "original": "### Angular modules", - "translation": "### Angular模块", + "translation": "### Angular 模块", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In AngularJS, an Angular module keeps track of controllers, services, and other code.\n The second argument defines the list of other modules that this module depends upon.", - "translation": "在AngularJS中,Angular模块用来对控制器、服务和其它代码进行跟踪。第二个参数定义该模块依赖的其它模块列表。", + "translation": "在 AngularJS 中,Angular 模块用来对控制器、服务和其它代码进行跟踪。第二个参数定义该模块依赖的其它模块列表。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "NgModules, defined with the `NgModule` decorator, serve the same purpose:", - "translation": "Angular的模块用`NgModule`装饰器进行定义,有如下用途:", + "translation": "Angular 的模块用 `NgModule` 装饰器进行定义,有如下用途:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -711,7 +711,7 @@ }, { "original": "AngularJS has code in each controller that looks up an appropriate Angular module\n and registers the controller with that module.", - "translation": "在AngularJS中,在每个控制器中都有一些代码,用于找到合适的Angular模块并把该控制器注册进去。", + "translation": "在 AngularJS 中,在每个控制器中都有一些代码,用于找到合适的 Angular 模块并把该控制器注册进去。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -726,7 +726,7 @@ }, { "original": "Angular adds a decorator to the component class to provide any required metadata.\n The `@Component` decorator declares that the class is a component and provides metadata about\n that component such as its selector (or tag) and its template.", - "translation": "在Angular中,我们往组件类上添加了一个装饰器,以提供任何需要的元数据。\n `@Component`装饰器把该类声明为组件,并提供了关于该组件的元数据,比如它的选择器(或标签)和模板。", + "translation": "Angular 会往组件类上添加了一个装饰器,以提供所需的任何元数据。\n `@Component` 装饰器把该类声明为组件,并提供了关于该组件的元数据,比如它的选择器(或标签)和模板。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -746,7 +746,7 @@ }, { "original": "In AngularJS, you write the code for the model and methods in a controller function.", - "translation": "在Angular1中,我们在控制器函数中写模型和方法的代码。", + "translation": "在 Angular1 中,你在控制器函数中编写模型和方法的代码。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -756,12 +756,12 @@ }, { "original": "In Angular, you create a component class.", - "translation": "在Angular中,我们写组件类。", + "translation": "在 Angular 中,你要创建组件类。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "NOTE: If you are using TypeScript with AngularJS, you must use the `export` keyword to export the component class.", - "translation": "注意:如果你正在用TypeScript写AngularJS,那么必须用`export`关键字来导出组件类。", + "translation": "注意:如果你正在用 TypeScript 写 AngularJS,那么必须用 `export` 关键字来导出组件类。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -776,12 +776,12 @@ }, { "original": "In AngularJS, you pass in any dependencies as controller function arguments.\n This example injects a `MovieService`.", - "translation": "在AngularJS中,我们把所有依赖都作为控制器函数的参数。\n 在这个例子中,我们注入了一个`MovieService`。", + "translation": "在 AngularJS 中,你把所有依赖都作为控制器函数的参数。\n 这个例子注入了一个 `MovieService`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "To guard against minification problems, tell Angular explicitly\n that it should inject an instance of the `MovieService` in the first parameter.", - "translation": "我们还通过在第一个参数明确告诉Angular它应该注入一个`MovieService`的实例,以防止在最小化时出现问题。", + "translation": "为了防止在最小化时出现问题,第一个参数明确告诉 Angular 它应该注入一个 `MovieService` 的实例。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -791,7 +791,7 @@ }, { "original": "In Angular, you pass in dependencies as arguments to the component class constructor.\n This example injects a `MovieService`.\n The first parameter's TypeScript type tells Angular what to inject, even after minification.", - "translation": "在Angular中,我们把依赖作为组件构造函数的参数传入。\n 在这个例子中,我们注入了一个`MovieService`。\n 即使在最小化之后,第一个参数的TypeScript类型也会告诉Angular它该注入什么。", + "translation": "在 Angular 中,你要把依赖作为组件构造函数的参数传入。\n 这个例子注入了一个 `MovieService`。\n 即使在最小化之后,第一个参数的 TypeScript 类型也会告诉 Angular 它该注入什么。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -806,17 +806,17 @@ }, { "original": "Style sheets give your application a nice look.\nIn AngularJS, you specify the style sheets for your entire application.\nAs the application grows over time, the styles for the many parts of the application\nmerge, which can cause unexpected results.\nIn Angular, you can still define style sheets for your entire application. But now you can\nalso encapsulate a style sheet within a specific component.", - "translation": "样式表美化我们的应用程序。\n在AngularJS中,我们为整个应用程序指定样式表。\n当应用程序成长一段时间之后,应用程序中很多部分的样式会被合并,导致无法预计的后果。\n在Angular中,我们仍然会为整个应用程序定义样式,不过现在也可以把样式表封装在特定的组件中。", + "translation": "样式表让你的应用程序看起来更漂亮。\n在 AngularJS 中,你要为整个应用程序指定样式表。\n随着应用程序的不断成长,为各个部分指定的样式会被合并,导致无法预计的后果。\n在 Angular 中,你仍然要为整个应用程序定义样式,不过现在也可以把样式表封装在特定的组件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "### Link tag", - "translation": "### Link标签", + "translation": "### Link 标签", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "AngularJS, uses a `link` tag in the head section of the `index.html` file\n to define the styles for the application.", - "translation": "在AngularJS中,我们在`index.html`的`head`区使用`link`标签来为应用程序定义样式。", + "translation": "AngularJS 在 `index.html` 的 `head` 区使用 `link` 标签来为应用程序定义样式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -826,17 +826,17 @@ }, { "original": "With the Angular CLI, you can configure your global styles in the `.angular-cli.json` file.\n You can rename the extension to `.scss` to use sass.", - "translation": "使用 Angular CLI,我们可以在 `.angular-cli.json` 文件中配置全局样式。\n 也可以把扩展名改为 `.scss` 来使用 sass。", + "translation": "使用 Angular CLI,你可以在 `.angular-cli.json` 文件中配置全局样式。\n 也可以把扩展名改为 `.scss` 来使用 sass。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "In Angular, you can use the `styles` or `styleUrls` property of the `@Component` metadata to define\n a style sheet for a particular component.", - "translation": "在Angular中,我们可以在`@Component`的元数据中使用`styles`或`styleUrls`属性来为一个特定的组件定义样式表。", + "translation": "在 Angular 中,你可以在 `@Component` 的元数据中使用 `styles` 或 `styleUrls` 属性来为一个特定的组件定义样式表。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { "original": "This allows you to set appropriate styles for individual components that won’t leak into\n other parts of the application.", - "translation": "这让我们可以为各个组件设置合适的样式,而不用担心它被泄漏到程序中的其它部分。", + "translation": "这让你可以为各个组件设置合适的样式,而不用担心它被泄漏到程序中的其它部分。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -846,7 +846,7 @@ }, { "original": "Motion is an important aspect in the design of modern web applications. Good\nuser interfaces transition smoothly between states with engaging animations\nthat call attention where it's needed. Well-designed animations can make a UI not only\nmore fun but also easier to use.", - "translation": "动画是现代Web应用设计中一个很重要的方面。我们希望用户界面能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让UI更有趣,还会让它更容易使用。", + "translation": "动画是现代 Web 应用设计中一个很重要的方面。好的用户界面要能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让 UI 更有趣,还会让它更容易使用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -856,12 +856,12 @@ }, { "original": "Angular's animation system lets you build animations that run with the same kind of native\nperformance found in pure CSS animations. You can also tightly integrate your\nanimation logic with the rest of your application code, for ease of control.", - "translation": "Angular的动画系统赋予了制作各种动画效果的能力,以构建出与原生CSS动画性能相同的动画。\n我们也获得了额外的让动画逻辑与其它应用代码紧紧集成在一起的能力,这让动画可以被更容易的触发与控制。", + "translation": "Angular 的动画系统赋予了制作各种动画效果的能力,以构建出与原生 CSS 动画性能相同的动画。\n你还获得了额外的让动画逻辑与其它应用代码紧紧集成在一起的能力,这让动画可以被更容易的触发与控制。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Angular animations are built on top of the standard [Web Animations API](https://w3c.github.io/web-animations/)\nand run natively on [browsers that support it](http://caniuse.com/#feat=web-animation).", - "translation": "Angular动画是基于标准的[Web动画API(Web Animations API)](https://w3c.github.io/web-animations/)构建的,它们在[支持此API的浏览器中](http://caniuse.com/#feat=web-animation)会用原生方式工作。", + "translation": "Angular 动画是基于标准的[Web 动画 API(Web Animations API)](https://w3c.github.io/web-animations/)构建的,它们在[支持此 API 的浏览器中](http://caniuse.com/#feat=web-animation)会用原生方式工作。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -911,32 +911,32 @@ }, { "original": "You can build a simple animation that transitions an element between two states\ndriven by a model attribute.", - "translation": "我们来构建一个简单的动画,它会让一个元素用模型驱动的方式在两个状态之间转场。", + "translation": "你可以构建一个简单的动画,它会让一个元素用模型驱动的方式在两个状态之间转场。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Animations can be defined inside `@Component` metadata.", - "translation": "动画会被定义在`@Component`元数据中。", + "translation": "动画会被定义在 `@Component` 元数据中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "With these, you can define an *animation trigger* called `heroState` in the component\nmetadata. It uses animations to transition between two states: `active` and `inactive`. When a\nhero is active, the element appears in a slightly larger size and lighter color.", - "translation": "通过这些,可以在组件元数据中定义一个名叫`heroState`的*动画触发器*。它在两个状态`active`和`inactive`之间进行转场。\n当英雄处于激活状态时,它会把该元素显示得稍微大一点、亮一点。", + "translation": "通过这些,可以在组件元数据中定义一个名叫 `heroState` 的*动画触发器*。它在两个状态 `active` 和 `inactive` 之间进行转场。\n当英雄处于激活状态时,它会把该元素显示得稍微大一点、亮一点。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "In this example, you are defining animation styles (color and transform) inline in the\nanimation metadata.", - "translation": "在这个例子中,我们在元数据中用内联的方式定义了动画样式(`color`和`transform`)。在即将到来的一个Angular版本中,还将支持从组件的CSS样式表中提取样式。", + "translation": "在这个例子中,你在元数据中用内联的方式定义了动画样式(`color` 和 `transform`)。在即将到来的一个 Angular 版本中,还将支持从组件的 CSS 样式表中提取样式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Now, using the `[@triggerName]` syntax, attach the animation that you just defined to\none or more elements in the component's template.", - "translation": "我们刚刚定义了一个动画,但它还没有被用到任何地方。要想使用它,可以在模板中用`[@triggerName]`语法来把它附加到一个或多个元素上。", + "translation": "现在,使用 `[@triggerName]` 语法来把刚刚定义的动画附加到组件模板中一个或多个元素上。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Here, the animation trigger applies to every element repeated by an `ngFor`. Each of\nthe repeated elements animates independently. The value of the\nattribute is bound to the expression `hero.state` and is always either `active` or `inactive`.", - "translation": "这里,我们把该动画触发器添加到了由`ngFor`重复出来的每一个元素上。每个重复出来的元素都有独立的动画效果。\n然后把`@triggerName`属性(Attribute)的值设置成表达式`hero.state`。这个值应该或者是`inactive`或者是`active`,因为我们刚刚为它们俩定义过动画状态。", + "translation": "这里,动画触发器被添加到了由 `ngFor` 重复出来的每一个元素上。每个重复出来的元素都有独立的动画效果。\n然后把 `@triggerName` 属性(Attribute)的值设置成表达式 `hero.state`。这个值应该是 `inactive` 或 `active` 之一。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -951,22 +951,22 @@ }, { "original": "Angular animations are defined as logical **states** and **transitions**\nbetween states.", - "translation": "Angular动画是由**状态**和**状态之间的转场效果**所定义的。", + "translation": "Angular 动画是由**状态**和**状态之间的转场效果**所定义的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "An animation state is a string value that you define in your application code. In the example\nabove, the states `'active'` and `'inactive'` are based on the logical state of\nhero objects. The source of the state can be a simple object attribute, as it was in this case,\nor it can be a value computed in a method. The important thing is that you can read it into the\ncomponent's template.", - "translation": "动画状态是一个由程序代码中定义的字符串值。在上面的例子中,基于英雄对象的逻辑状态,我们使用了`'active'`和`'inactive'`这两种状态。\n状态的来源可以是像本例中这样简单的对象属性,也可以是由方法计算出来的值。重点是,我们得能从组件模板中读取它。", + "translation": "动画状态是一个由程序代码中定义的字符串值。在上面的例子中,`'active'` 和 `'inactive'` 是基于英雄对象的逻辑状态的。\n状态的来源可以是像本例中这样简单的对象属性,也可以是由方法计算出来的值。重点是,你要能从组件模板中读取它。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "You can define *styles* for each animation state:", - "translation": "我们可以为每个动画状态定义了*一组样式*:", + "translation": "你可以为每个动画状态定义了*一组样式*:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "These `state` definitions specify the *end styles* of each state.\nThey are applied to the element once it has transitioned to that state, and stay\n*as long as it remains in that state*. In effect, you're defining what styles the element has in different states.", - "translation": "这些`state`具体定义了每个状态的*最终样式*。一旦元素转场到那个状态,该样式就会被应用到此元素上,*当它留在此状态时*,这些样式也会一直保持着。\n从这个意义上讲,这里其实并不只是在定义动画,而是在定义该元素在不同状态时应该具有的样式。", + "translation": "这些 `state` 具体定义了每个状态的*最终样式*。一旦元素转场到那个状态,该样式就会被应用到此元素上,*当它留在此状态时*,这些样式也会一直保持着。\n从这个意义上讲,这里其实并不只是在定义动画,而是在定义该元素在不同状态时应该具有的样式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -976,17 +976,17 @@ }, { "original": "If several transitions have the same timing configuration, you can combine\nthem into the same `transition` definition:", - "translation": "如果多个转场都有同样的时间线配置,就可以把它们合并进同一个`transition`定义中:", + "translation": "如果多个转场都有同样的时间线配置,就可以把它们合并进同一个 `transition` 定义中:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "When both directions of a transition have the same timing, as in the previous\nexample, you can use the shorthand syntax `<=>`:", - "translation": "如果要对同一个转场的两个方向都使用相同的时间线(就像前面的例子中那样),就可以使用`<=>`这种简写语法:", + "translation": "如果要对同一个转场的两个方向都使用相同的时间线(就像前面的例子中那样),就可以使用 `<=>` 这种简写语法:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "You can also apply a style during an animation but not keep it around\nafter the animation finishes. You can define such styles inline, in the `transition`. In this example,\nthe element receives one set of styles immediately and is then animated to the next.\nWhen the transition finishes, none of these styles are kept because they're not\ndefined in a `state`.", - "translation": "有时希望一些样式只在动画期间生效,但在结束后并不保留它们。这时可以把这些样式内联在`transition`中进行定义。\n在这个例子中,该元素会立刻获得一组样式,然后动态转场到下一个状态。当转场结束时,这些样式并不会被保留,因为它们并没有被定义在`state`中。", + "translation": "有时希望一些样式只在动画期间生效,但在结束后并不保留它们。这时可以把这些样式内联在 `transition` 中进行定义。\n在这个例子中,该元素会立刻获得一组样式,然后动态转场到下一个状态。当转场结束时,这些样式并不会被保留,因为它们并没有被定义在 `state` 中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1001,32 +1001,32 @@ }, { "original": "* The `active => *` transition applies when the element's state changes from `active` to anything else.", - "translation": "当该元素的状态从`active`变成任何其它状态时,`active => *`转场都会生效。", + "translation": "当该元素的状态从 `active` 变成任何其它状态时,`active => *` 转场都会生效。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "* The `* => *` transition applies when *any* change between two states takes place.", - "translation": "当在*任意*两个状态之间切换时,`* => *`转场都会生效。", + "translation": "当在*任意*两个状态之间切换时,`* => *` 转场都会生效。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "### The `void` state", - "translation": "### `void`状态", + "translation": "### `void` 状态", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "The special state called `void` can apply to any animation. It applies\nwhen the element is *not* attached to a view, perhaps because it has not yet been\nadded or because it has been removed. The `void` state is useful for defining enter and\nleave animations.", - "translation": "有一种叫做`void`的特殊状态,它可以应用在任何动画中。它表示元素*没有*被附加到视图。这种情况可能是由于它尚未被添加进来或者已经被移除了。\n`void`状态在定义“进场”和“离场”的动画时会非常有用。", + "translation": "有一种叫做 `void` 的特殊状态,它可以应用在任何动画中。它表示元素*没有*被附加到视图。这种情况可能是由于它尚未被添加进来或者已经被移除了。\n`void` 状态在定义“进场”和“离场”的动画时会非常有用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "For example the `* => void` transition applies when the element leaves the view,\nregardless of what state it was in before it left.", - "translation": "比如当一个元素离开视图时,`* => void`转场就会生效,而不管它在离场以前是什么状态。", + "translation": "比如当一个元素离开视图时,`* => void` 转场就会生效,而不管它在离场以前是什么状态。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "The wildcard state `*` also matches `void`.", - "translation": "`*`通配符状态也能匹配`void`。", + "translation": "`*` 通配符状态也能匹配 `void`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1036,7 +1036,7 @@ }, { "original": "Using the `void` and `*` states you can define transitions that animate the\nentering and leaving of elements:", - "translation": "使用`void`和`*`状态,可以定义元素进场与离场时的转场动画:", + "translation": "使用 `void` 和 `*` 状态,可以定义元素进场与离场时的转场动画:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1051,12 +1051,12 @@ }, { "original": "For example, in the `animations` array below there are two transitions that use\nthe `void => *` and `* => void` syntax to animate the element in and out of the view.", - "translation": "例如,在下面的`animations`数组中,这两个转场语句使用`void => *`和`* => void`语法来让该元素以动画形式进入和离开当前视图。", + "translation": "例如,在下面的 `animations` 数组中,这两个转场语句使用 `void => *` 和 `* => void` 语法来让该元素以动画形式进入和离开当前视图。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Note that in this case the styles are applied to the void state directly in the\ntransition definitions, and not in a separate `state(void)` definition. Thus, the transforms\nare different on enter and leave: the element enters from the left\nand leaves to the right.", - "translation": "注意,在这个例子中,这些样式在转场定义中被直接应用到了`void`状态,但并没有一个单独的`state(void)`定义。\n这么做是因为希望在进场与离场时使用不一样的转换效果:元素从左侧进场,从右侧离开。", + "translation": "注意,在这个例子中,这些样式在转场定义中被直接应用到了 `void` 状态,但并没有一个单独的 `state(void)` 定义。\n这么做是因为希望在进场与离场时使用不一样的转换效果:元素从左侧进场,从右侧离开。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1071,7 +1071,7 @@ }, { "original": "You can also combine this animation with the earlier state transition animation by\nusing the hero state as the animation state. This lets you configure\ndifferent transitions for entering and leaving based on what the state of the hero\nis:", - "translation": "通过把英雄的状态用作动画的状态,还能把该动画跟以前的转场动画组合成一个复合动画。这让我们能根据该英雄的当前状态为其配置不同的进场与离场动画:", + "translation": "通过把英雄的状态用作动画的状态,还能把该动画跟以前的转场动画组合成一个复合动画。这让你能根据该英雄的当前状态为其配置不同的进场与离场动画:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1106,7 +1106,7 @@ }, { "original": "Since Angular's animation support builds on top of Web Animations, you can animate any property\nthat the browser considers *animatable*. This includes positions, sizes, transforms, colors,\nborders, and many others. The W3C maintains\n[a list of animatable properties](https://www.w3.org/TR/css3-transitions/#animatable-properties)\non its [CSS Transitions page](https://www.w3.org/TR/css3-transitions).", - "translation": "由于Angular的动画支持是基于Web Animations标准的,所以也能支持浏览器认为可以*参与动画*的任何属性。这些属性包括位置(position)、大小(size)、变换(transform)、颜色(color)、边框(border)等很多属性。W3C维护着\n[一个“可动”属性列表](https://www.w3.org/TR/css3-transitions/#animatable-properties)。", + "translation": "由于 Angular 的动画支持是基于 Web Animations 标准的,所以也能支持浏览器认为可以*参与动画*的任何属性。这些属性包括位置(position)、大小(size)、变换(transform)、颜色(color)、边框(border)等很多属性。W3C 维护着\n[一个“可动”属性列表](https://www.w3.org/TR/css3-transitions/#animatable-properties)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1121,7 +1121,7 @@ }, { "original": "* `50` is the same as saying `'50px'`", - "translation": "`50`相当于`'50px'`", + "translation": "`50` 相当于 `'50px'`", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1131,17 +1131,17 @@ }, { "original": "Sometimes you don't know the value of a dimensional style property until runtime.\nFor example, elements often have widths and heights that\ndepend on their content and the screen size. These properties are often tricky\nto animate with CSS.", - "translation": "有时候,我们想在动画中使用的尺寸类样式,它的值在开始运行之前都是不可知的。比如,元素的宽度和高度往往依赖于它们的内容和屏幕的尺寸。处理这些属性对CSS动画而言通常是相当棘手的。", + "translation": "有时候,你在开始运行之前都无法知道某个样式属性的值。比如,元素的宽度和高度往往依赖于它们的内容和屏幕的尺寸。处理这些属性对 CSS 动画而言通常是相当棘手的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "In these cases, you can use a special `*` property value so that the value of the\nproperty is computed at runtime and then plugged into the animation.", - "translation": "如果用Angular动画,就可以用一个特殊的`*`属性值来处理这种情况。该属性的值将会在运行期被计算出来,然后插入到这个动画中。", + "translation": "如果用 Angular 动画,就可以用一个特殊的 `*` 属性值来处理这种情况。该属性的值将会在运行期被计算出来,然后插入到这个动画中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "In this example, the leave animation takes whatever height the element has before it\nleaves and animates from that height to zero:", - "translation": "这个例子中的“离场”动画会取得该元素在离场前的高度,并且把它从这个高度用动画转场到0高度:", + "translation": "这个例子中的“离场”动画会取得该元素在离场前的高度,并且把它从这个高度用动画转场到 0 高度:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1191,7 +1191,7 @@ }, { "original": "* Wait for 100ms and then run for 200ms: `'0.2s 100ms'`", - "translation": "等待100毫秒,然后运行200毫秒:`'0.2s 100ms'`。", + "translation": "等待 100 毫秒,然后运行 200 毫秒:`'0.2s 100ms'`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1201,17 +1201,17 @@ }, { "original": "The [easing function](http://easings.net/) controls how the animation accelerates\nand decelerates during its runtime. For example, an `ease-in` function causes\nthe animation to begin relatively slowly but pick up speed as it progresses. You\ncan control the easing by adding it as a *third* value in the string after the duration\nand the delay (or as the *second* value when there is no delay):", - "translation": "[缓动函数](http://easings.net/)用于控制动画在运行期间如何加速和减速。比如:使用`ease-in`函数意味着动画开始时相对缓慢,然后在进行中逐步加速。可以通过在这个字符串中的持续时间和延迟后面添加*第三个*值来控制使用哪个缓动函数(如果没有定义延迟就作为*第二个*值)。", + "translation": "[缓动函数](http://easings.net/)用于控制动画在运行期间如何加速和减速。比如:使用 `ease-in` 函数意味着动画开始时相对缓慢,然后在进行中逐步加速。可以通过在这个字符串中的持续时间和延迟后面添加*第三个*值来控制使用哪个缓动函数(如果没有定义延迟就作为*第二个*值)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "* Wait for 100ms and then run for 200ms, with easing: `'0.2s 100ms ease-out'`", - "translation": "等待100毫秒,然后运行200毫秒,并且带缓动:`'0.2s 100ms ease-out'`", + "translation": "等待 100 毫秒,然后运行 200 毫秒,并且带缓动:`'0.2s 100ms ease-out'`", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "* Run for 200ms, with easing: `'0.2s ease-in-out'`", - "translation": "运行200毫秒,并且带缓动:`'0.2s ease-in-out'`", + "translation": "运行 200 毫秒,并且带缓动:`'0.2s ease-in-out'`", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1221,7 +1221,7 @@ }, { "original": "Here are a couple of custom timings in action. Both enter and leave last for\n200 milliseconds, that is `0.2s`, but they have different easings. The leave begins after a\nslight delay of 10 milliseconds as specified in `'0.2s 10 ease-out'`:", - "translation": "这里是两个自定义时间线的动态演示。“进场”和“离场”都持续200毫秒,也就是`0.2s`,但它们有不同的缓动函数。“离场”动画会在100毫秒的延迟之后开始,也就是`'0.2s 10 ease-out'`:", + "translation": "这里是两个自定义时间线的动态演示。“进场”和“离场”都持续 200 毫秒,也就是 `0.2s`,但它们有不同的缓动函数。“离场”动画会在 100 毫秒的延迟之后开始,也就是 `'0.2s 10 ease-out'`:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1236,22 +1236,22 @@ }, { "original": "For each keyframe, you specify an *offset* that defines at which point\nin the animation that keyframe applies. The offset is a number between zero,\nwhich marks the beginning of the animation, and one, which marks the end.", - "translation": "每个关键帧都可以被指定一个*偏移量*,用来定义该关键帧将被用在动画期间的哪个时间点。偏移量是一个介于0(表示动画起点)和1(表示动画终点)之间的数组。", + "translation": "每个关键帧都可以被指定一个*偏移量*,用来定义该关键帧将被用在动画期间的哪个时间点。偏移量是一个介于 0(表示动画起点)和 1(表示动画终点)之间的数组。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "This example adds some \"bounce\" to the enter and leave animations with\nkeyframes:", - "translation": "在这个例子中,我们使用关键帧来为进场和离场动画添加一些“反弹效果”:", + "translation": "这个例子使用关键帧来为进场和离场动画添加一些“反弹效果”:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Note that the offsets are *not* defined in terms of absolute time. They are relative\nmeasures from zero to one. The final timeline of the animation is based on the combination\nof keyframe offsets, duration, delay, and easing.", - "translation": "注意,这个偏移量并*不是*用绝对数字定义的时间段,而是在0到1之间的相对值(百分比)。动画的最终时间线会基于关键帧的偏移量、持续时间、延迟和缓动函数计算出来。", + "translation": "注意,这个偏移量并*不是*用绝对数字定义的时间段,而是在 0 到 1 之间的相对值(百分比)。动画的最终时间线会基于关键帧的偏移量、持续时间、延迟和缓动函数计算出来。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "Defining offsets for keyframes is optional. If you omit them, offsets with even\nspacing are automatically assigned. For example, three keyframes without predefined\noffsets receive offsets `0`, `0.5`, and `1`.", - "translation": "为关键帧定义偏移量是可选的。如果省略它们,偏移量会自动根据帧数平均分布出来。例如,三个未定义过偏移量的关键帧会分别获得偏移量:`0`、`0.5`和`1`。", + "translation": "为关键帧定义偏移量是可选的。如果省略它们,偏移量会自动根据帧数平均分布出来。例如,三个未定义过偏移量的关键帧会分别获得偏移量:`0`、`0.5` 和 `1`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1261,22 +1261,22 @@ }, { "original": "You've seen how to animate multiple style properties at the same time:\njust put all of them into the same `style()` definition.", - "translation": "我们已经知道该如何在同一时间段进行多个样式的动画了:只要把它们都放进同一个`style()`定义中就行了!", + "translation": "你已经知道该如何在同一时间段进行多个样式的动画了:只要把它们都放进同一个 `style()` 定义中就行了!", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "But you may also want to configure different *timings* for animations that happen\nin parallel. For example, you may want to animate two CSS properties but use a\ndifferent easing function for each one.", - "translation": "但我们也可能会希望为同时发生的几个动画配置不同的*时间线*。比如,同时对两个CSS属性做动画,但又得为它们定义不同的缓动函数。", + "translation": "但你也可能会希望为同时发生的几个动画配置不同的*时间线*。比如,同时对两个 CSS 属性做动画,但又得为它们定义不同的缓动函数。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "For this you can use animation *groups*. In this example, using groups both on\nenter and leave allows for two different timing configurations. Both\nare applied to the same element in parallel, but run independently of each other:", - "translation": "这种情况下就可以用动画*组*来解决了。在这个例子中,我们同时在进场和离场时使用了组,以便能让它们使用两种不同的时间线配置。\n它们被同时应用到同一个元素上,但又彼此独立运行:", + "translation": "这种情况下就可以用动画*组*来解决了。在这个例子中,同时在进场和离场时使用了组,以便能让它们使用两种不同的时间线配置。\n它们被同时应用到同一个元素上,但又彼此独立运行:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "One group animates the element transform and width; the other group animates the opacity.", - "translation": "其中一个动画组对元素的`transform`和`width`做动画,另一个组则对`opacity`做动画。", + "translation": "其中一个动画组对元素的 `transform` 和 `width` 做动画,另一个组则对 `opacity` 做动画。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1291,12 +1291,12 @@ }, { "original": "In the keyframes example, you have a `trigger` called `@flyInOut`. You can hook\nthose callbacks like this:", - "translation": "对于例子中的这个关键帧,我们有一个叫做`@flyInOut`的`trigger`。在那里我们可以挂钩到那些回调,比如:", + "translation": "对于例子中的这个关键帧,你有一个叫做 `@flyInOut` 的 `trigger`。在那里你可以挂钩到那些回调,比如:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { "original": "The callbacks receive an `AnimationEvent` that contains useful properties such as\n`fromState`, `toState` and `totalTime`.", - "translation": "这些回调接收一个`AnimationTransitionEvent`参数,它包含一些有用的属性,例如`fromState`,`toState`和`totalTime`。", + "translation": "这些回调接收一个 `AnimationTransitionEvent` 参数,它包含一些有用的属性,例如 `fromState`,`toState` 和 `totalTime`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, { @@ -1304,6 +1304,11 @@ "translation": "无论动画是否实际执行过,那些回调都会触发。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/animations.md" }, + { + "original": "# The Ahead-of-Time (AOT) Compiler", + "translation": "# 预先(AOT)编译", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, { "original": "The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase _before_ the browser downloads and runs that code.", "translation": "Angular 的“预先(AOT)编译器”会在构建期间把 Angular 应用的 HTML 和 TypeScript 代码编译成高效的 JavaScript 代码,之后浏览器就可以下载并快速运行这些代码。", @@ -1316,7 +1321,7 @@ }, { "original": "Watch compiler author Tobias Bosch explain the Angular Compiler at AngularConnect 2016.", - "translation": "观看编译器作者Tobias Bosch在AngularConnect 2016大会里,对Angular编译器的演讲。", + "translation": "观看编译器作者 Tobias Bosch 在 AngularConnect 2016 大会里,对Angular 编译器的演讲。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -1324,6 +1329,41 @@ "translation": "## Angular 中的编译", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, + { + "original": "An Angular application consists largely of components and their HTML templates.\nBefore the browser can render the application,\nthe components and templates must be converted to executable JavaScript by an _Angular compiler_.", + "translation": "Angular 应用由大量组件及其 HTML 模板组成。\n在浏览器渲染应用之前,组件和模板必须由 *Angular 编译器*转换成可执行的 JavaScript 代码。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "Angular offers two ways to compile your application:", + "translation": "Angular 提供了两种方式来编译你的应用:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "1. **_Just-in-Time_ (JIT)**, which compiles your app in the browser at runtime", + "translation": "**即时(JIT)编译**,它会在浏览器中运行时编译你的应用", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "1. **_Ahead-of-Time_ (AOT)**, which compiles your app at build time.", + "translation": "**预先(AOT)编译**,它会在构建时编译你的应用。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "JIT compilation is the default when you run the _build-only_ or the _build-and-serve-locally_ CLI commands:", + "translation": "当你运行 *`build`* 或 *`serve`* 这两个 CLI 命令时 JIT 编译是默认选项:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "For AOT compilation, append the `--aot` flags to the _build-only_ or the _build-and-serve-locally_ CLI commands:", + "translation": "要进行 AOT 编译只要给这两个 CLI 命令添加 `--aot` 标志就行了:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "The `--prod` meta-flag compiles with AOT by default.", + "translation": "`--prod` 标志也会默认使用 AOT 编译。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, { "original": "See the [CLI documentation](https://github.com/angular/angular-cli/wiki) for details, especially the [`build` topic](https://github.com/angular/angular-cli/wiki/build).", "translation": "要了解更多,请参见[CLI 文档](https://github.com/angular/angular-cli/wiki),特别是[`build` 这个主题](https://github.com/angular/angular-cli/wiki/build)。", @@ -1331,7 +1371,7 @@ }, { "original": "## Why compile with AOT?", - "translation": "## 为什么需要AOT编译?", + "translation": "## 为什么需要 AOT 编译?", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -1341,7 +1381,7 @@ }, { "original": "With AOT, the browser downloads a pre-compiled version of the application.\nThe browser loads executable code so it can render the application immediately, without waiting to compile the app first.", - "translation": "使用AOT,浏览器下载预编译版本的应用程序。\n浏览器直接加载运行代码,所以它可以立即渲染该应用,而不用等应用完成首次编译。", + "translation": "使用 AOT,浏览器下载预编译版本的应用程序。\n浏览器直接加载运行代码,所以它可以立即渲染该应用,而不用等应用完成首次编译。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -1351,17 +1391,17 @@ }, { "original": "The compiler _inlines_ external HTML templates and CSS style sheets within the application JavaScript,\neliminating separate ajax requests for those source files.", - "translation": "编译器把外部HTML模板和CSS样式表内联到了该应用的JavaScript中。\n消除了用来下载那些源文件的Ajax请求。", + "translation": "编译器把外部 HTML 模板和 CSS 样式表内联到了该应用的 JavaScript 中。\n消除了用来下载那些源文件的 Ajax 请求。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { "original": "*Smaller Angular framework download size*", - "translation": "**需要下载的Angular框架体积更小**", + "translation": "**需要下载的 Angular 框架体积更小**", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { "original": "There's no need to download the Angular compiler if the app is already compiled.\nThe compiler is roughly half of Angular itself, so omitting it dramatically reduces the application payload.", - "translation": "如果应用已经编译过了,自然不需要再下载Angular编译器了。\n该编译器差不多占了Angular自身体积的一半儿,所以,省略它可以显著减小应用的体积。", + "translation": "如果应用已经编译过了,自然不需要再下载 Angular 编译器了。\n该编译器差不多占了 Angular 自身体积的一半儿,所以,省略它可以显著减小应用的体积。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -1371,7 +1411,7 @@ }, { "original": "The AOT compiler detects and reports template binding errors during the build step\nbefore users can see them.", - "translation": "AOT编译器在构建过程中检测和报告模板绑定错误,避免用户遇到这些错误。", + "translation": "AOT 编译器在构建过程中检测和报告模板绑定错误,避免用户遇到这些错误。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -1381,7 +1421,162 @@ }, { "original": "AOT compiles HTML templates and components into JavaScript files long before they are served to the client.\nWith no templates to read and no risky client-side HTML or JavaScript evaluation,\nthere are fewer opportunities for injection attacks.", - "translation": "AOT编译远在HTML模版和组件被服务到客户端之前,将它们编译到JavaScript文件。\n没有模版可以阅读,没有高风险客户端HTML或JavaScript可利用,所以注入攻击的机会较少。", + "translation": "AOT 编译远在 HTML 模版和组件被服务到客户端之前,将它们编译到 JavaScript 文件。\n没有模版可以阅读,没有高风险客户端 HTML 或 JavaScript 可利用,所以注入攻击的机会较少。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "## Angular Compiler Options", + "translation": "## Angular 编译器选项", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "You can control your app compilation by providing template compiler options in the `tsconfig.json` file along with the options supplied to the TypeScript compiler. The template compiler options are specified as members of\n`\"angularCompilerOptions\"` object as shown below:", + "translation": "你可以通过在 `tsconfig.json` 文件中随 TypeScript 编译选项一起提供模板编译选项来控制应用的编译方式。\n这些模板编译选项都是作为 `\"angularCompilerOptions\"` 对象的成员指定的,代码如下:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option tells the compiler not to produce `.metadata.json` files.\nThe option is `false` by default.", + "translation": "这个选项告诉编译器不要生成 `.metadata.json` 文件,它默认是 `false`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "`.metadata.json` files contain information needed by the template compiler from a `.ts`\nfile that is not included in the `.d.ts` file produced by the TypeScript compiler. This information contains,\nfor example, the content of annotations (such as a component's template) which TypeScript\nemits to the `.js` file but not to the `.d.ts` file.", + "translation": "`.metadata.json` 文件中包含模板编译器所需的信息,这些信息来自于 `.ts` 文件中,但是没有包含在由 TypeScript 编译器生成的 `.d.ts` 文件中。\n比如,这个信息包括 TypeScript 发出的注解内容(如组件的模板),TypeScript 把它生成到了 `.js` 文件中,但是没有生成到 `.d.ts` 文件中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option should be set to `true` if using TypeScript's `--outFile` option, as the metadata files\nare not valid for this style of TypeScript output. It is not recommeded to use `--outFile` with\nAngular. Use a bundler, such as [webpack](https://webpack.js.org/), instead.", + "translation": "如果使用了 TypeScript 的 `--outFile` 选项,那就要同时设置这个选项。因为在 TypeScript 的这种输出方式下,metadata 文件是无效的。\nAngular 中不建议使用 `--outFile`,请改用 [webpack](https://webpack.js.org/) 之类的打包器代替。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option can also be set to `true` when using factory summaries as the factory summaries\ninclude a copy of the information that is in the `.metadata.json` file.", + "translation": "当使用工厂汇总器(factory summary)时,这个选项也要设置为 `true`,因为工厂汇总器在自己的 `.metadata.json` 中也包含了这些信息的一个副本。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option tells the template compiler to report an error to the `.metadata.json`\nfile if `\"skipMetadataEmit\"` is `false` . This option is `false` by default. This should only be used when `\"skipMetadataEmit\"` is `false` and `\"skipTemplateCodeGen\"` is `true`.", + "translation": "", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "It is intended to validate the `.metadata.json` files emitted for bundling with an `npm` package. The validation is overly strict and can emit errors for metadata that would never produce an error when used by the template compiler. You can choose to suppress the error emitted by this option for an exported symbol by including `@dynamic` in the comment documenting the symbol.", + "translation": "它的设计意图是要验证为打包 `npm` 而生成的 `.metadata.json` 文件。\n这种验证过于严格,在使用模板编译器时甚至可能会对那些铁定不会出错的元数据文件报告一些错误。\n你可以用 `@dynamic` 在注释中指定一些要导出的符号,来禁止对它们报告错误。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "It is valid for `.metadata.json` files to contain errors. The template compiler reports these errors\nif the metadata is used to determine the contents of an annotation. The metadata\ncollector cannot predict the symbols that are designed to use in an annotation, so it will preemptively\ninclude error nodes in the metadata for the exported symbols. The template compiler can then use the error\nnodes to report an error if these symbols are used. If the client of a library intends to use a symbol in an annotation, the template compiler will not normally report\nthis until the client uses the symbol. This option allows detecting these errors during the build phase of\nthe library and is used, for example, in producing Angular libraries themselves.", + "translation": "对于 `.metadata.json` 文件来说,包含错误是正常的。如果这些元数据被用来确定注解的内容,模板编译器就会报告这些错误。\n元数据收集器无法判断这些符号的设计目的是用在注解中,所以它将会自作主张,在元数据中为这些导出的符号添加错误节点。\n如果这些符号被用到了,模板编译器就会根据这些错误节点报告错误。\n如果某个库的使用者只是在注解中(而不是普通代码中)使用这些符号,模板编译器通常不会报错。\n这个选项允许在该库(比如 Angular 自身这些库)的构建和使用过程中检测这类错误。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option tells the compiler to suppress emitting `.ngfactory.js` and `.ngstyle.js` files. When set,\nthis turns off most of the template compiler and disables reporting template diagnostics.\nThis option can be used to instruct the\ntemplate compiler to produce `.metadata.json` files for distribution with an `npm` package while\navoiding the production of `.ngfactory.js` and `.ngstyle.js` files that cannot be distributed to\n`npm`.", + "translation": "这个选项告诉编译器忽略从 `.ngfactory.js` 和 `.ngstyle.js` 文件中发出的错误。\n如果为 `true`,它就会关闭大多数的模板编译器,并禁止汇报模板诊断信息。\n这个选项用于指示模板编译器为通过 `npm` 包分发而生成 `.metadata.json` 文件,同时避免生成无法分发到 `npm` 的 `.ngfactory.js` 和 `.ngstyle.js` 文件。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "When set to `true`, this options tells the compiler to report an error for a parameter supplied\nwhose injection type cannot be determined. When this value option is not provided or is `false`, constructor parameters of classes marked with `@Injectable` whose type cannot be resolved will\nproduce a warning.", + "translation": "当设置为 `true` 时,该选项会告诉编译器为那些无法确定其类型的注入参数报告错误。\n当该值没有提供或未 `false` 时,那些带有 `@Injectable` 的类,如果其构造参数的类型无法解析,就会生成一个警告。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "*Note*: It is recommended to change this option explicitly to `true` as this option will default to `true` in the future.", + "translation": "*注意*:建议把该选项显式改为 `true`,因为将来这个选项的默认值会是 `true`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "When set to `true`, this option tells the template compiler to generate a flat module\nindex of the given file name and the corresponding flat module metadata. Use this option when creating\nflat modules that are packaged similarly to `@angular/core` and `@angular/common`. When this option\nis used, the `package.json` for the library should refer\nto the generated flat module index instead of the library index file. With this\noption only one `.metadata.json` file is produced that contains all the metadata necessary\nfor symbols exported from the library index. In the generated `.ngfactory.js` files, the flat\nmodule index is used to import symbols that includes both the public API from the library index\nas well as shrowded internal symbols.", + "translation": "当为 `true` 时,该选项告诉模板编译器生成一个指定名字的扁平模块索引和相应的扁平模块元数据。\n当要创建像 `@angular/core` 和 `@angular/common` 这样的扁平模块包时,请使用本选项。\n当使用本选项时,库的 `package.json` 文件就会引用生成的扁平模块索引,而不是库的索引文件。\n当使用本选项时,只会生成一个 `.metadata.json` 文件,其中包含从库索引中导出的符号所需的全部元数据。\n在生成的 `.ngfactory.js` 文件中,扁平模块索会用来导入包括库的公共 API 和隐藏的内部符号在内的全部符号。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "By default the `.ts` file supplied in the `files` field is assumed to be library index.\nIf more than one `.ts` file is specified, `libraryIndex` is used to select the file to use.\nIf more than one `.ts` file is supplied without a `libraryIndex`, an error is produced. A flat module\nindex `.d.ts` and `.js` will be created with the given `flatModuleOutFile` name in the same\nlocation as the library index `.d.ts` file. For example, if a library uses\n`public_api.ts` file as the library index of the module, the `tsconfig.json` `files` field\nwould be `[\"public_api.ts\"]`. The `flatModuleOutFile` options could then be set to, for\nexample `\"index.js\"`, which produces `index.d.ts` and `index.metadata.json` files. The\nlibrary's `package.json`'s `module` field would be `\"index.js\"` and the `typings` field\nwould be `\"index.d.ts\"`.", + "translation": "默认情况下,`files` 字段中提供的 `.ts` 文件会被当做库索引。\n如果指定了多个 `.ts` 文件,就要用 `libraryIndex` 来选择要作为库索引的文件。\n扁平模块索引会用 `flatModuleOutFile` 中给出的名字创建 `.d.ts` 和 `.js` 文件,并放在和库索引的 `.d.ts` 文件相同的位置。\n比如,如果某个库使用 `public_api.ts` 文件作为该模块的库索引,那么 `tsconfig.json` 的 `files` 字段就应该是 `[\"public_api.ts\"]`。\n然后可以把 `flatModuleOutFile` 选项设置为 `\"index.js\"`,它就会生成 `index.d.ts` 和 `index.metadata.json` 文件。\n该库的 `package.json` 文件的 `module` 字段将会是 `\"index.js\"`,而 `typings` 字段会是 `\"index.d.ts\"`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option specifies the preferred module id to use for importing a flat module.\nReferences generated by the template compiler will use this module name when importing symbols\nfrom the flat module.\nThis is only meaningful when `flatModuleOutFile` is also supplied. Otherwise the compiler ignores\nthis option.", + "translation": "该选项指定建议的模块 ID,这个 ID 用于导入扁平模块。\n从扁平模块中导入符号时,由模板编译器生成的引用将使用这个模块名称。\n它仅在同时提供了 `flatModuleOutFile` 选项时才有意义,否则,编译器将忽略此选项。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option tells the template compiler to generate factory files (`.ngfactory.js` and `.ngstyle.js`)\nfor `.d.ts` files with a corresponding `.metadata.json` file. This option defaults to\n`true`. When this option is `false`, factory files are generated only for `.ts` files.", + "translation": "这个选项告诉模板编译器也为与 `.metadata.json` 文件对应的 `.d.ts` 文件生成工厂文件(`.ngfactory.js` 和 `.ngstyle.js`)。\n这个选项默认为 `true`。当该选项为 `false` 时,只会为 `.ts` 文件生成工厂文件。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option should be set to `false` when using factory summaries.", + "translation": "当使用工厂汇总器时,这个选项应该设置为 `false`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option tells the compiler to enable the [binding expression validation](#binding-expresion-validation)\nphase of the template compiler which uses TypeScript to validate binding expressions.", + "translation": "该选项告诉编译器要为模板编译器启用[绑定表达式验证](#binding-expresion-validation)阶段,它会使用 TypeScript 来验证绑定表达式。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option is `false` by default.", + "translation": "该选项默认是 `false`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "*Note*: It is recommended to set this to `true` as this option will default to `true` in the future.", + "translation": "*注意*:建议把它设置为 `true`,因为将来它会默认为 `true`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This option tells the compiler to use [Tsickle](https://github.com/angular/tsickle) to annotate the emitted\nJavaScript with [JsDoc](http://usejsdoc.org/) comments needed by the\n[Closure Compiler](https://github.com/google/closure-compiler). This option defaults to `false`.", + "translation": "该选项告诉编译器使用 [Tsickle](https://github.com/angular/tsickle) 来为生成的 JavaScript 添加供 [Closure Compiler](https://github.com/google/closure-compiler) 使用的 [JsDoc](http://usejsdoc.org/) 注解。\n该选项默认为 `false`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "Use this option to modify how the Angular specific annotations are emitted to improve tree-shaking. Non-Angular\nannotations and decorators are unnaffected. Default is `static fields`.", + "translation": "使用这个选项来修改生成 Angular 特有注解的方式,以提升摇树优化(tree-shaking)的效果。它对 Angular 自身之外的注解和装饰器无效。\n默认值是 `static fields`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "This tells the compiler to print extra information while compiling templates.", + "translation": "它告诉编译器在编译模板时打印额外的信息。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" + }, + { + "original": "The use of `