From ba33ee016aa153f2386e18350faf245c9bafbaed Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Wed, 7 Mar 2018 14:19:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E7=89=88=E5=92=8C=E7=AC=AC=E4=BA=8C=E7=89=88=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E5=85=B8=20fix:=20=E4=BF=AE=E6=AD=A3=E5=8E=9F=E6=96=87?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/tools/translator/checker.spec.ts | 4 +- aio/tools/translator/dict-1.json | 369 ++++++++++++-------------- aio/tools/translator/dict-2.json | 371 ++++++++++++--------------- aio/tools/translator/extractor.ts | 8 +- aio/tools/translator/translate.ts | 2 +- aio/tools/translator/utils.spec.ts | 18 +- aio/tools/translator/utils.ts | 20 +- 7 files changed, 353 insertions(+), 439 deletions(-) diff --git a/aio/tools/translator/checker.spec.ts b/aio/tools/translator/checker.spec.ts index 3c3797c71a..f8f4a29ea2 100644 --- a/aio/tools/translator/checker.spec.ts +++ b/aio/tools/translator/checker.spec.ts @@ -8,7 +8,7 @@ import { isNotImg, isNotMarketingDocs, originalIsNotChinese, - originalIsNotAlertDivTag, + originalIsNotSpecialDivTag, translationHasNotCodeExample, } from './utils'; @@ -42,7 +42,7 @@ describe('自动检查翻译结果', function () { }); it('原文不应该是以
", - "translation": "Learn more about the JavaScript module system on the web.\n学习更多关于 JavaScript 模块的知识。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "These are two different and _complementary_ module systems. Use them both to write your apps.", "translation": "这两个模块化系统是互补的,我们在写程序时都会用到。", @@ -2079,11 +2074,6 @@ "translation": "这两个系统比较容易混淆,因为它们共享相同的词汇 “imports” 和 “exports”。不过没关系,先放一放,随着时间和经验的增长,自然就清楚了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "
", - "translation": "Learn more from the [NgModules](guide/ngmodule) page.\n更多信息,见 [Angular 模块](guide/ngmodule)。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "## Components", "translation": "## 组件", @@ -4010,42 +4000,42 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "", - "translation": "

Bootstraps the app, using the root component from the specified NgModule.

\n

NgModule 中指定的根组件进行启动。

", + "original": "

Bootstraps the app, using the root component from the specified NgModule.

", + "translation": "

NgModule 中指定的根组件进行启动。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "

NgModules

", + "original": "

NgModules

", "translation": "

Angular 模块

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Defines a module that contains components, directives, pipes, and providers.

", + "original": "

Defines a module that contains components, directives, pipes, and providers.

", "translation": "

定义一个模块,其中可以包含组件、指令、管道和服务提供商。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of components, directives, and pipes that belong to this module.

", + "original": "

List of components, directives, and pipes that belong to this module.

", "translation": "

属于当前模块的组件、指令和管道的列表。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of modules to import into this module. Everything from the imported modules\nis available to declarations of this module.

", + "original": "

List of modules to import into this module. Everything from the imported modules\nis available to declarations of this module.

", "translation": "

本模块所导入的模块列表

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of components, directives, and pipes visible to modules that import this module.

", + "original": "

List of components, directives, and pipes visible to modules that import this module.

", "translation": "

那些导入了本模块的模块所能看到的组件、指令和管道的列表

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of dependency injection providers visible both to the contents of this module and to importers of this module.

", + "original": "

List of dependency injection providers visible both to the contents of this module and to importers of this module.

", "translation": "

依赖注入提供商的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of components to bootstrap when this module is bootstrapped.

", + "original": "

List of components to bootstrap when this module is bootstrapped.

", "translation": "

当本模块启动时,随之启动的组件列表。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, @@ -4055,73 +4045,73 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds property value to the result of expression firstName.

\n

value属性绑定到表达式firstName

", + "original": "

Binds property value to the result of expression firstName.

", + "translation": "

value属性绑定到表达式firstName

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds attribute role to the result of expression myAriaRole.

\n

把属性(Attribute)role绑定到表达式myAriaRole的结果。

", + "original": "

Binds attribute role to the result of expression myAriaRole.

", + "translation": "

把属性(Attribute)role绑定到表达式myAriaRole的结果。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

\n

根据isDelightful表达式的结果是否为真,决定CSS类extra-sparkle是否出现在当前元素上。

", + "original": "

Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

", + "translation": "

根据isDelightful表达式的结果是否为真,决定CSS类extra-sparkle是否出现在当前元素上。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds style property width to the result of expression mySize in pixels. Units are optional.

\n

把CSS样式属性width的px(像素)值绑定到表达式mySize的结果。单位是可选的。

", + "original": "

Binds style property width to the result of expression mySize in pixels. Units are optional.

", + "translation": "

把CSS样式属性width的px(像素)值绑定到表达式mySize的结果。单位是可选的。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

\n

当这个按钮元素(及其子元素)上的click事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。

", + "original": "

Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

", + "translation": "

当这个按钮元素(及其子元素)上的click事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds a property to an interpolated string, for example, \"Hello Seabiscuit\". Equivalent to:\n<div [title]=\"'Hello ' + ponyName\">

\n

把一个属性绑定到插值字符串(如\"Hello Seabiscuit\")。这种写法等价于<div [title]=\"'Hello ' + ponyName\">

", + "original": "

Binds a property to an interpolated string, for example, \"Hello Seabiscuit\". Equivalent to:\n<div [title]=\"'Hello ' + ponyName\">

", + "translation": "

把一个属性绑定到插值字符串(如\"Hello Seabiscuit\")。这种写法等价于<div [title]=\"'Hello ' + ponyName\">

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds text content to an interpolated string, for example, \"Hello Seabiscuit\".

", + "original": "

Binds text content to an interpolated string, for example, \"Hello Seabiscuit\".

", "translation": "

把文本内容绑定到插值字符串(如\"Hello Seabiscuit\")

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Sets up two-way data binding. Equivalent to: <my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

\n

设置双向绑定。等价于<my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

", + "original": "

Sets up two-way data binding. Equivalent to: <my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

", + "translation": "

设置双向绑定。等价于<my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

\n

创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。

", + "original": "

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

", + "translation": "

创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

The * symbol turns the current element into an embedded template. Equivalent to:\n<template [myUnless]=\"myExpression\"><p>...</p></template>

\n

星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>

", + "original": "

The * symbol turns the current element into an embedded template. Equivalent to:<template [myUnless]=\"myExpression\"><p>...</p></template>

", + "translation": "

星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

\n

使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻

", + "original": "

Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

", + "translation": "

使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

\n

安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined

", + "original": "

The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

", + "translation": "

安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

\n

模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。

", + "original": "

An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

", + "translation": "

模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An <svg> root element is detected as an SVG element automatically, without the prefix.

\n

<svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。

", + "original": "

An <svg> root element is detected as an SVG element automatically, without the prefix.

", + "translation": "

<svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -4130,23 +4120,23 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Removes or recreates a portion of the DOM tree based on the showSection expression.

\n

根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。

", + "original": "

Removes or recreates a portion of the DOM tree based on the showSection expression.

", + "translation": "

根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

", + "original": "

Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

", "translation": "

把li元素及其内容变成一个模板,并使用这个模板为列表中的每一个条目实例化一个视图。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

\n

根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。

", + "original": "

Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

", + "translation": "

根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

\n

根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。

", + "original": "

Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

", + "translation": "

根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -4155,7 +4145,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Provides two-way data-binding, parsing, and validation for form controls.

", + "original": "

Provides two-way data-binding, parsing, and validation for form controls.

", "translation": "

为表单控件提供双向数据绑定、解析和验证功能。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, @@ -4165,17 +4155,17 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Declares that a class is a component and provides metadata about the component.

", + "original": "

Declares that a class is a component and provides metadata about the component.

", "translation": "

声明一个类是组件,并提供该组件的元数据。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Declares that a class is a directive and provides metadata about the directive.

", + "original": "

Declares that a class is a directive and provides metadata about the directive.

", "translation": "

声明一个类是指令,并提供该指令的元数据。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Declares that a class is a pipe and provides metadata about the pipe.

", + "original": "

Declares that a class is a pipe and provides metadata about the pipe.

", "translation": "

声明一个类是管道,并提供该管道的元数据。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, @@ -4190,8 +4180,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Specifies a CSS selector that identifies this directive within a template. Supported selectors include element,\n[attribute], .class, and :not().

\n

指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()

", + "original": "

Specifies a CSS selector that identifies this directive within a template. Supported selectors include element, [attribute], .class, and :not().

", + "translation": "

指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -4200,7 +4190,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of dependency injection providers for this directive and its children.

", + "original": "

List of dependency injection providers for this directive and its children.

", "translation": "

该指令及其子指令的依赖注入提供商列表。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, @@ -4210,27 +4200,22 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "", - "translation": "

\n@Component extends @Directive,\nso the @Directive configuration applies to components as well

\n

@Component 继承自 @Directive,因此 @Directive 的配置也能用于 @Component

", + "original": "

If set, the templateUrl and styleUrl are resolved relative to the component.

", + "translation": "

如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "", - "translation": "

If set, the templateUrl and styleUrl are resolved relative to the component.

\n

如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" - }, - { - "original": "

List of dependency injection providers scoped to this component's view.

", + "original": "

List of dependency injection providers scoped to this component's view.

", "translation": "

依赖注入提供商列表,但它们的范围被限定为当前组件的视图。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Inline template or external template URL of the component's view.

", + "original": "

Inline template or external template URL of the component's view.

", "translation": "

当前组件视图的内联模板或外部模板的 URL 。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

List of inline CSS styles or external stylesheet URLs for styling the component’s view.

", + "original": "

List of inline CSS styles or external stylesheet URLs for styling the component’s view.

", "translation": "

用于为当前组件的视图提供样式的内联 CSS 或外部样式表 URL 的列表。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, @@ -4240,43 +4225,43 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Declares an input property that you can update via property binding (example:\n<my-cmp [myProperty]=\"someExpression\">).

\n

声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]=\"someExpression\">

", + "original": "

Declares an input property that you can update via property binding (example: <my-cmp [myProperty]=\"someExpression\">).

", + "translation": "

声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]=\"someExpression\">

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)=\"doSomething()\">).

\n

声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)=\"doSomething()\">)。

", + "original": "

Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)=\"doSomething()\">).

", + "translation": "

声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)=\"doSomething()\">)。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

\n

把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。

", + "original": "

Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

", + "translation": "

把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

\n

用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)

", + "original": "

Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

", + "translation": "

用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

\n

把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。

", + "original": "

Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

", + "translation": "

把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

\n

把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上

", + "original": "

Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

", + "translation": "

把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

\n

把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。

", + "original": "

Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

", + "translation": "

把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

\n

把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。

", + "original": "

Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

", + "translation": "

把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -4290,47 +4275,47 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

", + "original": "

Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

", "translation": "

在任何其它生命周期钩子之前调用。可以用它来注入依赖项,但不要在这里做正事。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called after every change to input properties and before processing content or child views.

\n

每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。

", + "original": "

Called after every change to input properties and before processing content or child views.

", + "translation": "

每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called after the constructor, initializing input properties, and the first call to ngOnChanges.

\n

在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。

", + "original": "

Called after the constructor, initializing input properties, and the first call to ngOnChanges.

", + "translation": "

在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

", + "original": "

Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

", "translation": "

每当对组件或指令的输入属性进行变更检测时就会调用。可以用它来扩展变更检测逻辑,执行自定义的检测逻辑。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called after ngOnInit when the component's or directive's content has been initialized.

\n

ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。

", + "original": "

Called after ngOnInit when the component's or directive's content has been initialized.

", + "translation": "

ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called after every check of the component's or directive's content.

\n

每当组件或指令的内容(ng-content)做变更检测时调用。

", + "original": "

Called after every check of the component's or directive's content.

", + "translation": "

每当组件或指令的内容(ng-content)做变更检测时调用。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.

\n

ngAfterContentInit完毕,并且组件的视图已经初始化完毕时调用。只适用于组件。

", + "original": "

Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.

", + "translation": "

ngAfterContentInit完毕,并且组件的视图已经初始化完毕时调用。只适用于组件。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called after every check of the component's view. Applies to components only.

", + "original": "

Called after every check of the component's view. Applies to components only.

", "translation": "

当组件视图每次执行变更检测时调用。只适用于组件。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Called once, before the instance is destroyed.

", + "original": "

Called once, before the instance is destroyed.

", "translation": "

只在实例被销毁前调用一次。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, @@ -4340,18 +4325,18 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Sets or overrides the provider for MyService to the MyMockService class.

\n

MyService 的服务提供商设置或改写为 MyMockService 类。

", + "original": "

Sets or overrides the provider for MyService to the MyMockService class.

", + "translation": "

MyService 的服务提供商设置或改写为 MyMockService 类。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Sets or overrides the provider for MyService to the myFactory factory function.

\n

MyService 的服务提供商设置或改写为 myFactory 工厂函数。

", + "original": "

Sets or overrides the provider for MyService to the myFactory factory function.

", + "translation": "

MyService 的服务提供商设置或改写为 myFactory 工厂函数。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Sets or overrides the provider for MyValue to the value 41.

\n

MyValue 的服务提供商改写为一个特定的值 41

", + "original": "

Sets or overrides the provider for MyValue to the value 41.

", + "translation": "

MyValue 的服务提供商改写为一个特定的值 41

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -4360,48 +4345,48 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

", + "original": "

Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

", "translation": "

为该应用配置路由。支持静态、参数化、重定向和通配符路由。也支持自定义路由数据和解析(resolve)函数。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Marks the location to load the component of the active route.

", + "original": "

Marks the location to load the component of the active route.

", "translation": "

标记出一个位置,用来加载活动路由的组件。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

\n

使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。

", + "original": "

Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

", + "translation": "

使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

The provided classes are added to the element when the routerLink becomes the current active route.

\n

routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。

", + "original": "

The provided classes are added to the element when the routerLink becomes the current active route.

", + "translation": "

routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

\n

用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise

", + "original": "

An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

", + "translation": "

用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -15984,11 +15969,6 @@ "translation": "应用的文件结构是这样的:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, - { - "original": "", - "translation": "Try the example:\n试试这个例子:", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" - }, { "original": "## Resolve directive conflicts", "translation": "## 解决指令冲突", @@ -17700,8 +17680,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

", - "translation": "非纯 AsyncPipe", + "original": "

The impure AsyncPipe

", + "translation": "

非纯 AsyncPipe

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17900,8 +17880,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤1. 设置开发环境", + "original": "

Step 1. Set up the Development Environment

", + "translation": "

步骤1. 设置开发环境

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17925,8 +17905,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤2. 创建新项目", + "original": "

Step 2. Create a new project

", + "translation": "

步骤2. 创建新项目

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17945,8 +17925,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤3. 启动开发服务器", + "original": "

Step 3: Serve the application

", + "translation": "

步骤3. 启动开发服务器

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17970,8 +17950,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤4. 编辑我们的第一个Angular组件", + "original": "

Step 4: Edit your first Angular component

", + "translation": "

步骤4. 编辑我们的第一个Angular组件

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -23405,8 +23385,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "举报漏洞", + "original": "

Reporting vulnerabilities

", + "translation": "

举报漏洞

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23420,8 +23400,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "最佳实践", + "original": "

Best practices

", + "translation": "

最佳实践

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23575,8 +23555,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "信任安全值", + "original": "

Trusting safe values

", + "translation": "

信任安全值

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23605,8 +23585,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "HTTP级别的漏洞", + "original": "

HTTP-level vulnerabilities

", + "translation": "

HTTP级别的漏洞

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23615,8 +23595,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "跨站请求伪造(XSRF)", + "original": "

Cross-site request forgery

", + "translation": "

跨站请求伪造(XSRF)

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23665,8 +23645,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "跨站脚本包含(XSSI)", + "original": "

Cross-site script inclusion (XSSI)

", + "translation": "

跨站脚本包含(XSSI)

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23690,8 +23670,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

", - "translation": "审计Angular应用程序", + "original": "

Auditing Angular applications

", + "translation": "

审计Angular应用程序

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -27019,11 +26999,6 @@ "translation": "**为何?** Angular 注入器是层次化的。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md" }, - { - "original": "
", - "translation": "**Why?** When providing the service to a top level component, \nthat instance is shared and available to all child components of that top level component.**为何?**在顶层组件提供服务时,该服务实例在所有子组件中可见并共享。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md" - }, { "original": "**Why?** This is ideal when a service is sharing methods or state.", "translation": "**为何?**服务是共享方法或状态的理想载体。", @@ -27679,6 +27654,21 @@ "translation": "样式", "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md" }, + { + "original": "Event", + "translation": "事件", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md" + }, + { + "original": "Two-way", + "translation": "双向", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md" + }, + { + "original": "Two-way", + "translation": "双向", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md" + }, { "original": "Binding types other than interpolation have a **target name** to the left of the equal sign,\neither surrounded by punctuation (`[]`, `()`) or preceded by a prefix (`bind-`, `on-`, `bindon-`).", "translation": "除了插值表达式之外的绑定类型,在等号左边是**目标名**,\n 无论是包在括号中 (`[]`、`()`) 还是用前缀形式 (`bind-`、`on-`、`bindon-`) 。", @@ -30064,11 +30054,6 @@ "translation": "与其怀疑测试工具会不会执行变更检测,本章中的例子**总是显式**调用`detectChanges()`。\n即使是在不需要的时候,频繁调用`detectChanges()`没有任何什么坏处。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md" }, - { - "original": "
", - "translation": "回到顶部", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md" - }, { "original": "## Test a component with an external template", "translation": "## 测试带有外部模板的组件", @@ -30204,11 +30189,6 @@ "translation": "这样做也没坏处,如果你将来可能会把模板重构到独立的文件中去,那就可以调用`compileComponents`。\n不过本章中的这些测试只会在必要时才调用`compileComponents`。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md" }, - { - "original": "", - "translation": "回到顶部", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md" - }, { "original": "## Test a component with a dependency", "translation": "## 测试有依赖的组件", @@ -31114,11 +31094,6 @@ "translation": "这里是一些更多的`HeroDetailComponent`测试程序,进一步的展示了这一点。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md" }, - { - "original": "", - "translation": "回到顶部", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md" - }, { "original": "## Setup with module imports", "translation": "## 模块导入imports的配置", @@ -34705,8 +34680,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: Node.js", + "original": "

Prerequisite: Node.js

", + "translation": "

前提条件: Node.js

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34720,8 +34695,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: Visual Studio 2015 Update 3", + "original": "

Prerequisite: Visual Studio 2015 Update 3

", + "translation": "

前提条件: Visual Studio 2015 Update 3

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34735,8 +34710,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: 配置External Web tools", + "original": "

Prerequisite: Configure External Web tools

", + "translation": "

前提条件: 配置External Web tools

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34775,8 +34750,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: 安装TypeScript 2.2 for Visual Studio 2015", + "original": "

Prerequisite: Install TypeScript 2.2 for Visual Studio 2015

", + "translation": "

前提条件: 安装TypeScript 2.2 for Visual Studio 2015

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34810,8 +34785,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第一步: 现在“快速上手”文件", + "original": "

Step 1: Download the QuickStart files

", + "translation": "

第一步: 现在“快速上手”文件

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34820,8 +34795,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第二步:创建Visual Studio ASP.net项目", + "original": "

Step 2: Create the Visual Studio ASP.NET project

", + "translation": "

第二步:创建Visual Studio ASP.net项目

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34855,8 +34830,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第三步: 把“快速上手”的文件复制到ASP.NET项目所在的目录", + "original": "

Step 3: Copy the QuickStart files into the ASP.NET project folder

", + "translation": "

第三步: 把“快速上手”的文件复制到ASP.NET项目所在的目录

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -34920,8 +34895,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第五步:构建和运行应用", + "original": "

Step 5: Build and run the app

", + "translation": "

第五步:构建和运行应用

", "sourceFile": "/Users/twer/private/GDE/content-1/guide/visual-studio-2015.md" }, { @@ -35744,21 +35719,6 @@ "translation": "Angular 是一个开发平台。它能帮你更轻松的构建 Web 应用。Angular 集声明式模板、依赖注入、端到端工具和一些最佳实践于一身,为你解决开发方面的各种挑战。Angular 为开发者提升构建 Web、手机或桌面应用的能力。", "sourceFile": "/Users/twer/private/GDE/content-1/marketing/docs.md" }, - { - "original": "
", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-1/marketing/docs.md" - }, - { - "original": "", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-1/marketing/docs.md" - }, - { - "original": "", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-1/marketing/docs.md" - }, { "original": "## Assumptions", "translation": "## 基本假设", @@ -35954,11 +35914,6 @@ "translation": "现在就开始构建一个简单的[英雄编辑器](tutorial/toh-pt1 \"英雄编辑器\")吧!", "sourceFile": "/Users/twer/private/GDE/content-1/tutorial/index.md" }, - { - "original": "
", - "translation": "### 阅读指南(译者)", - "sourceFile": "/Users/twer/private/GDE/content-1/tutorial/toh-pt1.md" - }, { "original": "## Setup to develop locally", "translation": "## 为本地开发搭建环境", diff --git a/aio/tools/translator/dict-2.json b/aio/tools/translator/dict-2.json index 0e90375173..5064cb1bd4 100644 --- a/aio/tools/translator/dict-2.json +++ b/aio/tools/translator/dict-2.json @@ -1289,11 +1289,6 @@ "translation": "## 概览", "sourceFile": "/Users/twer/private/GDE/content-2/guide/aot-compiler.md" }, - { - "original": "", - "translation": "Angular应用主要包含组件和它们的HTML模板。\n在浏览器可以渲染应用之前,组件和模板必须要被**Angular编译器**转换为可以执行的JavaScript。", - "sourceFile": "/Users/twer/private/GDE/content-2/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)。", @@ -1604,11 +1599,6 @@ "translation": "JavaScript 中,每个_文件_是一个模块,文件中定义的所有对象都从属于那个模块。\n通过`export`关键字,模块可以把它的某些对象声明为公共的。\n其它 JavaScript 模块可以使用*import 语句*来访问这些公共对象。", "sourceFile": "/Users/twer/private/GDE/content-2/guide/architecture.md" }, - { - "original": "
", - "translation": "Learn more about the JavaScript module system on the web.\n学习更多关于 JavaScript 模块的知识。", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/architecture.md" - }, { "original": "These are two different and _complementary_ module systems. Use them both to write your apps.", "translation": "这两个模块化系统是互补的,我们在写程序时都会用到。", @@ -1654,11 +1644,6 @@ "translation": "这两个系统比较容易混淆,因为它们共享相同的词汇 “imports” 和 “exports”。不过没关系,先放一放,随着时间和经验的增长,自然就清楚了。", "sourceFile": "/Users/twer/private/GDE/content-2/guide/architecture.md" }, - { - "original": "
", - "translation": "Learn more from the [NgModules](guide/ngmodule) page.\n更多信息,见 [Angular 模块](guide/ngmodule)。", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/architecture.md" - }, { "original": "## Components", "translation": "## 组件", @@ -3630,42 +3615,42 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Bootstraps the app, using the root component from the specified NgModule.

\n

NgModule 中指定的根组件进行启动。

", + "original": "

Bootstraps the app, using the root component from the specified NgModule.

", + "translation": "

NgModule 中指定的根组件进行启动。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "\n\n", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "", - "translation": "

NgModules

", + "original": "

NgModules

", "translation": "

Angular 模块

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Defines a module that contains components, directives, pipes, and providers.

", + "original": "

Defines a module that contains components, directives, pipes, and providers.

", "translation": "

定义一个模块,其中可以包含组件、指令、管道和服务提供商。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of components, directives, and pipes that belong to this module.

", + "original": "

List of components, directives, and pipes that belong to this module.

", "translation": "

属于当前模块的组件、指令和管道的列表。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of modules to import into this module. Everything from the imported modules\nis available to declarations of this module.

", + "original": "

List of modules to import into this module. Everything from the imported modules\nis available to declarations of this module.

", "translation": "

本模块所导入的模块列表

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of components, directives, and pipes visible to modules that import this module.

", + "original": "

List of components, directives, and pipes visible to modules that import this module.

", "translation": "

那些导入了本模块的模块所能看到的组件、指令和管道的列表

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of dependency injection providers visible both to the contents of this module and to importers of this module.

", + "original": "

List of dependency injection providers visible both to the contents of this module and to importers of this module.

", "translation": "

依赖注入提供商的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of components to bootstrap when this module is bootstrapped.

", + "original": "

List of components to bootstrap when this module is bootstrapped.

", "translation": "

当本模块启动时,随之启动的组件列表。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, @@ -3675,73 +3660,73 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds property value to the result of expression firstName.

\n

value属性绑定到表达式firstName

", + "original": "

Binds property value to the result of expression firstName.

", + "translation": "

value属性绑定到表达式firstName

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds attribute role to the result of expression myAriaRole.

\n

把属性(Attribute)role绑定到表达式myAriaRole的结果。

", + "original": "

Binds attribute role to the result of expression myAriaRole.

", + "translation": "

把属性(Attribute)role绑定到表达式myAriaRole的结果。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

\n

根据isDelightful表达式的结果是否为真,决定CSS类extra-sparkle是否出现在当前元素上。

", + "original": "

Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

", + "translation": "

根据isDelightful表达式的结果是否为真,决定CSS类extra-sparkle是否出现在当前元素上。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds style property width to the result of expression mySize in pixels. Units are optional.

\n

把CSS样式属性width的px(像素)值绑定到表达式mySize的结果。单位是可选的。

", + "original": "

Binds style property width to the result of expression mySize in pixels. Units are optional.

", + "translation": "

把CSS样式属性width的px(像素)值绑定到表达式mySize的结果。单位是可选的。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

\n

当这个按钮元素(及其子元素)上的click事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。

", + "original": "

Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

", + "translation": "

当这个按钮元素(及其子元素)上的click事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds a property to an interpolated string, for example, \"Hello Seabiscuit\". Equivalent to:\n<div [title]=\"'Hello ' + ponyName\">

\n

把一个属性绑定到插值字符串(如\"Hello Seabiscuit\")。这种写法等价于<div [title]=\"'Hello ' + ponyName\">

", + "original": "

Binds a property to an interpolated string, for example, \"Hello Seabiscuit\". Equivalent to: <div [title]=\"'Hello ' + ponyName\">

", + "translation": "

把一个属性绑定到插值字符串(如\"Hello Seabiscuit\")。这种写法等价于<div [title]=\"'Hello ' + ponyName\">

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds text content to an interpolated string, for example, \"Hello Seabiscuit\".

", + "original": "

Binds text content to an interpolated string, for example, \"Hello Seabiscuit\".

", "translation": "

把文本内容绑定到插值字符串(如\"Hello Seabiscuit\")

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Sets up two-way data binding. Equivalent to: <my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

\n

设置双向绑定。等价于<my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

", + "original": "

Sets up two-way data binding. Equivalent to: <my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

", + "translation": "

设置双向绑定。等价于<my-cmp [title]=\"name\" (titleChange)=\"name=$event\">

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

\n

创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。

", + "original": "

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

", + "translation": "

创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

The * symbol turns the current element into an embedded template. Equivalent to:\n<template [myUnless]=\"myExpression\"><p>...</p></template>

\n

星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>

", + "original": "

The * symbol turns the current element into an embedded template. Equivalent to: <template [myUnless]=\"myExpression\"><p>...</p></template>

", + "translation": "

星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

\n

使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻

", + "original": "

Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

", + "translation": "

使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

\n

安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined

", + "original": "

The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

", + "translation": "

安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

\n

模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。

", + "original": "

An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

", + "translation": "

模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An <svg> root element is detected as an SVG element automatically, without the prefix.

\n

<svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。

", + "original": "

An <svg> root element is detected as an SVG element automatically, without the prefix.

", + "translation": "

<svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { @@ -3750,23 +3735,23 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Removes or recreates a portion of the DOM tree based on the showSection expression.

\n

根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。

", + "original": "

Removes or recreates a portion of the DOM tree based on the showSection expression.

", + "translation": "

根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

", + "original": "

Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

", "translation": "

把li元素及其内容变成一个模板,并使用这个模板为列表中的每一个条目实例化一个视图。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

\n

根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。

", + "original": "

Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

", + "translation": "

根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

\n

根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。

", + "original": "

Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

", + "translation": "

根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { @@ -3775,7 +3760,7 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Provides two-way data-binding, parsing, and validation for form controls.

", + "original": "

Provides two-way data-binding, parsing, and validation for form controls.

", "translation": "

为表单控件提供双向数据绑定、解析和验证功能。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, @@ -3785,22 +3770,22 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Declares that a class is a component and provides metadata about the component.

", + "original": "

Declares that a class is a component and provides metadata about the component.

", "translation": "

声明一个类是组件,并提供该组件的元数据。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Declares that a class is a directive and provides metadata about the directive.

", + "original": "

Declares that a class is a directive and provides metadata about the directive.

", "translation": "

声明一个类是指令,并提供该指令的元数据。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Declares that a class is a pipe and provides metadata about the pipe.

", + "original": "

Declares that a class is a pipe and provides metadata about the pipe.

", "translation": "

声明一个类是管道,并提供该管道的元数据。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

", + "original": "

Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class.

", "translation": "

声明一个类具有一些依赖,当依赖注入器试图创建该类的实例时,应该把这些依赖注入到该类的构造函数中。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, @@ -3810,8 +3795,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Specifies a CSS selector that identifies this directive within a template. Supported selectors include element,\n[attribute], .class, and :not().

\n

指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()

", + "original": "

Specifies a CSS selector that identifies this directive within a template. Supported selectors include element, [attribute], .class, and :not().

", + "translation": "

指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { @@ -3820,7 +3805,7 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of dependency injection providers for this directive and its children.

", + "original": "

List of dependency injection providers for this directive and its children.

", "translation": "

该指令及其子指令的依赖注入提供商列表。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, @@ -3830,27 +3815,22 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "", - "translation": "

\n@Component extends @Directive,\nso the @Directive configuration applies to components as well

\n

@Component 继承自 @Directive,因此 @Directive 的配置也能用于 @Component

", + "original": "

If set, the templateUrl and styleUrl are resolved relative to the component.

", + "translation": "

如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "", - "translation": "

If set, the templateUrl and styleUrl are resolved relative to the component.

\n

如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。

", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" - }, - { - "original": "

List of dependency injection providers scoped to this component's view.

", + "original": "

List of dependency injection providers scoped to this component's view.

", "translation": "

依赖注入提供商列表,但它们的范围被限定为当前组件的视图。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Inline template or external template URL of the component's view.

", + "original": "

Inline template or external template URL of the component's view.

", "translation": "

当前组件视图的内联模板或外部模板的 URL 。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

List of inline CSS styles or external stylesheet URLs for styling the component’s view.

", + "original": "

List of inline CSS styles or external stylesheet URLs for styling the component’s view.

", "translation": "

用于为当前组件的视图提供样式的内联 CSS 或外部样式表 URL 的列表。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, @@ -3860,43 +3840,43 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Declares an input property that you can update via property binding (example:\n<my-cmp [myProperty]=\"someExpression\">).

\n

声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]=\"someExpression\">

", + "original": "

Declares an input property that you can update via property binding (example: <my-cmp [myProperty]=\"someExpression\">).

", + "translation": "

声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]=\"someExpression\">

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)=\"doSomething()\">).

\n

声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)=\"doSomething()\">)。

", + "original": "

Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)=\"doSomething()\">).

", + "translation": "

声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)=\"doSomething()\">)。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

\n

把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。

", + "original": "

Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

", + "translation": "

把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

\n

用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)

", + "original": "

Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

", + "translation": "

用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

\n

把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。

", + "original": "

Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

", + "translation": "

把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

\n

把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上

", + "original": "

Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

", + "translation": "

把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

\n

把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。

", + "original": "

Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

", + "translation": "

把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

\n

把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。

", + "original": "

Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

", + "translation": "

把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { @@ -3910,47 +3890,47 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

", + "original": "

Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

", "translation": "

在任何其它生命周期钩子之前调用。可以用它来注入依赖项,但不要在这里做正事。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called after every change to input properties and before processing content or child views.

\n

每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。

", + "original": "

Called after every change to input properties and before processing content or child views.

", + "translation": "

每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called after the constructor, initializing input properties, and the first call to ngOnChanges.

\n

在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。

", + "original": "

Called after the constructor, initializing input properties, and the first call to ngOnChanges.

", + "translation": "

在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

", + "original": "

Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

", "translation": "

每当对组件或指令的输入属性进行变更检测时就会调用。可以用它来扩展变更检测逻辑,执行自定义的检测逻辑。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called after ngOnInit when the component's or directive's content has been initialized.

\n

ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。

", + "original": "

Called after ngOnInit when the component's or directive's content has been initialized.

", + "translation": "

ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called after every check of the component's or directive's content.

\n

每当组件或指令的内容(ng-content)做变更检测时调用。

", + "original": "

Called after every check of the component's or directive's content.

", + "translation": "

每当组件或指令的内容(ng-content)做变更检测时调用。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.

\n

ngAfterContentInit完毕,并且组件的视图已经初始化完毕时调用。只适用于组件。

", + "original": "

Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.

", + "translation": "

ngAfterContentInit完毕,并且组件的视图已经初始化完毕时调用。只适用于组件。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called after every check of the component's view. Applies to components only.

", + "original": "

Called after every check of the component's view. Applies to components only.

", "translation": "

当组件视图每次执行变更检测时调用。只适用于组件。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Called once, before the instance is destroyed.

", + "original": "

Called once, before the instance is destroyed.

", "translation": "

只在实例被销毁前调用一次。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, @@ -3960,18 +3940,18 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Sets or overrides the provider for MyService to the MyMockService class.

\n

MyService 的服务提供商设置或改写为 MyMockService 类。

", + "original": "

Sets or overrides the provider for MyService to the MyMockService class.

", + "translation": "

MyService 的服务提供商设置或改写为 MyMockService 类。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Sets or overrides the provider for MyService to the myFactory factory function.

\n

MyService 的服务提供商设置或改写为 myFactory 工厂函数。

", + "original": "

Sets or overrides the provider for MyService to the myFactory factory function.

", + "translation": "

MyService 的服务提供商设置或改写为 myFactory 工厂函数。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Sets or overrides the provider for MyValue to the value 41.

\n

MyValue 的服务提供商改写为一个特定的值 41

", + "original": "

Sets or overrides the provider for MyValue to the value 41.

", + "translation": "

MyValue 的服务提供商改写为一个特定的值 41

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { @@ -3980,48 +3960,48 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

", + "original": "

Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

", "translation": "

为该应用配置路由。支持静态、参数化、重定向和通配符路由。也支持自定义路由数据和解析(resolve)函数。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Marks the location to load the component of the active route.

", + "original": "

Marks the location to load the component of the active route.

", "translation": "

标记出一个位置,用来加载活动路由的组件。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

\n

使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。

", + "original": "

Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

", + "translation": "

使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

The provided classes are added to the element when the routerLink becomes the current active route.

\n

routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。

", + "original": "

The provided classes are added to the element when the routerLink becomes the current active route.

", + "translation": "

routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

\n

用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise

", + "original": "

An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

", + "translation": "

用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { - "original": "

An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

\n

用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", + "original": "

An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

", + "translation": "

用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/cheatsheet.md" }, { @@ -8124,11 +8104,6 @@ "translation": "修改之后,这个表单的核心是这样的:", "sourceFile": "/Users/twer/private/GDE/content-2/guide/forms.md" }, - { - "original": "
", - "translation": "* Each input element has an `id` property that is used by the `label` element's `for` attribute\nto match the label to its input control.\n每个 input 元素都有`id`属性,`label`元素的`for`属性用它来匹配到对应的输入控件。* Each input element has a `name` property that is required by Angular forms to register the control with the form.", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/forms.md" - }, { "original": "If you run the app now and change every hero model property, the form might display like this:", "translation": "如果现在运行本应用,修改 Hero 模型的每个属性,表单是这样的:", @@ -14159,11 +14134,6 @@ "translation": "[**yarn**](https://yarnpkg.com/en/) 是另一个下载和安装 npm 包的工具。\n当创建新项目时,Angular CLI 默认使用 `yarn` 来安装 npm 包。", "sourceFile": "/Users/twer/private/GDE/content-2/guide/npm-packages.md" }, - { - "original": "
", - "translation": "Node.js and npm are essential to Angular development. \nNode.js和npm是做Angular开发的基础。", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/npm-packages.md" - }, { "original": "[Get them now](https://docs.npmjs.com/getting-started/installing-node \"Installing Node.js and updating npm\")\nif they're not already installed on your machine.", "translation": "如果你的电脑上还没有装过,请 [立即获取它们](https://docs.npmjs.com/getting-started/installing-node \"Installing Node.js and updating npm\")!", @@ -14810,8 +14780,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/pipes.md" }, { - "original": "

", - "translation": "非纯 AsyncPipe", + "original": "

The impure AsyncPipe

", + "translation": "

非纯 AsyncPipe

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/pipes.md" }, { @@ -15010,8 +14980,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤1. 设置开发环境", + "original": "

Step 1. Set up the Development Environment

", + "translation": "

步骤1. 设置开发环境

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { @@ -15035,8 +15005,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤2. 创建新项目", + "original": "

Step 2. Create a new project

", + "translation": "

步骤2. 创建新项目

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { @@ -15055,8 +15025,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤3. 启动开发服务器", + "original": "

Step 3: Serve the application

", + "translation": "

步骤3. 启动开发服务器

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { @@ -15080,8 +15050,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { - "original": "

", - "translation": "步骤4. 编辑我们的第一个Angular组件", + "original": "

Step 4: Edit your first Angular component

", + "translation": "

步骤4. 编辑我们的第一个Angular组件

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/quickstart.md" }, { @@ -20515,8 +20485,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "举报漏洞", + "original": "

Reporting vulnerabilities

", + "translation": "

举报漏洞

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -20530,8 +20500,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "最佳实践", + "original": "

Best practices

", + "translation": "

最佳实践

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -20685,8 +20655,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "信任安全值", + "original": "

Trusting safe values

", + "translation": "

信任安全值

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -20715,8 +20685,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "HTTP级别的漏洞", + "original": "

HTTP-level vulnerabilities

", + "translation": "

HTTP级别的漏洞

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -20725,8 +20695,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "跨站请求伪造(XSRF)", + "original": "

Cross-site request forgery

", + "translation": "

跨站请求伪造(XSRF)

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -20775,8 +20745,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "跨站脚本包含(XSSI)", + "original": "

Cross-site script inclusion (XSSI)

", + "translation": "

跨站脚本包含(XSSI)

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -20800,8 +20770,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { - "original": "

", - "translation": "审计Angular应用程序", + "original": "

Auditing Angular applications

", + "translation": "

审计Angular应用程序

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md" }, { @@ -24129,11 +24099,6 @@ "translation": "**为何?** Angular 注入器是层次化的。", "sourceFile": "/Users/twer/private/GDE/content-2/guide/styleguide.md" }, - { - "original": "
", - "translation": "**Why?** When providing the service to a top level component, \nthat instance is shared and available to all child components of that top level component.**为何?**在顶层组件提供服务时,该服务实例在所有子组件中可见并共享。", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/styleguide.md" - }, { "original": "**Why?** This is ideal when a service is sharing methods or state.", "translation": "**为何?**服务是共享方法或状态的理想载体。", @@ -24789,6 +24754,21 @@ "translation": "样式", "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md" }, + { + "original": "Event", + "translation": "事件", + "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md" + }, + { + "original": "Two-way", + "translation": "双向", + "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md" + }, + { + "original": "Two-way", + "translation": "双向", + "sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md" + }, { "original": "Binding types other than interpolation have a **target name** to the left of the equal sign,\neither surrounded by punctuation (`[]`, `()`) or preceded by a prefix (`bind-`, `on-`, `bindon-`).", "translation": "除了插值表达式之外的绑定类型,在等号左边是**目标名**,\n 无论是包在括号中 (`[]`、`()`) 还是用前缀形式 (`bind-`、`on-`、`bindon-`) 。", @@ -27124,11 +27104,6 @@ "translation": "与其怀疑测试工具会不会执行变更检测,本章中的例子**总是显式**调用`detectChanges()`。\n即使是在不需要的时候,频繁调用`detectChanges()`没有任何什么坏处。", "sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md" }, - { - "original": "
", - "translation": "回到顶部", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md" - }, { "original": "## Test a component with an external template", "translation": "## 测试带有外部模板的组件", @@ -27264,11 +27239,6 @@ "translation": "这样做也没坏处,如果你将来可能会把模板重构到独立的文件中去,那就可以调用`compileComponents`。\n不过本章中的这些测试只会在必要时才调用`compileComponents`。", "sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md" }, - { - "original": "
", - "translation": "回到顶部", - "sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md" - }, { "original": "## Test a component with a dependency", "translation": "## 测试有依赖的组件", @@ -31765,8 +31735,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: Node.js", + "original": "

Prerequisite: Node.js

", + "translation": "

前提条件: Node.js

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31780,8 +31750,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: Visual Studio 2015 Update 3", + "original": "

Prerequisite: Visual Studio 2015 Update 3

", + "translation": "

前提条件: Visual Studio 2015 Update 3

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31795,8 +31765,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: 配置External Web tools", + "original": "

Prerequisite: Configure External Web tools

", + "translation": "

前提条件: 配置External Web tools

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31835,8 +31805,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "前提条件: 安装TypeScript 2.2 for Visual Studio 2015", + "original": "

Prerequisite: Install TypeScript 2.2 for Visual Studio 2015

", + "translation": "

前提条件: 安装TypeScript 2.2 for Visual Studio 2015

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31870,8 +31840,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第一步: 现在“快速上手”文件", + "original": "

Step 1: Download the QuickStart files

", + "translation": "

第一步: 现在“快速上手”文件

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31880,8 +31850,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第二步:创建Visual Studio ASP.net项目", + "original": "

Step 2: Create the Visual Studio ASP.NET project

", + "translation": "

第二步:创建Visual Studio ASP.net项目

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31915,8 +31885,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第三步: 把“快速上手”的文件复制到ASP.NET项目所在的目录", + "original": "

Step 3: Copy the QuickStart files into the ASP.NET project folder

", + "translation": "

第三步: 把“快速上手”的文件复制到ASP.NET项目所在的目录

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -31980,8 +31950,8 @@ "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { - "original": "

", - "translation": "第五步:构建和运行应用", + "original": "

Step 5: Build and run the app

", + "translation": "

第五步:构建和运行应用

", "sourceFile": "/Users/twer/private/GDE/content-2/guide/visual-studio-2015.md" }, { @@ -32804,21 +32774,6 @@ "translation": "Angular 是一个开发平台。它能帮你更轻松的构建 Web 应用。Angular 集声明式模板、依赖注入、端到端工具和一些最佳实践于一身,为你解决开发方面的各种挑战。Angular 为开发者提升构建 Web、手机或桌面应用的能力。", "sourceFile": "/Users/twer/private/GDE/content-2/marketing/docs.md" }, - { - "original": "
", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-2/marketing/docs.md" - }, - { - "original": "", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-2/marketing/docs.md" - }, - { - "original": "", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-2/marketing/docs.md" - }, { "original": "## Assumptions", "translation": "## 基本假设", diff --git a/aio/tools/translator/extractor.ts b/aio/tools/translator/extractor.ts index 8f4fdf8f23..89d3ac0962 100644 --- a/aio/tools/translator/extractor.ts +++ b/aio/tools/translator/extractor.ts @@ -5,8 +5,10 @@ import { isOnlyBeginTag, normalizeLines, originalIsNotChinese, - originalIsNotAlertDivTag, + originalIsNotCodeExampleTag, originalIsNotOnlyBeginTag, + originalIsNotPureCloseTag, + originalIsNotSpecialDivTag, translationHasNotCodeExample, } from './utils'; @@ -49,7 +51,9 @@ export function gatherTranslations(text: string): DictEntry[] { .filter(isNotCnPages) .filter(translationHasNotCodeExample) .filter(originalIsNotChinese) - .filter(originalIsNotAlertDivTag) + .filter(originalIsNotSpecialDivTag) + .filter(originalIsNotCodeExampleTag) + .filter(originalIsNotPureCloseTag) .filter(originalIsNotOnlyBeginTag) .map(purifyEntry); } diff --git a/aio/tools/translator/translate.ts b/aio/tools/translator/translate.ts index 1b87ce13e9..388c465ee7 100644 --- a/aio/tools/translator/translate.ts +++ b/aio/tools/translator/translate.ts @@ -5,7 +5,7 @@ import { dirs } from './dirs'; import { listMarkdownFiles } from './extractor'; import { indentOf, normalizeLines, repeat } from './utils'; -export const dict = require('./dict-3.json') as DictEntry[]; +export const dict = require('./dict-2.json') as DictEntry[]; export function lookup(english: string, filename: RegExp = /.*/): DictEntry[] { const entries = dict diff --git a/aio/tools/translator/utils.spec.ts b/aio/tools/translator/utils.spec.ts index 8b212c1f10..8fda4f0e56 100644 --- a/aio/tools/translator/utils.spec.ts +++ b/aio/tools/translator/utils.spec.ts @@ -89,24 +89,14 @@ def `); }); - it('拆解多行的 h\\d 标签', function () { + it('把多行 hn 处理成单行', function () { const lines = normalizeLines(` - a -

- line +

- b `); expect(lines).eql(` - a - -

- - line - -

- - b + `); }); diff --git a/aio/tools/translator/utils.ts b/aio/tools/translator/utils.ts index df3f0537a2..b9491f983f 100644 --- a/aio/tools/translator/utils.ts +++ b/aio/tools/translator/utils.ts @@ -9,8 +9,16 @@ export function originalIsNotChinese(entry: DictEntry): boolean { return !isTranslation(entry.original); } -export function originalIsNotAlertDivTag(entry: DictEntry): boolean { - return !/^
\n]*>$/.test(entry.original); +} + +export function originalIsNotCodeExampleTag(entry: DictEntry): boolean { + return !/^<\/?code-example\b[^>\n]*>$/.test(entry.original); +} + +export function originalIsNotPureCloseTag(entry: DictEntry): boolean { + return !/^<\/(td|a|div)>$/.test(entry.original); } export function isOnlyBeginTag(text: string) { @@ -48,9 +56,11 @@ export function normalizeLines(text: string): string { text = text.replace(blockElementPattern, '\n\n'); const hxPattern = /(\n *#+ .*)(?=\n)/g; text = text.replace(hxPattern, '\n$1\n'); + const hxMultilinePattern = /(\n *)<(h\d+)([^>\n]*)>\n+ *(.*)\n+ *(<\/\2>)(?=\n)/g; + text = text.replace(hxMultilinePattern, '\n$1<$2$3>$4\n'); const oneLinePairedTagPattern = /\n( *)<(p|div|h\d+|code-example|section)( ?[^>\n]*)>([^<\n]*)<\/\2>( *)(?=\n)/g; text = text.replace(oneLinePairedTagPattern, '\n\n$1<$2$3>$4$5\n'); - const oneLineThTdTagPattern = /\n( *)<(th|td|li)( ?[^>\n]*)>(.*)<\/\2>( *)(?=\n)/g; + const oneLineThTdTagPattern = /\n( *)(?!`)<(th|td|li)( ?[^>\n]*)>(?!`)(.*)<\/\2>( *)(?=\n)/g; text = text.replace(oneLineThTdTagPattern, '\n\n$1<$2$3>\n\n$1 $4\n\n$1$5\n'); const oneLineCommentPattern = /\n( *)()( *)(?=\n)/g; text = text.replace(oneLineCommentPattern, '\n\n$1$2$3\n'); @@ -73,10 +83,10 @@ export function normalizeLines(text: string): string { const trTagPattern = /( *)(\n]*>)(.*)(<\/tr>)/g; text = text.replace(trTagPattern, '\n\n$1$2\n\n$1 $3\n\n$1$4\n\n'); - const thTdTagPattern = /( *)<(th|td)\b( *[^>\n]*)>(.*?)<\/\2>/g; + const thTdTagPattern = /( *)(?!`)<(th|td)\b( *[^>\n]*)>(?!`)([\s\S]*?)<\/\2>/g; text = text.replace(thTdTagPattern, '\n\n$1<$2$3>\n\n$1 $4\n\n$1\n\n'); - const blockTagPattern = /\n( *)<(\/?)(td|th|div|code-example|code-tabs|h\d+|p|tr)\b( *[^>\n]*)>( *)(?=\n)/g; + const blockTagPattern = /\n( *)(?!`)<(\/?)(td|th|div|code-example|code-tabs|h\d+|p|tr)\b( *[^>\n]*)>(?!`)( *)(?=\n)/g; text = text.replace(blockTagPattern, '\n\n$1<$2$3$4>$5\n'); const multiLineCodePattern = /\n( *)```(\w*)( *)(?=\n)/g;