` tags,\nfirst without a value (yielding the default color) and then with an assigned color value.",
"translation": "下面的代码把指令的`myHighlight`属性(Attribute)填加到两个`
`标签里,一个没有赋值,一个赋值了颜色。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4595,17 +4635,17 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "The *definition* object has a required property that specifies how to create the singleton instance of the service. In this case, the property.",
+ "original": "The *definition* object has a required property that specifies how to create the singleton instance of the service. In this case, the property.",
"translation": "该*定义*对象有一个必填属性(即`useValue`),用来标识该提供商会如何新建和返回该服务的单例对象。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "#### useValue — the *value provider*",
+ "original": "#### useValue—the *value provider*",
"translation": "#### useValue - *值-提供商",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "*Set the `useValue` property to a ***fixed value*** that the provider can return as the service instance (AKA, the \"dependency object\").",
+ "original": "Set the `useValue` property to a ***fixed value*** that the provider can return as the service instance (AKA, the \"dependency object\").",
"translation": "把一个***固定的值**,也就是该提供商可以将其作为依赖对象返回的值,赋给`useValue`属性。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4640,7 +4680,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "#### useClass — the *class provider*",
+ "original": "#### useClass—the *class provider*",
"translation": "#### useClass - *类-提供商*",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4660,7 +4700,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "The first provider is the *de-sugared*, expanded form of the most typical case in which the\nclass to be created (`HeroService`) is also the provider's dependency injection token. \nIt's in this long form to de-mystify the preferred short form.",
+ "original": "The first provider is the *de-sugared*, expanded form of the most typical case in which the\nclass to be created (`HeroService`) is also the provider's dependency injection token.\nIt's in this long form to de-mystify the preferred short form.",
"translation": "第一个提供商是*展开了语法糖的*,是一个典型情况的展开。一般来说,被新建的类(`HeroService`)同时也是该提供商的注入令牌。\n这里用完整形态来编写它,来反衬我们更喜欢的缩写形式。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4710,7 +4750,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "Behind the scenes,Angular actually sets the `logger` parameter to the full service registered under the `LoggingService` token \nwhich happens to be the `DateLoggerService` that was [provided above](guide/dependency-injection-in-action#useclass).",
+ "original": "Behind the scenes, Angular actually sets the `logger` parameter to the full service registered under the `LoggingService` token which happens to be the `DateLoggerService` that was [provided above](guide/dependency-injection-in-action#useclass).",
"translation": "实际上,Angular确实想把`logger`参数设置为注入器里`LoggerService`的完整版本。只是在之前的提供商注册里使用了`useClass`,\n所以该完整版本被`DateLoggerService`取代了。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4720,7 +4760,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "#### _useFactory_— the *factory provider*",
+ "original": "#### _useFactory_—the *factory provider*",
"translation": "#### useFactory - *工厂-提供商*",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4755,12 +4795,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "Angular supplies these arguments from injected values identified by \nthe two *tokens* in the `deps` array. \nThe two `deps` values are *tokens* that the injector uses\nto provide these factory function dependencies.",
+ "original": "Angular supplies these arguments from injected values identified by\nthe two *tokens* in the `deps` array.\nThe two `deps` values are *tokens* that the injector uses\nto provide these factory function dependencies.",
"translation": "Angular通过使用`deps`数组中的两个*令牌*,来识别注入的值,用来提供这些参数。这两个`deps`值是供注入器使用的*令牌*,用来提供工厂函数的依赖。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "After some undisclosed work, the function returns the string of names \nand Angular injects it into the `runnersUp` parameter of the `HeroOfTheMonthComponent`.",
+ "original": "After some undisclosed work, the function returns the string of names\nand Angular injects it into the `runnersUp` parameter of the `HeroOfTheMonthComponent`.",
"translation": "一些内部工作后,这个函数返回名字字符串,Angular将其注入到`HeroOfTheMonthComponent`组件的`runnersUp`参数里。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4775,13 +4815,13 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "Angular dependency injection is easiest when the provider *token* is a class\nthat is also the type of the returned dependency object , orwhat you usually call the *service*.",
+ "original": "Angular dependency injection is easiest when the provider *token* is a class\nthat is also the type of the returned dependency object, or what you usually call the *service*.",
"translation": "Angular依赖注入当*令牌*是类的时候是最简单的,该类同时也是返回的依赖对象的类型(通常直接称之为*服务*)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
"original": "But the token doesn't have to be a class and even when it is a class,\nit doesn't have to be the same type as the returned object.\nThat's the subject of the next section.",
- "translation": "但令牌不一定都是类,就算它是一个类,它也不一定都返回类型相同的对象。这是下一节的主题。\n{@a class-interface}",
+ "translation": "但令牌不一定都是类,就算它是一个类,它也不一定都返回类型相同的对象。这是下一节的主题。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
@@ -4865,7 +4905,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "The `InjectionToken` has these characteristics.\nYou encountered them twice in the *Hero of the Month* example, \nin the *title* value provider and in the *runnersUp* factory provider.",
+ "original": "The `InjectionToken` has these characteristics.\nYou encountered them twice in the *Hero of the Month* example,\nin the *title* value provider and in the *runnersUp* factory provider.",
"translation": "`InjectionToken`具有这些特征。在*Hero of the Month*例子中遇见它们两次,一个是*title*的值,一个是*runnersUp* 工厂提供商。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4876,7 +4916,7 @@
},
{
"original": "The type parameter, while optional, conveys the dependency's type to developers and tooling.\nThe token description is another developer aid.",
- "translation": "带类型(可选)的参数,向开发人员和开发工具揭示了该依赖的类型。\n令牌描述则通过另一种形式给开发人员提供帮助。",
+ "translation": "类型参数,虽然是可选的,但可以向开发者和开发工具传达类型信息。\n而且这个令牌的描述信息也可以为开发者提供帮助。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
@@ -4890,7 +4930,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "In this contrived example, `SortedHeroesComponent` inherits from `HeroesBaseComponent` \nto display a *sorted* list of heroes.",
+ "original": "In this contrived example, `SortedHeroesComponent` inherits from `HeroesBaseComponent`\nto display a *sorted* list of heroes.",
"translation": "在这个刻意生成的例子里,`SortedHeroesComponent`继承自`HeroesBaseComponent`,显示一个*被排序*的英雄列表。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -4995,7 +5035,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "A re-usable component might be a child of multiple components.\nImagine a component for rendering breaking news about a financial instrument.\nFor business reasons, this news component makes frequent calls \ndirectly into its parent instrument as changing market data streams by.",
+ "original": "A re-usable component might be a child of multiple components.\nImagine a component for rendering breaking news about a financial instrument.\nFor business reasons, this news component makes frequent calls\ndirectly into its parent instrument as changing market data streams by.",
"translation": "一个可复用的组件可能是多个组件的子级。想象一个用来渲染金融工具头条新闻的组件。由于商业原因,该新闻组件在实时变化的市场数据流过时,要频繁的直接调用其父级工具。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -5010,13 +5050,13 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "This isn't necessarily good design.\nThis example is examining *whether a component can \ninject its parent via the parent's base class",
+ "original": "This isn't necessarily good design.\nThis example is examining *whether a component can\ninject its parent via the parent's base class*.",
"translation": "*.这并不是好的设计。问题是*一个组件是否能通过它父组件的基类来注入它的父组件呢*?",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "The sample's `CraigComponent` explores this question. [Looking back](guide/dependency-injection-in-action#alex) ,\nyou see that the `Alex` component *extends* (*inherits*) from a class named `Base`.",
- "translation": "`CraigComponent`例子探究了这个问题。[往回看Alex]{#alex},我们看到`Alex`组件*扩展*(*派生*)自一个叫`Base`的类。",
+ "original": "The sample's `CraigComponent` explores this question. [Looking back](guide/dependency-injection-in-action#alex),\nyou see that the `Alex` component *extends* (*inherits*) from a class named `Base`.",
+ "translation": "`CraigComponent`例子探究了这个问题。[往回看Alex]{guide/dependency-injection-in-action#alex},我们看到`Alex`组件*扩展*(*派生*)自一个叫`Base`的类。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
@@ -5070,12 +5110,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "### Find the parent in a tree of parentswith _@SkipSelf()_",
+ "original": "### Find the parent in a tree of parents with _@SkipSelf()_",
"translation": "### 通过父级树找到父组件",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "Imagine one branch of a component hierarchy: *Alice* -> *Barry* -> *Carol*. \nBoth *Alice* and *Barry* implement the `Parent` *class-interface*.",
+ "original": "Imagine one branch of a component hierarchy: *Alice* -> *Barry* -> *Carol*.\nBoth *Alice* and *Barry* implement the `Parent` *class-interface*.",
"translation": "想象组件树中的一个分支为:*Alice* -> *Barry* -> *Carol*。*Alice*和*Barry*都实现了这个`Parent`*类-接口*。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -5160,7 +5200,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "The `AlexComponent` *should* implement `Parent` as a matter of proper style. \nIt doesn't in this example *only* to demonstrate that the code will compile and run without the interface",
+ "original": "The `AlexComponent` *should* implement `Parent` as a matter of proper style.\nIt doesn't in this example *only* to demonstrate that the code will compile and run without the interface",
"translation": "为了正确的代码风格,该`AlexComponent`*应该*实现`Parent`。在这个例子里它没有这样,只是为了演示在没有该接口的情况下,该代码仍会被正确编译并运行。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -5210,7 +5250,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
{
- "original": "This isn't usually a problem, especially if you adhere to the recommended *one class per file* rule.\nBut sometimes circular references are unavoidable. \nYou're in a bind when class 'A' refers to class 'B' and 'B' refers to 'A'.\nOne of them has to be defined first.",
+ "original": "This isn't usually a problem, especially if you adhere to the recommended *one class per file* rule.\nBut sometimes circular references are unavoidable.\nYou're in a bind when class 'A' refers to class 'B' and 'B' refers to 'A'.\nOne of them has to be defined first.",
"translation": "这通常不是一个问题,特别是当我们遵循*一个文件一个类*规则的时候。\n但是有时候循环引用可能不能避免。当一个类*A引用类B*,同时'B'引用'A'的时候,我们就陷入困境了:它们中间的某一个必须要先定义。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection-in-action.md"
},
@@ -5616,7 +5656,7 @@
},
{
"original": "## Summary",
- "translation": "## 总结",
+ "translation": "## 小结",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection.md"
},
{
@@ -5685,7 +5725,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection.md"
},
{
- "original": "If you combine the `HeroService` class with \nthe `HeroesComponent` in the same file,\n**define the component last**.\nIf you define the component before the service,\nyou'll get a runtime null reference error.",
+ "original": "If you combine the `HeroService` class with\nthe `HeroesComponent` in the same file,\n**define the component last**.\nIf you define the component before the service,\nyou'll get a runtime null reference error.",
"translation": "如果我们蔑视这个建议,并且 —— 比如说 —— 把`HeroService`和`HeroesComponent`组合在同一个文件里,\n **就得把组件定义放在最后面!**\n 如果把组件定义在了服务的前面,\n 在运行时抛出空指针错误。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dependency-injection.md"
},
@@ -5905,7 +5945,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/deployment.md"
},
{
- "original": "* [Apache](https://httpd.apache.org/): add a\n[rewrite rule](http://httpd.apache.org/docs/current/mod/mod_rewrite.html)\nto the `.htaccess` file as shown\n(https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/):",
+ "original": "* [Apache](https://httpd.apache.org/): add a\n[rewrite rule](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) to the `.htaccess` file as shown\n (https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/):",
"translation": "[Apache](https://httpd.apache.org/):在`.htaccess`文件中添加一个[重写规则](http://httpd.apache.org/docs/current/mod/mod_rewrite.html),\n代码如下([出处](https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/)):",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/deployment.md"
},
@@ -6165,7 +6205,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
- "original": "It might not look like the class has properties, but it does.\n The declaration of the constructor parameters takes advantage of a TypeScript shortcut.",
+ "original": "It might not look like the class has properties, but it does.\nThe declaration of the constructor parameters takes advantage of a TypeScript shortcut.",
"translation": "它可能看上去不像是有属性的类,但它确实有,利用的是 TypeScript 提供的简写形式 —— 用构造函数的参数直接定义属性。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
@@ -6180,18 +6220,18 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
- "original": "* Declares a constructor parameter and its type",
- "translation": "声明了一个构造函数参数及其类型",
+ "original": "* Declares a constructor parameter and its type.",
+ "translation": "声明了一个构造函数参数及其类型。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
- "original": "* Declares a public property of the same name",
- "translation": "声明了一个同名的公共属性",
+ "original": "* Declares a public property of the same name.",
+ "translation": "声明了一个同名的公共属性。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
- "original": "* Initializes that property with the corresponding argument when we \"new\" an instance of the class",
- "translation": "当我们`new`出该类的一个实例时,把该属性初始化为相应的参数值",
+ "original": "* Initializes that property with the corresponding argument when creating an instance of the class.",
+ "translation": "当我们`new`出该类的一个实例时,把该属性初始化为相应的参数值。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
@@ -6210,8 +6250,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
- "original": "Our display looks the same, but now we know much better what a hero really is.",
- "translation": "从显示上看还是一样,但现在我们知道了更多英雄信息。",
+ "original": "The display looks the same, but the code is clearer.",
+ "translation": "显示上还和以前一样,不过代码更清晰了。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
{
@@ -6289,6 +6329,11 @@
"translation": "下面是最终的代码:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/displaying-data.md"
},
+ {
+ "original": "## Navigation",
+ "translation": "## 导航",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/docs-style-guide.md"
+ },
{
"original": "# Dynamic Component Loader",
"translation": "# 动态组件加载器",
@@ -6306,7 +6351,7 @@
},
{
"original": "of the code in this cookbook.",
- "translation": "到
查看本烹饪书的源码。",
+ "translation": "到
查看本烹饪书的源码。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-component-loader.md"
},
{
@@ -6500,22 +6545,22 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
- "original": "Building handcrafted forms canbe costly and time-consuming,\nespecially if you need a great number of them, they're similar to each other, and they change frequently \nto meet rapidly changing business and regulatory requirements.",
+ "original": "Building handcrafted forms can be costly and time-consuming,\nespecially if you need a great number of them, they're similar to each other, and they change frequently\nto meet rapidly changing business and regulatory requirements.",
"translation": "有时候手动编写和维护表单所需工作量和时间会过大。特别是在需要编写大量表单时。表单都很相似,而且随着业务和监管需求的迅速变化,表单也要随之变化,这样维护的成本过高。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
- "original": "It may be more economical to create the forms dynamically, based on metadata that describes the business object model.",
+ "original": "It may be more economical to create the forms dynamically, based on\nmetadata that describes the business object model.",
"translation": "基于业务对象模型的元数据,动态创建表单可能会更划算。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
- "original": "This cookbook shows you how to use `formGroup` to dynamically \nrender a simple form with different control types and validation.\nIt's a primitive start.\nIt might evolve to support a much richer variety of questions, more graceful rendering, and superior user experience.\nAll such greatness has humble beginnings.",
+ "original": "This cookbook shows you how to use `formGroup` to dynamically\nrender a simple form with different control types and validation.\nIt's a primitive start.\nIt might evolve to support a much richer variety of questions, more graceful rendering, and superior user experience.\nAll such greatness has humble beginnings.",
"translation": "在此烹饪宝典中,我们会展示如何利用`formGroup`来动态渲染一个简单的表单,包括各种控件类型和验证规则。\n这个起点很简陋,但可以在这个基础上添加丰富多彩的问卷问题、更优美的渲染以及更卓越的用户体验。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
- "original": "The example in this cookbook is a dynamic form to build an \nonline application experience for heroes seeking employment.\nThe agency is constantly tinkering with the application process.\nYou can create the forms on the fly *without changing the application code*.",
+ "original": "The example in this cookbook is a dynamic form to build an\nonline application experience for heroes seeking employment.\nThe agency is constantly tinkering with the application process.\nYou can create the forms on the fly *without changing the application code*.",
"translation": "在本例中,我们使用动态表单,为正在找工作的英雄们创建一个在线申请表。英雄管理局会不断修改申请流程,我们要在*不修改应用代码*的情况下,动态创建这些表单。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
@@ -6526,7 +6571,7 @@
},
{
"original": "## Bootstrap",
- "translation": "## 程序启动",
+ "translation": "## 启动/引导 (bootstrap)",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
@@ -6616,7 +6661,7 @@
},
{
"original": "`formControlName` and `formGroup` are directives defined in\n`ReactiveFormsModule`. The templates can access these directives\ndirectly since you imported `ReactiveFormsModule` from `AppModule`.",
- "translation": "`formControlName`和`formGroup`是在`ReactiveFormsModule`中定义的指令。我们之所以能在模板中使用它们,是因为我们往`AppModule`中导入了`ReactiveFormsModule`。\n{@a questionnaire-data}",
+ "translation": "`formControlName`和`formGroup`是在`ReactiveFormsModule`中定义的指令。我们之所以能在模板中使用它们,是因为我们往`AppModule`中导入了`ReactiveFormsModule`。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
@@ -6650,12 +6695,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
- "original": "Although in this example you're modelling a job application for heroes, there are \nno references to any specific hero question\noutside the objects returned by `QuestionService`.",
+ "original": "Although in this example you're modelling a job application for heroes, there are\nno references to any specific hero question\noutside the objects returned by `QuestionService`.",
"translation": "在这个例子中,虽然我们是在为英雄的工作申请表建模,但是除了`QuestionService`返回的那些对象外,没有其它任何地方是与英雄有关的。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
{
- "original": "This is very important since it allows you to repurpose the components for any type of survey\nas long as it's compatible with the *question* object model. \nThe key is the dynamic data binding of metadata used to render the form \nwithout making any hardcoded assumptions about specific questions. \nIn addition to control metadata, you are also adding validation dynamically.",
+ "original": "This is very important since it allows you to repurpose the components for any type of survey\nas long as it's compatible with the *question* object model.\nThe key is the dynamic data binding of metadata used to render the form\nwithout making any hardcoded assumptions about specific questions.\nIn addition to control metadata, you are also adding validation dynamically.",
"translation": "这点非常重要,因为只要与*问卷*对象模型兼容,就可以在任何类型的调查问卷中复用这些组件。\n这里的关键是用到元数据的动态数据绑定来渲染表单,对问卷问题没有任何硬性的假设。除控件的元数据外,还可以动态添加验证规则。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
@@ -6674,6 +6719,16 @@
"translation": "[回到顶部](guide/dynamic-form#top)",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/dynamic-form.md"
},
+ {
+ "original": "#### Prerequisites:",
+ "translation": "#### 前提条件:",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/entry-components.md"
+ },
+ {
+ "original": "A basic understanding of the following concepts:",
+ "translation": "对下列概念有基本的理解:",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/entry-components.md"
+ },
{
"original": "# Form Validation",
"translation": "# 表单验证",
@@ -7006,12 +7061,12 @@
},
{
"original": "You can run the
in Stackblitz and download the code from there.",
- "translation": "你可以在Plunker中运行
,并且从那里下载代码。",
+ "translation": "运行
来试用本页的代码。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
"original": "## Template-driven forms",
- "translation": "## 模板驱动的表单",
+ "translation": "## 模板驱动表单 (template-driven forms)",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
@@ -7116,7 +7171,7 @@
},
{
"original": "## Setup",
- "translation": "## 搭建",
+ "translation": "## 准备工作",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
@@ -7260,7 +7315,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "1. You add the `FormsModule` to the list of `imports` defined in the `@NgModule` decorator. This gives the application\naccess to all of the template-driven forms features, including `ngModel`.",
+ "original": "1. You add the `FormsModule` to the list of `imports` defined in the `@NgModule` decorator. This gives the application\n access to all of the template-driven forms features, including `ngModel`.",
"translation": "把`FormsModule`添加到`ngModule`装饰器的`imports`列表中,这样应用就能访问模板驱动表单的所有特性,包括`ngModel`。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
@@ -7295,8 +7350,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "Create the template file with the following contents:",
- "translation": "创建模板文件,内容如下:",
+ "original": "Update the template file with the following contents:",
+ "translation": "修改模板文件,内容如下:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
@@ -7425,7 +7480,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "What `NgForm` directive?\nYou didn't add an [NgForm](api/forms/NgForm) directive.",
+ "original": "What `NgForm` directive?\n You didn't add an [NgForm](api/forms/NgForm) directive.",
"translation": "什么是`NgForm`指令?\n但我们明明没有添加过[NgForm](api/forms/NgForm)指令啊!",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
@@ -7435,7 +7490,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "The `NgForm` directive supplements the `form` element with additional features.\nIt holds the controls you created for the elements with an `ngModel` directive\nand `name` attribute, and monitors their properties, including their validity.\nIt also has its own `valid` property which is true only *if every contained\ncontrol* is valid.",
+ "original": "The `NgForm` directive supplements the `form` element with additional features.\n It holds the controls you created for the elements with an `ngModel` directive\n and `name` attribute, and monitors their properties, including their validity.\n It also has its own `valid` property which is true only *if every contained\n control* is valid.",
"translation": "`NgForm`指令为`form`增补了一些额外特性。\n它会控制那些带有`ngModel`指令和`name`属性的元素,监听他们的属性(包括其有效性)。\n它还有自己的`valid`属性,这个属性只有在*它包含的每个控件*都有效时才是真。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
@@ -7475,7 +7530,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "* 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.",
+ "original": "* Each input element has an `id` property that is used by the `label` element's `for` attribute\n to match the label to its input control.",
"translation": "每个 input 元素都有`id`属性,`label`元素的`for`属性用它来匹配到对应的输入控件。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
@@ -7485,7 +7540,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "If you run the app now and change every hero model property, the form might display like this:",
+ "original": "If you run the app now and change every hero model property, the form might display like this:",
"translation": "如果现在运行本应用,修改 Hero 模型的每个属性,表单是这样的:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
@@ -7700,13 +7755,13 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "Enter a name and click *New Hero* again.\nThe app displays a _Name is required_ error message. \nYou don't want error messages when you create a new (empty) hero.\nWhy are you getting one now?",
+ "original": "Enter a name and click *New Hero* again.\nThe app displays a _Name is required_ error message.\nYou don't want error messages when you create a new (empty) hero.\nWhy are you getting one now?",
"translation": "输入名字,再次点击 *New Hero* 按钮。\n这次,出现了错误信息!为什么?我们不希望显示新(空)的英雄时,出现错误信息。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
- "original": "Inspecting the element in the browser tools reveals that the *name* input box is _no longer pristine_.\nThe form remembers that you entered a name before clicking *New Hero*.\nReplacing the hero *did not restore the pristine state* of the form controls.",
- "translation": "使用浏览器工具审查这个元素就会发现,这个 *name* 输入框并不是全新的。\n表单记得我们在点击 *New Hero* 前输入的名字。\n更换了英雄*并不会重置控件的“全新”状态*。",
+ "original": "Inspecting the element in the browser tools reveals that the *name* input box is _no longer pristine_.\nThe form remembers that you entered a name before clicking *New Hero*.\nReplacing the hero object *did not restore the pristine state* of the form controls.",
+ "translation": "使用浏览器工具审查这个元素就会发现,这个 *name* 输入框并不是全新的。\n表单记得我们在点击 *New Hero* 前输入的名字。\n更换了英雄对象*并不会重置控件的“全新”状态*。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
@@ -7831,7 +7886,7 @@
},
{
"original": "## Summary",
- "translation": "## 总结",
+ "translation": "## 小结",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/forms.md"
},
{
@@ -8100,38 +8155,38 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Interpolation](guide/template-syntax#interpolation)",
- "translation": "[插值表达式 (interpolation)](guide/template-syntax#interpolation)",
+ "original": "* [Interpolation](guide/template-syntax#interpolation).",
+ "translation": "[插值表达式 (interpolation)](guide/template-syntax#interpolation)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Property binding](guide/template-syntax#property-binding)",
- "translation": "[property 绑定 (property binding)](guide/template-syntax#property-binding)",
+ "original": "* [Property binding](guide/template-syntax#property-binding).",
+ "translation": "[property 绑定 (property binding)](guide/template-syntax#property-binding)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Event binding](guide/template-syntax#event-binding)",
- "translation": "[事件绑定 (event binding)](guide/template-syntax#event-binding)",
+ "original": "* [Event binding](guide/template-syntax#event-binding).",
+ "translation": "[事件绑定 (event binding)](guide/template-syntax#event-binding)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Attribute binding](guide/template-syntax#attribute-binding)",
- "translation": "[attribute 绑定 (attribute binding)](guide/template-syntax#attribute-binding)",
+ "original": "* [Attribute binding](guide/template-syntax#attribute-binding).",
+ "translation": "[attribute 绑定 (attribute binding)](guide/template-syntax#attribute-binding)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Class binding](guide/template-syntax#class-binding)",
- "translation": "[CSS 类绑定 (class binding)](guide/template-syntax#class-binding)",
+ "original": "* [Class binding](guide/template-syntax#class-binding).",
+ "translation": "[CSS 类绑定 (class binding)](guide/template-syntax#class-binding)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Style binding](guide/template-syntax#style-binding)",
- "translation": "[样式绑定 (style binding)](guide/template-syntax#style-binding)",
+ "original": "* [Style binding](guide/template-syntax#style-binding).",
+ "translation": "[样式绑定 (style binding)](guide/template-syntax#style-binding)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "* [Two-way data binding with ngModel](guide/template-syntax#ngModel)",
- "translation": "[基于 ngModel 的双向数据绑定 (Two-way data binding with ngModel)](guide/template-syntax#ngModel)",
+ "original": "* [Two-way data binding with ngModel](guide/template-syntax#ngModel).",
+ "translation": "[基于 ngModel 的双向数据绑定 (Two-way data binding with ngModel)](guide/template-syntax#ngModel)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
@@ -8250,8 +8305,13 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "A directive is usually associated with an HTML element or attribute.\nThis element or attribute is often referred to as the directive itself.\nWhen Angular finds a directive in an HTML template,\nit creates the matching directive class instance\nand gives the instance control over that portion of the browser DOM.",
- "translation": "指令几乎总与 HTML 元素或属性 (attribute) 相关。\n我们通常把这些关联到的 HTML 元素或者属性 (attribute) 当做指令本身。\n当 Angular 在 HTML 模板中遇到一个指令的时候,\n它会创建匹配的指令类的实例,并把浏览器中这部分 DOM 的控制权交给它。",
+ "original": "A directive is usually associated with an HTML element or attribute.\nThis element or attribute is often referred to as the directive itself.",
+ "translation": "指令几乎总与 HTML 元素或属性 (attribute) 相关。\n我们通常把这些关联到的 HTML 元素或者属性 (attribute) 当做指令本身。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
+ },
+ {
+ "original": "When Angular finds a directive in an HTML template,\nit creates the matching directive class instance\nand gives the instance control over that portion of the browser DOM.",
+ "translation": "当 Angular 在 HTML 模板中遇到一个指令的时候,\n它会创建匹配的指令类的实例,并把浏览器中这部分 DOM 的控制权交给它。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
@@ -8311,7 +8371,7 @@
},
{
"original": "Short hand for [ECMAScript](guide/glossary#ecmascript) 2015.",
- "translation": "[ECMAScript](guide/glossary#ecmascript) 2015 的缩写。",
+ "translation": "[ECMAScript](guide/glossary#ecmascript) 2015 的简写。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
@@ -8356,7 +8416,7 @@
},
{
"original": "See the [Input and output properties](guide/template-syntax#inputs-outputs) section of the [Template Syntax](guide/template-syntax) page.",
- "translation": "见[模板语法](guide/template-syntax)中的[输入与输出属性](guide/template-syntax#inputs-outputs)。",
+ "translation": "参见[模板语法](guide/template-syntax)中的[输入与输出属性](guide/template-syntax#inputs-outputs)部分。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
@@ -8396,7 +8456,7 @@
},
{
"original": "## Lifecycle hooks",
- "translation": "## 生命周期钩子 (lifecycle hook)",
+ "translation": "## 生命周期钩子",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
@@ -8484,6 +8544,11 @@
"translation": "ES2015模块,如本节所述。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
+ {
+ "original": "For a comparison, see [JavaScript Modules vs. NgModules](guide/ngmodule-vs-jsmodule).",
+ "translation": "要对比这两个概念,请参见[JavaScript 模块 vs. NgModules](guide/ngmodule-vs-jsmodule)。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
+ },
{
"original": "A cohesive block of code dedicated to a single purpose.",
"translation": "模块是一个内聚的代码块,具有单一用途。",
@@ -8510,7 +8575,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "An application that adheres to this standard requires a module loader to\nload modules on request and resolve inter-module dependencies.\nAngular doesn't include a module loader and doesn't have a preference\nfor any particular third- party library.\nYou can use any module library that conforms to the standard.",
+ "original": "An application that adheres to this standard requires a module loader to\nload modules on request and resolve inter-module dependencies.\nAngular doesn't include a module loader and doesn't have a preference\nfor any particular third-party library.\nYou can use any module library that conforms to the standard.",
"translation": "采用这个标准的应用程序需要一个模块加载器来按需加载模块,并解析模块间的依赖关系。\nAngular 不附带模块加载器,也不偏爱任何第三方库(虽然大多数例子使用SystemJS)。\n你可以选择任何与这个标准兼容的模块化库。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
@@ -8535,7 +8600,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "To use observables, Angular uses a third-party library called Reactive Extensions (RxJS).\nObservables are a proposed feature for ES 2016, the next version of JavaScript.",
+ "original": "To use observables, Angular uses a third-party library called Reactive Extensions (RxJS).\nObservables are a proposed feature for ES2016, the next version of JavaScript.",
"translation": "为了使用`Observable`, Angular 采用了名为 Reactive Extensions (RxJS) 的第三方包。\n在下个版本的 JavaScript - ES 2016 中,`Observable`是建议的特性之一。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
@@ -8655,12 +8720,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "A [routing component's](guide/glossary#routing-component) template has a `RouterOutlet` element\n where it can display views produced by the router.",
+ "original": "A [routing component's](guide/glossary#routing-component) template has a `RouterOutlet` element\nwhere it can display views produced by the router.",
"translation": "[路由组件](guide/glossary#routing-component)的模板中带有一个`RouterOutlet`元素,那是显示路由器生成的视图的地方。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "Other views in the application likely have anchor tags or buttons with `RouterLink`\n directives that users can click to navigate.",
+ "original": "Other views in the application likely have anchor tags or buttons with `RouterLink`\ndirectives that users can click to navigate.",
"translation": "应用中的其它视图中某些锚标签或按钮上带有`RouterLink`指令,用户可以点击它们进行导航。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
@@ -8669,6 +8734,11 @@
"translation": "更多信息,见[路由与导航](guide/router)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
+ {
+ "original": "## Router module",
+ "translation": "## 路由器模块",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
+ },
{
"original": "A separate [NgModule](guide/glossary#ngmodule) that provides the necessary service providers and directives for navigating through application views.",
"translation": "一个独立的 [Angular 模块](guide/glossary#ngmodule),用来提供导航所需的服务提供商和指令。",
@@ -8905,22 +8975,22 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "The browser DOM and JavaScript have a limited number\n of asynchronous activities, such as DOM events (for example, clicks),\n [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), and\n [XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)\n calls to remote servers.",
+ "original": "The browser DOM and JavaScript have a limited number\nof asynchronous activities, such as DOM events (for example, clicks),\n[promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), and\n[XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)\ncalls to remote servers.",
"translation": "浏览器中的 DOM 和 JavaScript 之间常会有一些数量有限的异步活动,\n 例如 DOM 事件(例如点击)、[承诺 (promise)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\n 和通过 [XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) 调用远程服务。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "Zones intercept all of these activities and give a \"zone client\" the opportunity\n to take action before and after the async activity finishes.",
+ "original": "Zones intercept all of these activities and give a \"zone client\" the opportunity\nto take action before and after the async activity finishes.",
"translation": "区域能截听所有这些活动,并让“区域的客户”有机会在异步活动完成之前和之后采取行动。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "Angular runs your application in a zone where it can respond to\n asynchronous events by checking for data changes and updating\n the information it displays via [data bindings](guide/glossary#data-binding).",
+ "original": "Angular runs your application in a zone where it can respond to\nasynchronous events by checking for data changes and updating\nthe information it displays via [data bindings](guide/glossary#data-binding).",
"translation": "Angular 会在一个 Zone 区域中运行应用程序,在这个区域中,它可以对异步事件做出反应,可以通过检查数据变更、利用[数据绑定 (data bindings)](guide/glossary#data-binding) 来更新信息显示。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
{
- "original": "Learn more about zones in this\n [Brian Ford video](https://www.youtube.com/watch?v=3IqtmUscE_U).",
+ "original": "Learn more about zones in this\n[Brian Ford video](https://www.youtube.com/watch?v=3IqtmUscE_U).",
"translation": "更多信息,见 [Brian Ford 的视频](https://www.youtube.com/watch?v=3IqtmUscE_U)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/glossary.md"
},
@@ -8946,7 +9016,7 @@
},
{
"original": "Try the
.",
- "translation": "试试
.",
+ "translation": "试试
。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/hierarchical-dependency-injection.md"
},
{
@@ -8970,7 +9040,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/hierarchical-dependency-injection.md"
},
{
- "original": "Consider this guide's variation on the Tour of Heroes application .\nAt the top is the `AppComponent` which has some sub- components.\nOne of them is the`HeroesListComponent`.\nThe `HeroesListComponent` holds and manages multiple instances of the `HeroTaxReturnComponent`.\nThe following diagram represents the state of the this guide's three-level component tree when there are three instances of `HeroTaxReturnComponent`\nopen simultaneously.",
+ "original": "Consider this guide's variation on the Tour of Heroes application.\nAt the top is the `AppComponent` which has some sub-components.\nOne of them is the `HeroesListComponent`.\nThe `HeroesListComponent` holds and manages multiple instances of the `HeroTaxReturnComponent`.\nThe following diagram represents the state of the this guide's three-level component tree when there are three instances of `HeroTaxReturnComponent`\nopen simultaneously.",
"translation": "考虑《英雄指南》应用的一个简单变种。它的顶层是`AppComponent`组件,它有一些子组件。\n`HeroesListComponent`组件保存和管理着`HeroTaxReturnComponent`的多个实例。\n下图展示了当`HeroesCardComponent`的三个 `HeroTaxReturnComponent` 实例同时展开时的三级组件树状态。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/hierarchical-dependency-injection.md"
},
@@ -8985,7 +9055,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/hierarchical-dependency-injection.md"
},
{
- "original": "You can cap the bubbling. An intermediate component can declare that it is the \"host\" component.\nThe hunt for providers will climb no higher than the injector for that host component.\n This is a topic for another day.",
+ "original": "You can cap the bubbling. An intermediate component can declare that it is the \"host\" component.\nThe hunt for providers will climb no higher than the injector for that host component.\nThis is a topic for another day.",
"translation": "我们还可以“盖住”这次冒泡。一个中层的组件可以声称自己是“宿主”组件。\n向上查找提供商的过程会截止于这个“宿主”组件。\n我们先保留这个问题,等改天再讨论这个选项。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/hierarchical-dependency-injection.md"
},
@@ -9199,6 +9269,11 @@
"translation": "`@angular/common/http`中的`HttpClient`类为 Angular 应用程序提供了一个简化的 API 来实现 HTTP 客户端功能。它基于浏览器提供的`XMLHttpRequest`接口。\n`HttpClient`带来的其它优点包括:可测试性、强类型的请求和响应对象、发起请求与接收响应时的拦截器支持,以及更好的、基于可观察(Observable)对象的 API 以及流式错误处理机制。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/http.md"
},
+ {
+ "original": "## Setup",
+ "translation": "## 准备工作",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/http.md"
+ },
{
"original": "### Reading the full response",
"translation": "### 读取完整的响应体",
@@ -9335,7 +9410,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/http.md"
},
{
- "original": "*Note that `HttpClient`supports only the client half of the XSRF protection scheme.* Your backend service must be configured to set the cookie for your page, and to verify that the header is present on all eligible requests. If not, Angular's default protection will be ineffective.",
+ "original": "*Note that `HttpClient` supports only the client half of the XSRF protection scheme.* \nYour backend service must be configured to set the cookie for your page, and to verify that \nthe header is present on all eligible requests. \nIf not, Angular's default protection will be ineffective.",
"translation": "*注意,`HttpClient`支持的只是 XSRF 防护方案的客户端这一半。* 我们的后端服务必须配置为给页面设置 cookie ,并且要验证请求头,以确保全都是合法的请求。否则,Angular 默认的这种防护措施就会失效。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/http.md"
},
@@ -9505,7 +9580,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
- "original": "* The first parameter is the key. It is bound to the component property (`minutes`), which determines the number of minutes.",
+ "original": "* The first parameter is the key. It is bound to the component property (`minutes`), which determines\nthe number of minutes.",
"translation": "第一个参数是key。它绑定到了组件中表示狼的数量的`wolves`属性。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
@@ -9585,7 +9660,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
- "original": "Use the `ng xi18n` command provided by the CLI to extract the text messages marked with`i18n`into\n a translation source file .",
+ "original": "Use the `ng xi18n` command provided by the CLI to extract the text messages marked with `i18n` into\na translation source file.",
"translation": "使用`ng-xi18n`提取工具来将带`i18n`标记的文本提取到一个翻译源文件中。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
@@ -9620,12 +9695,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
- "original": "The `ng xi18n` command generates a translation source file\nnamed `messages.xlf`in the project `src` folder .",
+ "original": "The `ng xi18n` command generates a translation source file named `messages.xlf` in the project `src`\nfolder.",
"translation": "`ng xi18n`命令在项目根目录生成一个名为`messages.xlf`的翻译源文件。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
- "original": "The next step is to translate this source file into the specific language \ntranslation files. The example in this guide creates a French translation file.",
+ "original": "The next step is to translate this source file into the specific language\ntranslation files. The example in this guide creates a French translation file.",
"translation": "下一步是将英文模板文本翻译到指定语言的翻译文件。\n这个例子中创建了一个法语翻译文件。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
@@ -9640,7 +9715,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
- "original": "One approach is to dedicate a folder to localization and store related assets , such as\ninternationalization files, there.",
+ "original": "One approach is to dedicate a folder to localization and store related assets, such as\ninternationalization files, there.",
"translation": "其中一种方法是为本土化和相关资源(比如国际化文件)创建一个专门的目录。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
@@ -9655,8 +9730,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
- "original": "In a large translation project, you wouldsend the `messages.fr.xlf` file to a French translator who would enter the translations\nusing an XLIFF file editor.",
- "translation": "在现实世界中,`messages.es.xlf`文件会被发给西班牙语翻译,他们使用
这些XLIFF文件编辑器中的一种来翻译它。",
+ "original": "In a large translation project, you would send the `messages.fr.xlf` file to a French translator who\nwould enter the translations using an XLIFF file editor.",
+ "translation": "在现实世界中,`messages.fr.xlf`文件会被发给法语翻译,他们使用
这些XLIFF文件编辑器中的一种来翻译它。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
},
{
@@ -10110,13 +10185,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
- "original": "Fortunately, they aren't necessary.",
- "translation": "幸运的是,它们并不是必须的。",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
- },
- {
- "original": "You don't have to add the lifecycle hook interfaces to directives and components to benefit from the hooks themselves.",
- "translation": "我们并不需要在指令和组件上添加生命周期钩子接口就能获得钩子带来的好处。",
+ "original": "Fortunately, they aren't necessary.\nYou don't have to add the lifecycle hook interfaces to directives and components to benefit from the hooks themselves.",
+ "translation": "幸运的是,它们并不是必须的。\n我们并不需要在指令和组件上添加生命周期钩子接口就能获得钩子带来的好处。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
@@ -10280,7 +10350,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
- "original": "2. A spy directive can provide insight into a DOM object that you cannot change directly.\nObviously you can't touch the implementation of a native `
`.\nYou can't modify a third party component either.\nBut you can watch both with a directive.",
+ "original": "2. A spy directive can provide insight into a DOM object that you cannot change directly.\n Obviously you can't touch the implementation of a native `
`.\n You can't modify a third party component either.\n But you can watch both with a directive.",
"translation": "一个侦探(spy)指令可以让我们在无法直接修改DOM对象实现代码的情况下,透视其内部细节。\n显然,你不能修改一个原生`
`元素的实现代码。\n你同样不能修改第三方组件。\n但我们用一个指令就能监视它们了。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
@@ -10350,7 +10420,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
- "original": "An `ngOnInit()` is a good place for a component to fetch its initial data. The\n[Tour of Heroes Tutorial](tutorial/toh-pt4#oninit) guideshows how.",
+ "original": "An `ngOnInit()` is a good place for a component to fetch its initial data. The\n[Tour of Heroes Tutorial](tutorial/toh-pt4#oninit) guide shows how.",
"translation": "`ngOnInit()`是组件获取初始数据的好地方。[指南](tutorial/toh-pt4#oninit)中讲解了如何这样做。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
@@ -10395,13 +10465,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
- "original": "Angular calls its `ngOnChanges()` method whenever it detects changes to ***input properties*** of the component (or directive).",
- "translation": "一旦检测到该组件(或指令)的***输入属性***发生了变化,Angular就会调用它的`ngOnChanges()`方法。",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
- },
- {
- "original": "This example monitors the `OnChanges` hook.",
- "translation": "本例监控`OnChanges`钩子。",
+ "original": "Angular calls its `ngOnChanges()` method whenever it detects changes to ***input properties*** of the component (or directive).\nThis example monitors the `OnChanges` hook.",
+ "translation": "一旦检测到该组件(或指令)的***输入属性***发生了变化,Angular就会调用它的`ngOnChanges()`方法。\n本例监控`OnChanges`钩子。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
@@ -10595,7 +10660,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
{
- "original": "*AfterContent* hooks are similar to the *AfterView* hooks. \nThe key difference is in the child component.",
+ "original": "*AfterContent* hooks are similar to the *AfterView* hooks.\nThe key difference is in the child component.",
"translation": "*AfterContent*钩子和*AfterView*相似。关键的不同点是子组件的类型不同。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
@@ -10629,6 +10694,31 @@
"translation": "回忆一下,Angular在每次调用*AfterView*钩子之前也会同时调用*AfterContent*。\nAngular在完成当前组件的视图合成之前,就已经完成了被投影内容的合成。\n所以我们仍然有机会去修改那个视图。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/lifecycle-hooks.md"
},
+ {
+ "original": "A basic understanding of the following concepts:",
+ "translation": "对下列概念有基本的理解:",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/module-types.md"
+ },
+ {
+ "original": "A basic understanding of the following concepts:",
+ "translation": "对下列概念有基本的理解:",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-api.md"
+ },
+ {
+ "original": "Property",
+ "translation": "属性",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-api.md"
+ },
+ {
+ "original": "Description",
+ "translation": "描述",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-api.md"
+ },
+ {
+ "original": "For more information, see [Entry Components](guide/entry-components).",
+ "translation": "要了解更多,参见[入口组件](guide/entry-components)一章。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-api.md"
+ },
{
"original": "# NgModule FAQs",
"translation": "# Angular 模块常见问题",
@@ -10861,7 +10951,12 @@
},
{
"original": "You _can_ export any declarable class—components, directives, and pipes—whether\nit's declared in this NgModule or in an imported NgModule.",
- "translation": "你*可以*导出任何可声明类(组件、指令和管道),而不用管它是声明在当前模块中还是某个导入的模块中。You _can_ re-export entire imported NgModules, which effectively re-exports all of their exported classes.\nAn NgModule can even export a module that it doesn't import.\n你*可以*重新导出整个导入过的模块,这将导致重新导出它们导出的所有类。模块甚至还可以导出它未曾导入过的模块。",
+ "translation": "你*可以*导出任何可声明类(组件、指令和管道),而不用管它是声明在当前模块中还是某个导入的模块中。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
+ },
+ {
+ "original": "You _can_ re-export entire imported NgModules, which effectively re-exports all of their exported classes.\nAn NgModule can even export a module that it doesn't import.",
+ "translation": "你*可以*重新导出整个导入过的模块,这将导致重新导出它们导出的所有类。重新导出的模块甚至不用先导入。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
},
{
@@ -11491,7 +11586,12 @@
},
{
"original": "The compiler finds a pipe if the pipe's *name* appears within the pipe syntax of the template HTML.",
- "translation": "编译器通过分析模板HTML中的管道语法中是否出现了特定的管道名来查找对应的管道。Angular only matches selectors and pipe names for classes that are declared by this module\nor exported by a module that this module imports.\nAngular只查询两种组件、指令或管道:1)那些在当前模块中声明过的,以及2)那些被当前模块导入的模块所导出的。",
+ "translation": "编译器通过分析模板HTML中的管道语法中是否出现了特定的管道名来查找对应的管道。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
+ },
+ {
+ "original": "Angular only matches selectors and pipe names for classes that are declared by this module\nor exported by a module that this module imports.",
+ "translation": "Angular只查询两种组件、指令或管道:1)那些在当前模块中声明过的,以及2)那些被当前模块导入的模块所导出的。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
},
{
@@ -11529,6 +11629,11 @@
"translation": "`@NgModule`元数据告诉*Angular编译器*要为当前模块编译哪些组件,以及如何把当前模块和其它模块链接起来。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
},
+ {
+ "original": "A basic understanding of the following concepts:",
+ "translation": "对下列概念有基本的理解:",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodules.md"
+ },
{
"original": "# Npm Packages",
"translation": "# Npm 包",
@@ -11561,7 +11666,7 @@
},
{
"original": "**Verify that you are running node `v4.x.x` or higher and npm `3.x.x` or higher**\nby running the commands `node -v` and `npm -v` in a terminal/console window.\nOlder versions produce errors.",
- "translation": "通过在终端/控制台窗口中运行`node -v`和`npm -v`命令,来**验证下你是否正在使用node `v4.x.x`和npm `3.x.x`**。\n 过老的版本有可能出现问题。",
+ "translation": "在终端/控制器窗口运行命令`node -v`和`npm -v`,来**确认你运行的 node 是`v4.x.x`或更高,npm 为`3.x.x`或更高。**\n老版本会产生错误。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/npm-packages.md"
},
{
@@ -11610,7 +11715,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/npm-packages.md"
},
{
- "original": "* **Angular packages **: Angular core and optional modules; their package names begin `@angular/`.",
+ "original": "* **Angular packages**: Angular core and optional modules; their package names begin `@angular/`.",
"translation": "**Angular 包**:Angular 的核心和可选模块,它们的包名以`@angular/`开头。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/npm-packages.md"
},
@@ -11744,6 +11849,11 @@
"translation": "**[codelyzer](https://www.npmjs.com/package/codelyzer)**:专用于 Angular 应用的 linter,它的规则适用于 Angular 的[风格指南](guide/styleguide)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/npm-packages.md"
},
+ {
+ "original": "**jasmine/... **: packages to support the [Jasmine](https://jasmine.github.io/) test library.",
+ "translation": "**jasmine/... **:[Jasmine](https://jasmine.github.io/) 测试库的支持包。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/npm-packages.md"
+ },
{
"original": "**karma/... **: packages to support the [karma](https://www.npmjs.com/package/karma) test runner.",
"translation": "**karma/... **:[karma](https://www.npmjs.com/package/karma) 测试运行器的支持包。",
@@ -11799,6 +11909,21 @@
"translation": "参见[部署](guide/deployment)一章了解详情。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/npm-packages.md"
},
+ {
+ "original": "## Router",
+ "translation": "## 路由器 (router)",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/observables-in-angular.md"
+ },
+ {
+ "original": "## Reactive forms",
+ "translation": "## 响应式表单 (reactive forms)",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/observables-in-angular.md"
+ },
+ {
+ "original": "## Error handling",
+ "translation": "## 错误处理",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/observables.md"
+ },
{
"original": "# Pipes",
"translation": "# 管道",
@@ -11826,7 +11951,7 @@
},
{
"original": "You can run the
in Stackblitz and download the code from there.",
- "translation": "试试
在线例子。",
+ "translation": "运行
来试用本页的代码。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/pipes.md"
},
{
@@ -12135,7 +12260,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/pipes.md"
},
{
- "original": "Or you might not use a pipe at all.\nIt may be better to pursue the pipe's purpose with a property of the component,\na point that's discussed laterin this page.",
+ "original": "Or you might not use a pipe at all.\nIt may be better to pursue the pipe's purpose with a property of the component,\na point that's discussed later in this page.",
"translation": "或者我们也可以完全不用管道。\n有时候,使用组件的属性能比用管道更好的达到目的,这一点我们等后面会再提起。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/pipes.md"
},
@@ -12329,6 +12454,11 @@
"translation": "如果你不需要顾虑这些性能和最小化问题,也可以创建自己的管道来实现这些功能(参考[FlyingHeroesPipe](guide/pipes#impure-flying-heroes)中的写法)或到社区中去找找。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/pipes.md"
},
+ {
+ "original": "#### Prerequisites:",
+ "translation": "#### 前提条件:",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/providers.md"
+ },
{
"original": "# QuickStart",
"translation": "# 快速上手",
@@ -12359,6 +12489,11 @@
"translation": "你还可以
下载这个例子。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
},
+ {
+ "original": "Step 1. Set up the Development Environment",
+ "translation": "步骤1. 设置开发环境",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
+ },
{
"original": "You need to set up your development environment before you can do anything.",
"translation": "在开始工作之前,我们必须设置好开发环境。",
@@ -12366,7 +12501,7 @@
},
{
"original": "Install **[Node.js® and npm](https://nodejs.org/en/download/)**\nif they are not already on your machine.",
- "translation": "如果你的机器上还没有**[Node.js®和npm](https://nodejs.org/en/download/)**,请先安装它们。",
+ "translation": "如果你的电脑里没有Node.js®和npm,请安装**[它们](https://nodejs.org/en/download/)**。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
},
{
@@ -12379,6 +12514,11 @@
"translation": "然后全局安装 **[Angular CLI](https://github.com/angular/angular-cli)** 。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
},
+ {
+ "original": "Step 2. Create a new project",
+ "translation": "步骤2. 创建新项目",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
+ },
{
"original": "Open a terminal window.",
"translation": "打开终端窗口。",
@@ -12394,6 +12534,11 @@
"translation": "请耐心等待。\n创建新项目需要花费很多时间,大多数时候都是在安装那些npm包。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
},
+ {
+ "original": "Step 3: Serve the application",
+ "translation": "步骤3. 启动开发服务器",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
+ },
{
"original": "Go to the project directory and launch the server.",
"translation": "进入项目目录,并启动服务器。",
@@ -12414,6 +12559,11 @@
"translation": "本应用会用一条消息来跟你打招呼:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
},
+ {
+ "original": "Step 4: Edit your first Angular component",
+ "translation": "步骤4. 编辑我们的第一个Angular组件",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
+ },
{
"original": "The CLI created the first Angular component for you.\nThis is the _root component_ and it is named `app-root`.\nYou can find it in `./src/app/app.component.ts`.",
"translation": "这个CLI为我们创建了第一个Angular组件。\n它就是名叫`app-root`的*根组件*。\n你可以在`./src/app/app.component.ts`目录下找到它。",
@@ -12506,7 +12656,7 @@
},
{
"original": "Defines `AppModule`, the [root module](guide/bootstrapping \"AppModule: the root module\") that tells Angular how to assemble the application.\n Right now it declares only the `AppComponent`.\n Soon there will be more components to declare.",
- "translation": "定义`AppModule`,这个[根模块](guide/bootstrapping \"AppModule: 根模块\")会告诉Angular如何组装该应用。\n 目前,它只声明了`AppComponent`。\n 稍后它还会声明更多组件。",
+ "translation": "定义`AppModule`,[根模块](guide/bootstrapping \"AppModule: 根模块\")为 Angular 描述如何组装应用。\n 目前,它只声明了`AppComponent`。\n 不久,它将声明更多组件。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/quickstart.md"
},
{
@@ -13276,7 +13426,7 @@
},
{
"original": "Description",
- "translation": "说明",
+ "translation": "描述",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/reactive-forms.md"
},
{
@@ -13290,7 +13440,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/reactive-forms.md"
},
{
- "original": "`true` if the user has _not_ changed the value in the UI.\n Its opposite is `myControl.dirty`.",
+ "original": "`true` if the user has _not_ changed the value in the UI.\n Its opposite is `myControl.dirty`.",
"translation": "如果用户*尚未*改变过这个控件的值,则为`true`。它总是与`myControl.dirty`相反。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/reactive-forms.md"
},
@@ -13891,7 +14041,7 @@
},
{
"original": "## Summary",
- "translation": "## 总结",
+ "translation": "## 小结",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/reactive-forms.md"
},
{
@@ -14310,12 +14460,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "Displays the application component for the active URL.\n Manages navigation from one component to the next.",
+ "original": "Displays the application component for the active URL.\n Manages navigation from one component to the next.",
"translation": "为激活的URL显示应用组件。管理从一个组件到另一个组件的导航",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "A separate NgModule that provides the necessary service providers\n and directives for navigating through application views.",
+ "original": "A separate NgModule that provides the necessary service providers\n and directives for navigating through application views.",
"translation": "一个独立的Angular模块,用于提供所需的服务提供商,以及用来在应用视图之间进行导航的指令。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -14325,7 +14475,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "Defines how the router should navigate to a component based on a URL pattern.\n Most routes consist of a path and a component type.",
+ "original": "Defines how the router should navigate to a component based on a URL pattern.\n Most routes consist of a path and a component type.",
"translation": "定义路由器该如何根据URL模式(pattern)来导航到组件。大多数路由都由路径和组件类构成。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -14335,30 +14485,30 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "The directive for binding a clickable HTML element to\n a route. Clicking an element with a
routerLink
directive\n that is bound to a
link parameters array triggers a navigation.",
- "translation": "该指令用来把一个可点击的HTML元素绑定到路由。\n 点击带有绑定到
字符串或
链接参数数组的
routerLink
指令的元素就会触发一次导航。",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
- },
- {
- "original": "The directive for adding/removing classes from an HTML element when an associated\n
routerLink
contained on or inside the element becomes active/inactive.",
+ "original": "The directive for adding/removing classes from an HTML element when an associated\n
routerLink
contained on or inside the element becomes active/inactive.",
"translation": "当HTML元素上或元素内的
routerLink
变为激活或非激活状态时,该指令为这个HTML元素添加或移除CSS类。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "A service that is provided to each route component that contains route specific\n information such as route parameters, static data, resolve data, global query params, and the global fragment.",
+ "original": "A service that is provided to each route component that contains route specific\n information such as route parameters, static data, resolve data, global query params, and the global fragment.",
"translation": "为每个路由组件提供提供的一个服务,它包含特定于路由的信息,比如路由参数、静态数据、解析数据、全局查询参数和全局碎片(fragment)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "The current state of the router including a tree of the currently activated\n routes together with convenience methods for traversing the route tree.",
+ "original": "The current state of the router including a tree of the currently activated\n routes together with convenience methods for traversing the route tree.",
"translation": "路由器的当前状态包含了一棵由程序中激活的路由构成的树。它包含一些用于遍历路由树的快捷方法。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "An array that the router interprets as a routing instruction.\n You can bind that array toa
RouterLink
or pass the array as an argument to\n the
Router.navigate
method.",
+ "original": "An array that the router interprets as a routing instruction.\n You can bind that array to a
RouterLink
or pass the array as an argument to\n the
Router.navigate
method.",
"translation": "这个数组会被路由器解释成一个路由操作指南。我们可以把一个
RouterLink
绑定到该数组,或者把它作为参数传给
Router.navigate
方法。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
+ {
+ "original": "An Angular component with a
RouterOutlet
that displays views based on router navigations.",
+ "translation": "一个带有
RouterOutlet
的Angular组件,它根据路由器的导航来显示相应的视图。",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
+ },
{
"original": "## The sample application",
"translation": "## 范例应用",
@@ -14550,7 +14700,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "The router uses the browser's\n
history.pushState\nfor navigation. Thanks to `pushState`, you can make in-app URL paths look the way you want them to\nlook, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs.",
+ "original": "The router uses the browser's\n
history.pushState\nfor navigation. Thanks to `pushState`, you can make in-app URL paths look the way you want them to\nlook, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs.",
"translation": "路由器使用浏览器的
history.pushState进行导航。\n感谢`pushState`!有了它,我们就能按所期望的样子来显示应用内部的URL路径,比如:`localhost:3000/crisis-center`。虽然我们使用的全部是客户端合成的视图,但应用内部的这些URL看起来和来自服务器的没有什么不同。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -14574,6 +14724,11 @@
"translation": "把`
`元素添加到``元素中。\n如果`app`目录是应用的根目录,对于本应用,可以像这样设置**`index.html`**中的`href`值:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
+ {
+ "original": "Live example note",
+ "translation": "在线例子说明",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
+ },
{
"original": "A live coding environment like Stackblitz sets the application base address dynamically so you can't specify a fixed address.\nThat's why the example code replaces the `
` with a script that writes the `
` tag on the fly.",
"translation": "像Plunker这样的在线编程环境会动态设置应用的基地址(base href),因此我们没办法指定固定的地址。\n这就是为什么我们要用一个脚本动态写入`
`标签,而不是直接写`
`。",
@@ -14876,7 +15031,7 @@
},
{
"original": "You've learned how to do the following:",
- "translation": "我们已经学会了如何:",
+ "translation": "我们学到了如何:",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
@@ -14995,7 +15150,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "Next, update the `app.module.ts` file,\nfirst importing the newly created `AppRoutingModule` from `app-routing.module.ts`,\nthen replacing `RouterModule.forRoot` in the `imports` array with the `AppRoutingModule`.",
+ "original": "Next, update the `app.module.ts` file,\nfirst importing the newly created `AppRoutingModule`from `app-routing.module.ts`,\nthen replacing `RouterModule.forRoot` in the `imports` array with the `AppRoutingModule`.",
"translation": "接下来,修改`app.module.ts`文件,首先从`app-routing.module.ts`中导入新创建的`AppRoutingModule`,\n然后把`imports`数组中的`RouterModule.forRoot`替换为`AppRoutingModule`。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -15035,13 +15190,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "Most developers should always implement a Routing Module for the sake of consistency.",
- "translation": "大多数开发者应该采用路由模块,以保持一致性。",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
- },
- {
- "original": "It keeps the code clean when configuration becomes complex.\nIt makes testing the feature module easier.\nIts existence calls attention to the fact that a module is routed.\nIt is where developers expect to find and expand routing configuration.",
- "translation": "它在配置复杂时,能确保代码干净。\n它让测试特性模块更加容易。\n它的存在让我们一眼就能看出这个模块是带路由的。\n开发者可以很自然的从路由模块中查找和扩展路由配置。",
+ "original": "Most developers should always implement a Routing Module for the sake of consistency.\nIt keeps the code clean when configuration becomes complex.\nIt makes testing the feature module easier.\nIts existence calls attention to the fact that a module is routed.\nIt is where developers expect to find and expand routing configuration.",
+ "translation": "大多数开发者都应该采用路由模块,以保持一致性。\n它在配置复杂时,能确保代码干净。\n它让测试特性模块更加容易。\n它的存在让我们一眼就能看出这个模块是带路由的。\n开发者可以很自然的从路由模块中查找和扩展路由配置。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
@@ -15061,7 +15211,7 @@
},
{
"original": "* Navigate imperatively from one component to another.",
- "translation": "命令式地从一个组件导航到另一个组件",
+ "translation": "命令式的从一个组件导航到另一个",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
@@ -15570,7 +15720,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "Use [*route parameters*](#route-parameters) to specify a *required* parameter value *within* the route URL\nas you do when navigating to the `HeroDetailComponent` in order to view the hero with *id*15:",
+ "original": "Use [*route parameters*](#route-parameters) to specify a *required* parameter value *within* the route URL\nas you do when navigating to the `HeroDetailComponent` in order to view the hero with *id* 15:",
"translation": "如果想导航到`HeroDetailComponent`以对id为15的英雄进行查看并编辑,就要在路由的URL中使用[*路由参数*](guide/router#route-parameters)来指定*必要*参数值。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -16050,13 +16200,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "The `Crisis Detail` route is a child of the `Crisis List`. Since the router [reuses components](#reuse)\nby default, the `Crisis Detail` component will be re-used as you select different crises.",
- "translation": "`Crisis Detail`路由是`Crisis List`的子路由。由于路由器默认会[复用组件](guide/router#reuse),因此当我们选择了另一个危机时,`CrisisDetailComponent`会被复用。",
- "sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
- },
- {
- "original": "In contrast, back in the `Hero Detail` route, the component was recreated each time you selected a different hero.",
- "translation": "作为对比,回到`Hero Detail`路由时,每当我们选择了不同的英雄时,该组件都会被重新创建。",
+ "original": "The `Crisis Detail` route is a child of the `Crisis List`. Since the router [reuses components](#reuse)\nby default, the `Crisis Detail` component will be re-used as you select different crises.\nIn contrast, back in the `Hero Detail` route, the component was recreated each time you selected a different hero.",
+ "translation": "`Crisis Detail`路由是`Crisis List`的子路由。由于路由器默认会[复用组件](guide/router#reuse),因此当我们选择了另一个危机时,`CrisisDetailComponent`会被复用。 \n作为对比,回到`Hero Detail`路由时,每当我们选择了不同的英雄时,该组件都会被重新创建。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
@@ -16715,12 +16860,12 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "You need a `LoginComponent` for the user to log in to the app. After logging in, you'll redirect\n to the stored URL if available, or use the default URL.\n There is nothing new about this component or the way you wire it into the router configuration.",
+ "original": "You need a `LoginComponent` for the user to log in to the app. After logging in, you'll redirect\nto the stored URL if available, or use the default URL.\nThere is nothing new about this component or the way you wire it into the router configuration.",
"translation": "我们需要一个`LoginComponent`来让用户登录进这个应用。在登录之后,我们跳转到前面保存的URL,如果没有,就跳转到默认URL。\n 该组件没有什么新内容,我们把它放进路由配置的方式也没什么新意。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "Register a `/login` route in the `login-routing.module.ts` and add the necessary providers to the `providers`\n array. In `app.module.ts`, import the `LoginComponent` and add it to the `AppModule` `declarations`.\n Import and add the `LoginRoutingModule` to the `AppModule` imports as well.",
+ "original": "Register a `/login` route in the `login-routing.module.ts` and add the necessary providers to the `providers`\narray. In `app.module.ts`, import the `LoginComponent` and add it to the `AppModule` `declarations`.\nImport and add the `LoginRoutingModule` to the `AppModule` imports as well.",
"translation": "我们将在`login-routing.module.ts`中注册一个`/login`路由,并把必要的提供商添加`providers`数组中。\n在`app.module.ts`中,我们导入`LoginComponent`并把它加入根模块的`declarations`中。\n同时在`AppModule`中导入并添加`LoginRoutingModule`。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -16876,7 +17021,7 @@
},
{
"original": "Now you have given the user a safeguard against unsaved changes.",
- "translation": "现在,我们已经给了用户一个能保护未保存更改的安全守卫。\n{@a Resolve}",
+ "translation": "现在,我们已经给了用户一个能保护未保存更改的安全守卫。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
@@ -17380,7 +17525,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "An implementation of `preload` must return an `Observable`.\nIf the route should preload, it returns the observable returned by calling the loader function.\nIf the route should _not_ preload, it returns an `Observable` of `null`.",
+ "original": "An implementation of `preload`must return an `Observable`.\nIf the route should preload, it returns the observable returned by calling the loader function.\nIf the route should _not_ preload, it returns an `Observable` of `null`.",
"translation": "`preload`的实现必须返回一个`Observable`。\n如果该路由应该预加载,它就会返回调用加载器函数所返回的`Observable`。\n如果该路由*不*应该预加载,它就返回一个`null`值的`Observable`对象。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -17415,7 +17560,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "1. Add the `SelectivePreloadingStrategy` strategy to the `AppRoutingModule` providers array so it can be injected \nelsewhere in the app.",
+ "original": "1. Add the `SelectivePreloadingStrategy` strategy to the `AppRoutingModule` providers array so it can be injected\nelsewhere in the app.",
"translation": "把`SelectivePreloadingStrategy`策略添加到`AppRoutingModule`的`providers`数组中,以便它可以注入到应用中的任何地方。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -17755,7 +17900,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
{
- "original": "While the router uses the \n
HTML5 pushState\nstyle by default, you *must* configure that strategy with a **base href**.",
+ "original": "While the router uses the\n
HTML5 pushState\nstyle by default, you *must* configure that strategy with a **base href**.",
"translation": "由于路由器默认使用“
HTML 5 pushState”风格,所以我们*必须*用一个**base href**来配置该策略(Strategy)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
@@ -17799,6 +17944,11 @@
"translation": "我们可以在根模块的`RouterModule.forRoot`的第二个参数中传入一个带有`useHash: true`的对象,以回到基于`HashLocationStrategy`的传统方式。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/router.md"
},
+ {
+ "original": "## Error handling",
+ "translation": "## 错误处理",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/rx-library.md"
+ },
{
"original": "# Security",
"translation": "# 安全",
@@ -17819,6 +17969,11 @@
"translation": "运行
来试用本页的代码。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
},
+ {
+ "original": "Reporting vulnerabilities",
+ "translation": "举报漏洞",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
+ },
{
"original": "To report vulnerabilities in Angular itself, email us at [security@angular.io](mailto:security@angular.io).",
"translation": "给我们([security@angular.io](mailto:security@angular.io))发邮件,报告Angular本身的漏洞。",
@@ -17829,6 +17984,11 @@
"translation": "要了解关于“谷歌如何处理安全问题”的更多信息,参见[谷歌的安全哲学](https://www.google.com/about/appsecurity/)。",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
},
+ {
+ "original": "Best practices",
+ "translation": "最佳实践",
+ "sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
+ },
{
"original": "* **Keep current with the latest Angular library releases.**\nWe regularly update the Angular libraries, and these updates may fix security defects discovered in\nprevious versions. Check the Angular [change\nlog](https://github.com/angular/angular/blob/master/CHANGELOG.md) for security-related updates.",
"translation": "**及时把Angular包更新到最新版本。**\n我们会频繁的更新Angular库,这些更新可能会修复之前版本中发现的安全漏洞。查看Angular的[更新记录](https://github.com/angular/angular/blob/master/CHANGELOG.md),了解与安全有关的更新。",
@@ -17845,8 +18005,8 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
},
{
- "original": "## Preventing cross-site scripting (XSS)",
- "translation": "## 防范跨站脚本(XSS)攻击",
+ "original": "Preventing cross-site scripting (XSS)",
+ "translation": "防范跨站脚本(XSS)攻击",
"sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
},
{
@@ -17855,7 +18015,7 @@
"sourceFile": "/Users/twer/private/GDE/content-3/guide/security.md"
},
{
- "original": "To block XSS attacks, you must prevent malicious code from entering the DOM(Document Object Model). For example, if\nattackers can trick you into inserting a `