From d3ed81064b35cdc94603e86ad7c60a54e7fb9307 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Tue, 15 May 2018 23:10:30 +0800 Subject: [PATCH] chore: extract dict --- aio/tools/translator/dict-latest.json | 3548 +++++++++++++++---------- 1 file changed, 2119 insertions(+), 1429 deletions(-) diff --git a/aio/tools/translator/dict-latest.json b/aio/tools/translator/dict-latest.json index 3f506df9bb..104980d623 100644 --- a/aio/tools/translator/dict-latest.json +++ b/aio/tools/translator/dict-latest.json @@ -42,9 +42,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" }, { - "key": "#ANGULARJSTOANGULARQUICKREFERENCE", - "original": "# AngularJS to Angular Quick Reference", - "translation": "# 从 AngularJS 到 Angular 快速参考", + "key": "#ANGULARJSTOANGULARCONCEPTS:QUICKREFERENCE", + "original": "# AngularJS to Angular Concepts: Quick Reference", + "translation": "# 关于AngularJS 与 Angular 概念的快速参考", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -990,9 +990,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { - "key": "WITHTHEANGULARCLIYOUCANCONFIGUREYOURGLOBALSTYLESINTHEANGULARCLIJSONFILEYOUCANRENAMETHEEXTENSIONTOSCSSTOUSESASS", - "original": "With the Angular CLI, you can configure your global styles in the `.angular-cli.json` file.\n You can rename the extension to `.scss` to use sass.", - "translation": "使用 Angular CLI,你可以在 `.angular-cli.json` 文件中配置全局样式。\n 也可以把扩展名改为 `.scss` 来使用 sass。", + "key": "WITHTHEANGULARCLIYOUCANCONFIGUREYOURGLOBALSTYLESINTHEANGULARJSONFILEYOUCANRENAMETHEEXTENSIONTOSCSSTOUSESASS", + "original": "With the Angular CLI, you can configure your global styles in the `angular.json` file.\n You can rename the extension to `.scss` to use sass.", + "translation": "使用 Angular CLI,你可以在 `angular.json` 文件中配置全局样式。\n 也可以把扩展名改为 `.scss` 来使用 sass。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ajs-quick-reference.md" }, { @@ -1728,8 +1728,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "METADATAJSONFILESCONTAININFOMRATIONNEEDEDBYTHETEMPLATECOMPILERFROMATSFILETHATISNOTINCLUDEDINTHEDTSFILEPRODUCEDBYTHETYPESCRIPTCOMPILERTHISINFORMATIONCONTAINSFOREXAMPLETHECONTENTOFANNOTATIONSSUCHASACOMPONENTSTEMPLATEWHICHTYPESCRIPTEMITSTOTHEJSFILEBUTNOTTOTHEDTSFILE", - "original": "`.metadata.json` files contain infomration needed by the template compiler from a `.ts`\nfile that is not included in the `.d.ts` file produced by the TypeScript compiler. This information contains,\nfor example, the content of annotations (such as a component's template) which TypeScript\nemits to the `.js` file but not to the `.d.ts` file.", + "key": "METADATAJSONFILESCONTAININFORMATIONNEEDEDBYTHETEMPLATECOMPILERFROMATSFILETHATISNOTINCLUDEDINTHEDTSFILEPRODUCEDBYTHETYPESCRIPTCOMPILERTHISINFORMATIONCONTAINSFOREXAMPLETHECONTENTOFANNOTATIONSSUCHASACOMPONENTSTEMPLATEWHICHTYPESCRIPTEMITSTOTHEJSFILEBUTNOTTOTHEDTSFILE", + "original": "`.metadata.json` files contain information needed by the template compiler from a `.ts`\nfile that is not included in the `.d.ts` file produced by the TypeScript compiler. This information contains,\nfor example, the content of annotations (such as a component's template) which TypeScript\nemits to the `.js` file but not to the `.d.ts` file.", "translation": "`.metadata.json` 文件中包含模板编译器所需的信息,这些信息来自于 `.ts` 文件中,但是没有包含在由 TypeScript 编译器生成的 `.d.ts` 文件中。\n比如,这个信息包括 TypeScript 发出的注解内容(如组件的模板),TypeScript 把它生成到了 `.js` 文件中,但是没有生成到 `.d.ts` 文件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -1747,8 +1747,8 @@ }, { "key": "THISOPTIONTELLSTHETEMPLATECOMPILERTOREPORTANERRORTOTHEMETADATAJSONFILEIFSKIPMETADATAEMITISFALSETHISOPTIONISFALSEBYDEFAULTTHISSHOULDONLYBEUSEDWHENSKIPMETADATAEMITISFALSEANDSKIPTEMPLATECODEGENISTRUE", - "original": "This option tells the template compiler to report an error to the `.metadata.json`\nfile if `\"skipMetadataEmit\"` is `false` . This option is `false` by default. This should only be used when `\"skipMetadataEmit\"` is `false` and `\"skipTemplateCodeGen\"` is `true`.", - "translation": "这个选项告诉模板编译器如果 `\"skipMetadataEmit\"` 为 `false`,那就把错误信息汇报到 `.metadata.json` 中。\n只有当 `\"skipMetadataEmit\"` 为 `false` 且 `\"skipTemplateCodeGen\"` 为 `true` 时才应该使用这个选项。", + "original": "This option tells the template compiler to report an error to the `.metadata.json`\nfile if `\"skipMetadataEmit\"` is `false` . This option is `false` by default. This should only be used when `\"skipMetadataEmit\"` is `false` and `\"skipTemplateCodegen\"` is `true`.", + "translation": "这个选项告诉模板编译器如果 `\"skipMetadataEmit\"` 为 `false`,那就把错误信息汇报到 `.metadata.json` 中。\n只有当 `\"skipMetadataEmit\"` 为 `false` 且 `\"skipTemplateCodegen\"` 为 `true` 时才应该使用这个选项。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -1812,9 +1812,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "THISOPTIONTELLSTHECOMPILERTOENABLETHEBINDINGEXPRESSIONVALIDATION#BINDINGEXPRESIONVALIDATIONPHASEOFTHETEMPLATECOMPILERWHICHUSESTYPESCRIPTTOVALIDATEBINDINGEXPRESSIONS", - "original": "This option tells the compiler to enable the [binding expression validation](#binding-expresion-validation)\nphase of the template compiler which uses TypeScript to validate binding expressions.", - "translation": "该选项告诉编译器要为模板编译器启用[绑定表达式验证](#binding-expresion-validation)阶段,它会使用 TypeScript 来验证绑定表达式。", + "key": "THISOPTIONTELLSTHECOMPILERTOENABLETHEBINDINGEXPRESSIONVALIDATION#BINDINGEXPRESSIONVALIDATIONPHASEOFTHETEMPLATECOMPILERWHICHUSESTYPESCRIPTTOVALIDATEBINDINGEXPRESSIONS", + "original": "This option tells the compiler to enable the [binding expression validation](#binding-expression-validation)\nphase of the template compiler which uses TypeScript to validate binding expressions.", + "translation": "该选项告诉编译器要为模板编译器启用[绑定表达式验证](#binding-expression-validation)阶段,它会使用 TypeScript 来验证绑定表达式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { @@ -2088,8 +2088,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "BEGINNINGINVERSION5THECOMPILERAUTOMATICALLYPERFORMSTHISREWRITTINGWHILEEMITTINGTHEJSFILE", - "original": "Beginning in version 5, the compiler automatically performs this rewritting while emitting the `.js` file.", + "key": "BEGINNINGINVERSION5THECOMPILERAUTOMATICALLYPERFORMSTHISREWRITINGWHILEEMITTINGTHEJSFILE", + "original": "Beginning in version 5, the compiler automatically performs this rewriting while emitting the `.js` file.", "translation": "从 Angular v5 开始,编译器会在生成 `.js` 文件时自动执行这种改写。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -2400,8 +2400,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "THECOMPILERENCOUNTEREDANEXPRESSIONITDIDNTUNDERSTANDWHILEEVALUTATINGANGULARMETADATA", - "original": "The compiler encountered an expression it didn't understand while evalutating Angular metadata.", + "key": "THECOMPILERENCOUNTEREDANEXPRESSIONITDIDNTUNDERSTANDWHILEEVALUATINGANGULARMETADATA", + "original": "The compiler encountered an expression it didn't understand while evaluating Angular metadata.", "translation": "编译器在对 Angular 元数据求值时遇到了一个它不能理解的表达式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -2628,8 +2628,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "THISCANHAPPENIFYOUREFERTOANAMBIENTTYPEFOREXAMPLETHEWINDOWTYPEISANAMBIANTTYPEDECLAREDINTHEGLOBALDTSFILE", - "original": "This can happen if you refer to an ambient type.\nFor example, the `Window` type is an ambiant type declared in the global `.d.ts` file.", + "key": "THISCANHAPPENIFYOUREFERTOANAMBIENTTYPEFOREXAMPLETHEWINDOWTYPEISANAMBIENTTYPEDECLAREDINTHEGLOBALDTSFILE", + "original": "This can happen if you refer to an ambient type.\nFor example, the `Window` type is an ambient type declared in the global `.d.ts` file.", "translation": "这通常会发生在你引用环境类型时。\n比如,`Window` 类型就是在全局 `.d.ts` 文件中声明的环境类型。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -2640,8 +2640,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "TYPESCRIPTUNDERSTANDSAMBIANTTYPESSOYOUDONTIMPORTTHEMTHEANGULARCOMPILERDOESNOTUNDERSTANDATYPETHATYOUNEGLECTTOEXPORTORIMPORT", - "original": "TypeScript understands ambiant types so you don't import them.\nThe Angular compiler does not understand a type that you neglect to export or import.", + "key": "TYPESCRIPTUNDERSTANDSAMBIENTTYPESSOYOUDONTIMPORTTHEMTHEANGULARCOMPILERDOESNOTUNDERSTANDATYPETHATYOUNEGLECTTOEXPORTORIMPORT", + "original": "TypeScript understands ambient types so you don't import them.\nThe Angular compiler does not understand a type that you neglect to export or import.", "translation": "TypeScript 能理解这些环境类型,所以你不用导入它们。\n但 Angular 编译器不理解你没有导入或导出过的类型。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -2658,14 +2658,14 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "IFYOUMUSTINJECTANINSTANCEOFANAMBIANTTYPEYOUCANFINESSETHEPROBLEMINFOURSTEPS:", - "original": "If you must inject an instance of an ambiant type,\nyou can finesse the problem in four steps:", + "key": "IFYOUMUSTINJECTANINSTANCEOFANAMBIENTTYPEYOUCANFINESSETHEPROBLEMINFOURSTEPS:", + "original": "If you must inject an instance of an ambient type,\nyou can finesse the problem in four steps:", "translation": "如果你必须注入某个环境类型的实例,可以用以下四步来巧妙解决这个问题:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "1CREATEANINJECTIONTOKENFORANINSTANCEOFTHEAMBIANTTYPE", - "original": "1. Create an injection token for an instance of the ambiant type.", + "key": "1CREATEANINJECTIONTOKENFORANINSTANCEOFTHEAMBIENTTYPE", + "original": "1. Create an injection token for an instance of the ambient type.", "translation": "为环境类型的实例创建一个注入令牌。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -2796,8 +2796,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "INTHEVALIDATIONPHASETHEANGULARTEMPLATECOMPILERUSESTHETYPESCRIPTCOMPILERTOVALIDATETHEBINDINGEXPRESSIONSINTEMPLATESENABLETHISPHASEEXPLICITYBYADDINGTHECOMPILEROPTIONFULLTEMPLATETYPECHECKINTHEANGULARCOMPILEROPTIONSOFTHEPROJECTSTSCONFIGJSONSEEANGULARCOMPILEROPTIONS#COMPILEROPTIONS", - "original": "In the validation phase, the Angular template compiler uses the TypeScript compiler to validate the\n binding expressions in templates. Enable this phase explicity by adding the compiler\n option `\"fullTemplateTypeCheck\"` in the `\"angularCompilerOptions\"` of the project's `tsconfig.json` (see\n [Angular Compiler Options](#compiler-options)).", + "key": "INTHEVALIDATIONPHASETHEANGULARTEMPLATECOMPILERUSESTHETYPESCRIPTCOMPILERTOVALIDATETHEBINDINGEXPRESSIONSINTEMPLATESENABLETHISPHASEEXPLICITLYBYADDINGTHECOMPILEROPTIONFULLTEMPLATETYPECHECKINTHEANGULARCOMPILEROPTIONSOFTHEPROJECTSTSCONFIGJSONSEEANGULARCOMPILEROPTIONS#COMPILEROPTIONS", + "original": "In the validation phase, the Angular template compiler uses the TypeScript compiler to validate the\n binding expressions in templates. Enable this phase explicitly by adding the compiler\n option `\"fullTemplateTypeCheck\"` in the `\"angularCompilerOptions\"` of the project's `tsconfig.json` (see\n [Angular Compiler Options](#compiler-options)).", "translation": "在验证阶段,Angular 的模板编译器会使用 TypeScript 编译器来验证模板中的绑定表达式。\n 通过在项目的 `tsconfig.json`(参见 [Angular Compiler Options](#compiler-options))的 `\"angularCompilerOptions\"` 中添加编译选项 `\"fullTemplateTypeCheck\"` 可以启用这个阶段。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -2820,8 +2820,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, { - "key": "THEFILENAMEREPORTEDINTHEERRORMESSAGEMYCOMPONENTTSMYCOMPONENTHTMLISASYNTHETICFILEGENERATEDBYTHETEMPLATECOMPILERTHATHOLDSCONTENTSOFTHEMYCOMPONENTCLASSTEMPLATECOMPILERNEVERWRITESTHISFILETODISKTHELINEANDCOLUMNNUMBERSARERELATIVETOTHETEMPLATESTRINGINTHECOMPONENTANNOTATIONOFTHECLASSMYCOMPONENTINTHISCASEIFACOMPONENTUSESTEMPLATEURLINSTEADOFTEMPLATETHEERRORSAREREPORTEDINTHEHTMLFILEREFERENECEDBYTHETEMPLATEURLINSTEADOFASYNTHETICFILE", - "original": "The file name reported in the error message, `my.component.ts.MyComponent.html`, is a synthetic file\n generated by the template compiler that holds contents of the `MyComponent` class template.\n Compiler never writes this file to disk. The line and column numbers are relative to the template string\n in the `@Component` annotation of the class, `MyComponent` in this case. If a component uses\n `templateUrl` instead of `template`, the errors are reported in the HTML file refereneced by the\n `templateUrl` instead of a synthetic file.", + "key": "THEFILENAMEREPORTEDINTHEERRORMESSAGEMYCOMPONENTTSMYCOMPONENTHTMLISASYNTHETICFILEGENERATEDBYTHETEMPLATECOMPILERTHATHOLDSCONTENTSOFTHEMYCOMPONENTCLASSTEMPLATECOMPILERNEVERWRITESTHISFILETODISKTHELINEANDCOLUMNNUMBERSARERELATIVETOTHETEMPLATESTRINGINTHECOMPONENTANNOTATIONOFTHECLASSMYCOMPONENTINTHISCASEIFACOMPONENTUSESTEMPLATEURLINSTEADOFTEMPLATETHEERRORSAREREPORTEDINTHEHTMLFILEREFERENCEDBYTHETEMPLATEURLINSTEADOFASYNTHETICFILE", + "original": "The file name reported in the error message, `my.component.ts.MyComponent.html`, is a synthetic file\n generated by the template compiler that holds contents of the `MyComponent` class template.\n Compiler never writes this file to disk. The line and column numbers are relative to the template string\n in the `@Component` annotation of the class, `MyComponent` in this case. If a component uses\n `templateUrl` instead of `template`, the errors are reported in the HTML file referenced by the\n `templateUrl` instead of a synthetic file.", "translation": "错误信息中汇报的文件名 `my.component.ts.MyComponent.html` 是一个由模板编译器生成出的虚拟文件,\n 用于保存 `MyComponent` 类的模板内容。\n 编译器永远不会把这个文件写入磁盘。这个例子中,这里的行号和列号都是相对于 `MyComponent` 的 `@Component` 注解中的模板字符串的。\n 如果组件使用 `templateUrl` 来代替 `template`,这些错误就会在 `templateUrl` 引用的 HTML 文件中汇报,而不是这个虚拟文件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/aot-compiler.md" }, @@ -3054,8 +3054,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" }, { - "key": "THECOMPONENTDECORATORIDENTIFIESTHECLASSIMMEDIATELYBELOWITASACOMPONENTCLASSANDSPECIFIESITSMETADATAINTHEEXAMPLECODEBELOWYOUCANSEETHATHEROLISTCOMPONENTISJUSTACLASSWITHNOSPECIALANGULARNOTATIONORSYNTAXATALLITSNOTACOMPONENTUNTILMARKITASONEWITHTHECOMPONENTDECORATOR", - "original": "The `@Component` decorator identifies the class immediately below it as a component class, and specifies its metadata. In the example code below, you can see that `HeroListComponent` is just a class, with no special Angular notation or syntax at all. It's not a component until mark it as one with the `@Component` decorator.", + "key": "THECOMPONENTDECORATORIDENTIFIESTHECLASSIMMEDIATELYBELOWITASACOMPONENTCLASSANDSPECIFIESITSMETADATAINTHEEXAMPLECODEBELOWYOUCANSEETHATHEROLISTCOMPONENTISJUSTACLASSWITHNOSPECIALANGULARNOTATIONORSYNTAXATALLITSNOTACOMPONENTUNTILYOUMARKITASONEWITHTHECOMPONENTDECORATOR", + "original": "The `@Component` decorator identifies the class immediately below it as a component class, and specifies its metadata. In the example code below, you can see that `HeroListComponent` is just a class, with no special Angular notation or syntax at all. It's not a component until you mark it as one with the `@Component` decorator.", "translation": "`@Component` 装饰器会指出紧随其后的那个类是个组件类,并为其指定元数据。\n在下面的范例代码中,你可以看到 `HeroListComponent` 只是一个普通类,完全没有 Angular 特有的标记或语法。\n直到给它加上了 `@Component` 装饰器,它才变成了组件。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/architecture-components.md" }, @@ -5052,9 +5052,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" }, { - "key": "FORMOREONNGMODULESYOURELIKELYTOSEEFREQUENTLYINAPPSSEEFREQUENTLYUSEDMODULES#", - "original": "For more on NgModules you're likely to see frequently in apps,\nsee [Frequently Used Modules](#).", - "translation": "要进一步了解常见的 NgModules 知识,参见 [关于模块的常见问题](#)。", + "key": "FORMOREONNGMODULESYOURELIKELYTOSEEFREQUENTLYINAPPSSEEFREQUENTLYUSEDMODULESGUIDEFREQUENTNGMODULES", + "original": "For more on NgModules you're likely to see frequently in apps,\nsee [Frequently Used Modules](guide/frequent-ngmodules).", + "translation": "要进一步了解常见的 NgModules 知识,参见 [关于模块的常见问题](guide/frequent-ngmodules)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/bootstrapping.md" }, { @@ -6270,15 +6270,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" }, { - "key": "PCALLEDAFTERCODENGAFTERCONTENTINITCODEWHENTHECOMPONENTSVIEWHASBEENINITIALIZEDAPPLIESTOCOMPONENTSONLYP", - "original": "

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

", - "translation": "

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

", + "key": "PCALLEDAFTERCODENGAFTERCONTENTINITCODEWHENTHECOMPONENTSVIEWSANDCHILDVIEWSTHEVIEWTHATADIRECTIVEISINHASBEENINITIALIZEDP", + "original": "

Called after ngAfterContentInit when the component's views and child views / the view that a directive is in has been initialized.

", + "translation": "

ngAfterContentInit完毕,并且组件的视图及其子视图或指令所属的视图已经初始化完毕时调用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" }, { - "key": "PCALLEDAFTEREVERYCHECKOFTHECOMPONENTSVIEWAPPLIESTOCOMPONENTSONLYP", - "original": "

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

", - "translation": "

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

", + "key": "PCALLEDAFTEREVERYCHECKOFTHECOMPONENTSVIEWSANDCHILDVIEWSTHEVIEWTHATADIRECTIVEISINP", + "original": "

Called after every check of the component's views and child views / the view that a directive is in.

", + "translation": "

当组件的视图及其子视图或指令所属的视图每次执行变更检测时调用。

", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/cheatsheet.md" }, { @@ -7530,9 +7530,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" }, { - "key": "WHENBUILDINGWITHTHECLIYOUMUSTCONFIGURETHEANGULARCLIJSONTOINCLUDEALLEXTERNALASSETSINCLUDINGEXTERNALSTYLEFILES", - "original": "When building with the CLI, you must configure the `.angular-cli.json` to include _all external assets_, including external style files.", - "translation": "当使用 CLI 进行构建时,你必须配置 `.angular-cli.json` 文件,使其包含*所有外部资源*(包括外部的样式表文件)。", + "key": "WHENBUILDINGWITHTHECLIYOUMUSTCONFIGURETHEANGULARJSONTOINCLUDEALLEXTERNALASSETSINCLUDINGEXTERNALSTYLEFILES", + "original": "When building with the CLI, you must configure the `angular.json` to include _all external assets_, including external style files.", + "translation": "当使用 CLI 进行构建时,你必须配置 `angular.json` 文件,使其包含*所有外部资源*(包括外部的样式表文件)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/component-styles.md" }, { @@ -7704,21 +7704,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "REGISTERPROVIDERSFORDEPENDENCIESUSEDTHROUGHOUTTHEAPPLICATIONINTHEROOTAPPLICATIONCOMPONENTAPPCOMPONENT", - "original": "Register providers for dependencies used throughout the application in the root application component, `AppComponent`.", - "translation": "在应用程序根组件 `AppComponent` 中注册那些被应用程序全局使用的依赖提供商。", + "key": "REGISTERPROVIDERSFORDEPENDENCIESUSEDTHROUGHOUTTHEAPPLICATIONINTHEINJECTABLEDECORATOROFTHESERVICEITSELF", + "original": "Register providers for dependencies used throughout the application \nin the `@Injectable()` decorator of the service itself.", + "translation": "在服务本身的 `@Injectable()` 装饰器中注册那些将被应用程序全局使用的依赖提供商。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "THEFOLLOWINGEXAMPLESHOWSIMPORTINGANDREGISTERINGTHELOGGERSERVICEUSERCONTEXTANDTHEUSERSERVICEINTHECOMPONENTMETADATAPROVIDERSARRAY", - "original": "The following example shows importing and registering\nthe `LoggerService`, `UserContext`, and the `UserService`\nin the `@Component` metadata `providers` array.", - "translation": "在下面的例子中,通过 `@Component` 元数据的 `providers` 数组导入和注册了几个服务(`LoggerService`, `UserContext` 和 `UserService`)。", + "key": "PROVIDEDINHERETELLSANGULARTHATTHEROOTINJECTORISRESPONSIBLEFORCREATINGANINSTANCEOFTHEHEROSERVICESERVICESTHATAREPROVIDEDTHISWAYAREAUTOMATICALLYMADEAVAILABLETOTHEENTIREAPPLICATIONANDDONTNEEDTOBELISTEDINANYMODULE", + "original": "`providedIn` here tells Angular that the root injector is responsible for creating an instance of the `HeroService`.\nServices that are provided this way are automatically made available to the entire \napplication and don't need to be listed in any module.", + "translation": "这里的 `providedIn` 告诉 Angular,要由根注入器负责创建 `HeroService` 的实例。\n所有用这种方式提供的服务,都会自动在整个应用中可用,而不必把它们显式列在任何模块中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "ALLOFTHESESERVICESAREIMPLEMENTEDASCLASSESSERVICECLASSESCANACTASTHEIROWNPROVIDERSWHICHISWHYLISTINGTHEMINTHEPROVIDERSARRAYISALLTHEREGISTRATIONYOUNEED", - "original": "All of these services are implemented as classes.\nService classes can act as their own providers which is why listing them in the `providers` array\nis all the registration you need.", - "translation": "所有这些服务都是用类实现的。服务类能充当自己的提供商,这就是为什么只要把它们列在 `providers` 数组里就算注册成功了。", + "key": "SERVICECLASSESCANACTASTHEIROWNPROVIDERSWHICHISWHYDEFININGTHEMINTHEINJECTABLEDECORATORISALLTHEREGISTRATIONYOUNEED", + "original": "Service classes can act as their own providers which is why defining them in the `@Injectable` decorator\nis all the registration you need.", + "translation": "这些服务类可以充当自己的提供商,因此你只要把它们定义在 `@Injectable` 装饰器中就算注册成功了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { @@ -7740,21 +7740,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "GENERALLYREGISTERPROVIDERSINTHENGMODULERATHERTHANINTHEROOTAPPLICATIONCOMPONENT", - "original": "Generally, register providers in the `NgModule` rather than in the root application component.", - "translation": "通常会在 `NgModule` 中注册提供商,而不是在应用程序根组件中。", + "key": "IFAPROVIDERCANNOTBECONFIGUREDINTHEINJECTABLEDECORATOROFTHESERVICETHENREGISTERAPPLICATIONWIDEPROVIDERSINTHEROOTAPPMODULENOTINTHEAPPCOMPONENTGENERALLYREGISTERPROVIDERSINTHENGMODULERATHERTHANINTHEROOTAPPLICATIONCOMPONENT", + "original": "If a provider cannot be configured in the `@Injectable` decorator of the service, then register application-wide providers in the root `AppModule`, not in the `AppComponent`. Generally, register providers in the `NgModule` rather than in the root application component.", + "translation": "如果某个提供商不是在服务的 `@Injectable` 装饰器中配置的,那么就要在根模块 `AppModule` 中把它注册为全应用级的提供商,而不是在 `AppComponent` 中。\n一般来说,要在 `NgModule` 中注册提供商,而不是在应用程序根组件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "DOTHISWHENYOUEXPECTTHESERVICETOBEINJECTABLEEVERYWHEREORYOUARECONFIGURINGANOTHERAPPLICATIONGLOBALSERVICEBEFORETHEAPPLICATIONSTARTS", - "original": "Do this when you expect the service to be injectable everywhere,\nor you are configuring another application global service _before the application starts_.", - "translation": "如果你希望这个服务在应用中到处都可以被注入,或者必须在应用**启动前**注册一个全局服务,那就这么做。", + "key": "DOTHISWHENUSERSSHOULDEXPLICITLYOPTINTOUSEASERVICEORTHESERVICESHOULDBEPROVIDEDINALAZILYLOADEDCONTEXTORWHENYOUARECONFIGURINGANOTHERAPPLICATIONGLOBALSERVICEBEFORETHEAPPLICATIONSTARTS", + "original": "Do this when users should explicitly opt-in to use a service, or the service should be \nprovided in a lazily-loaded context, \nor when you are configuring another application global service _before the application starts_.", + "translation": "下列情况下会用到这种方法:1. 当用户应该明确选择所用的服务时。2. 当你要在惰性加载的上下文中提供该服务时。3. 当你要在应用启动之前配置应用中的另一个全局服务时。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "HEREISANEXAMPLEOFTHESECONDCASEWHERETHECOMPONENTROUTERCONFIGURATIONINCLUDESANONDEFAULTLOCATIONSTRATEGYGUIDEROUTER#LOCATIONSTRATEGYBYLISTINGITSPROVIDERINTHEPROVIDERSLISTOFTHEAPPMODULE", - "original": "Here is an example of the second case, where the component router configuration includes a non-default\n[location strategy](guide/router#location-strategy) by listing its provider\nin the `providers` list of the `AppModule`.", - "translation": "下面的例子是第二种情况,它为组件路由器配置了一个非默认的[地址策略(location strategy)](guide/router#location-strategy),并把它加入到 `AppModule` 的 `providers` 数组中。", + "key": "HEREISANEXAMPLEOFTHECASEWHERETHECOMPONENTROUTERCONFIGURATIONINCLUDESANONDEFAULTLOCATIONSTRATEGYGUIDEROUTER#LOCATIONSTRATEGYBYLISTINGITSPROVIDERINTHEPROVIDERSLISTOFTHEAPPMODULE", + "original": "Here is an example of the case where the component router configuration includes a non-default\n[location strategy](guide/router#location-strategy) by listing its provider\nin the `providers` list of the `AppModule`.", + "translation": "下面的例子就属于这些情况,它为组件路由器配置了一个非默认的[地址策略(location strategy)](guide/router#location-strategy),并把它加入到 `AppModule` 的 `providers` 数组中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { @@ -7818,33 +7818,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "THATDECORATORMAKESITPOSSIBLEFORANGULARTOIDENTIFYTHETYPESOFITSTWODEPENDENCIESLOGGERSERVICEANDUSERSERVICE", - "original": "That decorator makes it possible for Angular to identify the types of its two dependencies, `LoggerService` and `UserService`.", - "translation": "该装饰器让 Angular 有能力识别这两个依赖 `LoggerService` 和 `UserService` 的类型。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" - }, - { - "key": "TECHNICALLYTHEINJECTABLEDECORATORISONLYREQUIREDFORASERVICECLASSTHATHASITSOWNDEPENDENCIESTHELOGGERSERVICEDOESNTDEPENDONANYTHINGTHELOGGERWOULDWORKIFYOUOMITTEDINJECTABLEANDTHEGENERATEDCODEWOULDBESLIGHTLYSMALLER", - "original": "Technically, the `@Injectable()`decorator is only required for a service class that has _its own dependencies_.\nThe `LoggerService` doesn't depend on anything. The logger would work if you omitted `@Injectable()`\nand the generated code would be slightly smaller.", - "translation": "严格来说,这个 `@Injectable()` 装饰器只在一个服务类有*自己的依赖*的时候,才是*不可缺少*的。\n`LoggerService` 不依赖任何东西,所以该日志服务在没有 `@Injectable()` 的时候应该也能工作,生成的代码也更少一些。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" - }, - { - "key": "BUTTHESERVICEWOULDBREAKTHEMOMENTYOUGAVEITADEPENDENCYANDYOUDHAVETOGOBACKANDADDINJECTABLETOFIXITADDINJECTABLEFROMTHESTARTFORTHESAKEOFCONSISTENCYANDTOAVOIDFUTUREPAIN", - "original": "But the service would break the moment you gave it a dependency and you'd have to go back\nand add `@Injectable()` to fix it. Add `@Injectable()` from the start for the sake\nof consistency and to avoid future pain.", - "translation": "但是在给它添加依赖的那一瞬间,该服务就会停止工作,要想修复它,就必须要添加 `@Injectable()`。\n为了保持一致性和防止将来的麻烦,推荐从一开始就加上 `@Injectable()`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" - }, - { - "key": "ALTHOUGHTHISSITERECOMMENDSAPPLYINGINJECTABLETOALLSERVICECLASSESDONTFEELBOUNDBYITSOMEDEVELOPERSPREFERTOADDITONLYWHERENEEDEDANDTHATSAREASONABLEPOLICYTOO", - "original": "Although this site recommends applying `@Injectable()` to all service classes, don't feel bound by it.\nSome developers prefer to add it only where needed and that's a reasonable policy too.", - "translation": "虽然推荐在所有服务中使用 `@Injectable()`,但你也不需要一定要这么做。一些开发者就更喜欢在真正需要的地方才添加,这也是一个合理的策略。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" - }, - { - "key": "THEAPPCOMPONENTCLASSHADTWODEPENDENCIESASWELLBUTNOINJECTABLEITDIDNTNEEDINJECTABLEBECAUSETHATCOMPONENTCLASSHASTHECOMPONENTDECORATORINANGULARWITHTYPESCRIPTASINGLEDECORATORMDASHANYDECORATORMDASHISSUFFICIENTTOIDENTIFYDEPENDENCYTYPES", - "original": "The `AppComponent` class had two dependencies as well but no `@Injectable()`.\nIt didn't need `@Injectable()` because that component class has the `@Component` decorator.\nIn Angular with TypeScript, a *single* decorator—*any* decorator—is sufficient to identify dependency types.", - "translation": "`AppComponent` 类有两个依赖,但它没有 `@Injectable()`。\n它不需要 `@Injectable()`,这是因为组件类有 `@Component` 装饰器。\n在用 TypeScript 的 Angular 应用里,有一个*单独的*装饰器 — *任何*装饰器 — 来标识依赖的类型就够了。", + "key": "THEINJECTABLEDECORATORINDICATESTHATTHEANGULARDISYSTEMISUSEDTOCREATEONEORMOREINSTANCESOFUSERCONTEXTSERVICE", + "original": "The `@Injectable` decorator indicates that the Angular DI system is used to create one or more instances of `UserContextService`.", + "translation": "`@Injectable` 装饰器会向 Angular DI 系统指明应该为 `UserContextService` 创建一个实例还是多个实例。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { @@ -8178,9 +8154,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "ANEWINJECTORHASNOPROVIDERSANGULARINITIALIZESTHEINJECTORSITCREATESWITHSOMEPROVIDERSITCARESABOUTYOUHAVETOREGISTERYOUROWNAPPLICATIONPROVIDERSMANUALLYUSUALLYINTHEPROVIDERSARRAYOFTHECOMPONENTORDIRECTIVEMETADATA:", - "original": "A new injector has no providers.\nAngular initializes the injectors it creates with some providers it cares about.\nYou have to register your _own_ application providers manually,\nusually in the `providers` array of the `Component` or `Directive` metadata:", - "translation": "新建的注入器中没有提供商。\nAngular 会使用一些自带的提供商来初始化这些注入器。你必须自行注册属于*自己*的提供商,通常用 ` 组件 ` 或者 ` 指令 ` 元数据中的 `providers` 数组进行注册。", + "key": "ANEWINJECTORHASNOPROVIDERSANGULARINITIALIZESTHEINJECTORSITCREATESWITHSOMEPROVIDERSITCARESABOUTYOUHAVETOREGISTERYOUROWNAPPLICATIONPROVIDERSMANUALLYUSUALLYINTHEINJECTABLEDECORATOROFTHESERVICEPROVIDERSARRAYOFTHENGMODULEORDIRECTIVEMETADATA:", + "original": "A new injector has no providers.\nAngular initializes the injectors it creates with some providers it cares about.\nYou have to register your _own_ application providers manually,\nusually in the `@Injectable` decorator of the service, `providers` array of the `NgModule` or `Directive` metadata:", + "translation": "新建的注入器中没有提供商。\nAngular 会使用一些自带的提供商来初始化这些注入器。你必须自行注册属于*自己*的提供商,通常会在该服务的 `@Injectable` 装饰器中,或在 `NgModule` 或 `Directive` 元数据的 `providers` 数组中进行注册。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { @@ -8190,9 +8166,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { - "key": "THESIMPLECLASSPROVIDERISTHEMOSTTYPICALBYFARYOUMENTIONTHECLASSINTHEPROVIDERSARRAYANDYOUREDONE", - "original": "The simple class provider is the most typical by far.\nYou mention the class in the `providers` array and you're done.", - "translation": "简单的类提供商是最典型的例子。只要在 `providers` 数值里面提到该类就可以了。", + "key": "THESIMPLEWAYOFDEFININGPROVIDERSINTHEINJECTABLEDECORATOROFTHECLASSISRECOMMENDED", + "original": "The simple way of defining providers in the `@Injectable` decorator of the class is recommended.", + "translation": "建议直接在服务类的 `@Injectable` 装饰器中定义服务提供商。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" + }, + { + "key": "ANOTHERALTERNATIVEISTOMENTIONTHECLASSINTHEPROVIDERSARRAYOFTHENGMODULEANDYOUREDONE", + "original": "Another alternative is to mention the class in the providers array of the `@NgModule` and you're done.", + "translation": "备选方案是在 `@NgModule` 的 `providers` 数组中引用下这个类就可以了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection-in-action.md" }, { @@ -9282,15 +9264,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "THATCOMMANDCREATESTHEFOLLOWINGHEROSERVICESKELETON", - "original": "That command creates the following `HeroService` skeleton.", - "translation": "这条命令会创建如下的 `HeroService` 骨架代码:", + "key": "THECOMMANDABOVECREATESTHEFOLLOWINGHEROSERVICESKELETON", + "original": "The command above creates the following `HeroService` skeleton.", + "translation": "上述命令会创建如下的 `HeroService` 骨架代码:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "ASSUMEFORNOWTHATTHEINJECTABLEDECORATOR#INJECTABLEISANESSENTIALINGREDIENTINEVERYANGULARSERVICEDEFINITIONTHERESTOFTHECLASSHASBEENREWRITTENTOEXPOSEAGETHEROESMETHODTHATRETURNSTHESAMEMOCKDATAASBEFORE", - "original": "Assume for now that the [`@Injectable` decorator](#injectable) is an essential ingredient in every Angular service definition.\nThe rest of the class has been rewritten to expose a `getHeroes` method \nthat returns the same mock data as before.", - "translation": "目前先把 [`@Injectable` 装饰器](#injectable)当做定义每个 Angular 服务时的必备部分。\n把该类的其它部分改写为暴露一个返回和以前一样的 mock 数据的 `getHeroes` 方法。", + "key": "THEINJECTABLEDECORATORISANESSENTIALINGREDIENTINEVERYANGULARSERVICEDEFINITIONTHERESTOFTHECLASSHASBEENREWRITTENTOEXPOSEAGETHEROESMETHODTHATRETURNSTHESAMEMOCKDATAASBEFORE", + "original": "The `@Injectable` decorator is an essential ingredient in every Angular service definition.\nThe rest of the class has been rewritten to expose a `getHeroes` method \nthat returns the same mock data as before.", + "translation": "[`@Injectable` 装饰器](#injectable)是定义每个 Angular 服务时的必备部分。\n把该类的其它部分改写为暴露一个返回和以前一样的 mock 数据的 `getHeroes` 方法。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9306,15 +9288,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "##REGISTERASERVICEPROVIDER", - "original": "## Register a service provider", - "translation": "## 注册服务提供商", + "key": "##INJECTORS", + "original": "## Injectors", + "translation": "## 注入器", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "ASERVICEISJUSTACLASSINANGULARUNTILYOUREGISTERITWITHANANGULARDEPENDENCYINJECTOR", - "original": "A _service_ is just a class in Angular until you register it with an Angular dependency injector.", - "translation": "在你把 Angular 中的*服务*注册进依赖注入器(injector)之前,它只是一个普通的类。", + "key": "ASERVICELIKEHEROSERVICEISJUSTACLASSINANGULARUNTILYOUREGISTERITWITHANANGULARDEPENDENCYINJECTOR", + "original": "A _service_ like `HeroService` is just a class in Angular until you register it with an Angular dependency injector.", + "translation": "在你把 Angular 中的*服务类*(比如 `HeroService` )注册进依赖注入器(injector)之前,它只是个普通类而已。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9330,9 +9312,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "YOUDOHAVETOREGISTERPROVIDERSWITHANINJECTORBEFORETHEINJECTORCANCREATETHATSERVICE", - "original": "You do have to register _providers_ with an injector \nbefore the injector can create that service.", - "translation": "但在注入器能创建服务之前,你得先往注入器中注入这个服务的*提供商*。", + "key": "ANGULARDOESNTAUTOMATICALLYKNOWHOWYOUWANTTOCREATEINSTANCESOFYOURSERVICESORTHEINJECTORTOCREATEYOURSERVICEYOUMUSTCONFIGUREITBYSPECIFYINGPROVIDERSFOREVERYSERVICE", + "original": "Angular doesn't automatically know how you want to create instances of your services or the injector to create your service. You must configure it by specifying providers for every service.", + "translation": "Angular 本身没法自动判断你是打算自行创建服务类的实例,还是等注入器来创建它。你必须通过为每个服务指定服务提供商来配置它。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9342,33 +9324,51 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "YOULLLEARNMUCHMOREABOUTPROVIDERSBELOW#PROVIDERSFORNOWITISSUFFICIENTTOKNOWTHATTHEYCREATESERVICESANDMUSTBEREGISTEREDWITHANINJECTOR", - "original": "You'll learn much more about _providers_ [below](#providers).\nFor now it is sufficient to know that they create services\nand must be registered with an injector.", - "translation": "你可以在[稍后的部分](#providers)学到更多关于*提供商*的知识。\n不过目前,只要知道它们用于创建服务,以及它们必须用注入器进行注册就行了。", + "key": "YOULLLEARNMUCHMOREABOUTPROVIDERSBELOW#PROVIDERSFORNOWITISSUFFICIENTTOKNOWTHATTHEYCONFIGUREWHEREANDHOWSERVICESARECREATED", + "original": "You'll learn much more about _providers_ [below](#providers).\nFor now, it is sufficient to know that they configure where and how services are created.", + "translation": "你可以在[稍后的部分](#providers)学到更多关于*提供商*的知识。\n不过目前,你只要知道它们是用来配置服务应该在哪里创建以及如何创建的就够了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "YOUCANREGISTERAPROVIDERWITHANYANGULARDECORATORTHATSUPPORTSTHEPROVIDERSARRAYPROPERTY", - "original": "You can register a provider with any Angular decorator that supports the **`providers` array property**.", - "translation": "你可以使用 Angular 中那些支持 `providers` 数组属性的装饰器来注册提供商。", + "key": "THEREAREMANYWAYSTOREGISTERASERVICEPROVIDERWITHANINJECTORTHISSECTIONSHOWSTHEMOSTCOMMONWAYSOFCONFIGURINGAPROVIDERFORYOURSERVICES", + "original": "There are many ways to register a service provider with an injector. This section shows the most common ways \nof configuring a provider for your services.", + "translation": "有很多方式可以为注入器注册服务提供商。本节会展示为你的服务配置提供商最常见的途径。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "MANYANGULARDECORATORSACCEPTMETADATAWITHAPROVIDERSPROPERTYTHETWOMOSTIMPORTANTEXAMPLESARECOMPONENTANDNGMODULE", - "original": "Many Angular decorators accept metadata with a `providers` property.\nThe two most important examples are `@Component` and `@NgModule`.", - "translation": "很多 Angular 的装饰器都支持带有 `providers` 属性的元数据。\n最重要的两个例子是 `@Component` 和 `@NgModule`。", + "key": "##INJECTABLEPROVIDERS", + "original": "## @Injectable providers", + "translation": "## @Injectable 的 providers 数组", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "###COMPONENTPROVIDERS", - "original": "### _@Component_ providers", - "translation": "### 在组件中注册提供商", + "key": "THEINJECTABLEDECORATORIDENTIFIESSERVICESANDOTHERCLASSESTHATAREINTENDEDTOBEINJECTEDITCANALSOBEUSEDTOCONFIGUREAPROVIDERFORTHOSESERVICES", + "original": "The `@Injectable` decorator identifies services and other classes that are intended to be injected. It can also be used to configure a provider for those services.", + "translation": "`@Injectable` 装饰器会指出这些服务或其它类是用来注入的。它还能用于为这些服务提供配置项。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "HERESAREVISEDHEROESCOMPONENTTHATREGISTERSTHEHEROSERVICEINITSPROVIDERSARRAY", - "original": "Here's a revised `HeroesComponent` that registers the `HeroService` in its `providers` array.", - "translation": "下面是修改过的 `HerosComponent`,把 `HeroService` 注册到了它的 `providers` 数组中。", + "key": "HEREWECONFIGUREAPROVIDERFORHEROSERVICEUSINGTHEINJECTABLEDECORATORONTHECLASS", + "original": "Here we configure a provider for `HeroService` using the `@Injectable` decorator on the class.", + "translation": "这里我们使用类上的 `@Injectable` 装饰器来为 `HeroService` 配置了一个提供商。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "PROVIDEDINTELLSANGULARTHATTHEROOTINJECTORISRESPONSIBLEFORCREATINGANINSTANCEOFTHEHEROSERVICEBYINVOKINGITSCONSTRUCTORANDMAKINGITAVAILABLEACROSSTHEAPPLICATIONTHECLISETSUPTHISKINDOFAPROVIDERAUTOMATICALLYFORYOUWHENGENERATINGANEWSERVICE", + "original": "`providedIn` tells Angular that the root injector is responsible for creating an instance of the `HeroService` (by invoking its constructor) and making it available across the application. The CLI sets up this kind of a provider automatically for you when generating a new service.", + "translation": "`providedIn` 告诉 Angular,它的根注入器要负责调用 `HeroService` 类的构造函数来创建一个实例,并让它在整个应用中都是可用的。在使用 CLI 生成新服务时,会默认帮你设置为这种提供商。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "SOMETIMESITSNOTDESIRABLETOHAVEASERVICEALWAYSBEPROVIDEDINTHEAPPLICATIONROOTINJECTORPERHAPSUSERSSHOULDEXPLICITLYOPTINTOUSINGTHESERVICEORTHESERVICESHOULDBEPROVIDEDINALAZILYLOADEDCONTEXTINTHISCASETHEPROVIDERSHOULDBEASSOCIATEDWITHASPECIFICNGMODULECLASSANDWILLBEUSEDBYWHICHEVERINJECTORINCLUDESTHATMODULE", + "original": "Sometimes it's not desirable to have a service always be provided in the application root injector. Perhaps users should explicitly opt-in to using the service, or the service should be provided in a lazily-loaded context. In this case, the provider should be associated with a specific `@NgModule` class, and will be used by whichever injector includes that module.", + "translation": "有时,你不希望只在应用的根注入器中提供服务。有可能用户希望显式选择要使用的服务,或者应该在一个惰性加载的环境下提供该服务。这种情况下,服务提供商应该关联到一个特定的 `@NgModule` 类,而且应该用于该模块包含的任何一个注入器中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "INTHEFOLLOWINGEXCERPTTHEINJECTABLEDECORATORISUSEDTOCONFIGUREAPROVIDERTHATWILLBEAVAILABLEINANYINJECTORTHATINCLUDESTHEHEROMODULE", + "original": "In the following excerpt, the `@Injectable` decorator is used to configure a provider that will be available in any injector that includes the HeroModule.", + "translation": "下面这段代码中,`@Injectable` 装饰器用来配置一个服务提供商,它可以用在任何包含了 HeroModule 的注入器中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9390,9 +9390,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "THANKSTOTHESEREGISTRATIONSANGULARCANINJECTTHEUSERSERVICEORTHEHERODICONFIGVALUEINTOANYCLASSTHATITCREATES", - "original": "Thanks to these registrations, Angular can inject the `UserService` or the `HERO_DI_CONFIG` value\ninto any class that it creates.", - "translation": "得益于这些注册语句,Angular 现在可以向它创建的任何类中注册 `UserService` 或 `HERO_DI_CONFIG` 值了。", + "key": "WITHTHEABOVEREGISTRATIONSANGULARCANINJECTTHEUSERSERVICEORTHEHERODICONFIGVALUEINTOANYCLASSTHATITCREATES", + "original": "With the above registrations, Angular can inject the `UserService` or the `HERO_DI_CONFIG` value\ninto any class that it creates.", + "translation": "借助这些注册语句,Angular 现在可以向它创建的任何类中注册 `UserService` 或 `HERO_DI_CONFIG` 值了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9402,15 +9402,39 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "###NGMODULEORCOMPONENT", - "original": "### _@NgModule_ or _@Component_?", - "translation": "### _@NgModule_ 还是 _@Component_?", + "key": "###COMPONENTPROVIDERS", + "original": "### _@Component_ providers", + "translation": "### 在组件中注册提供商", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "SHOULDYOUREGISTERASERVICEWITHANANGULARMODULEORWITHACOMPONENTTHETWOCHOICESLEADTODIFFERENCESINSERVICESCOPEANDSERVICELIFETIME", - "original": "Should you register a service with an Angular module or with a component?\nThe two choices lead to differences in service _scope_ and service _lifetime_.", - "translation": "你该使用 Angular 的模块还是组件来注册服务呢?\n这两个选择的差别在于服务的*范围*和*生命周期*。", + "key": "INADDITIONTOPROVIDINGTHESERVICEAPPLICATIONWIDEORWITHINAPARTICULARNGMODULESERVICESCANALSOBEPROVIDEDINSPECIFICCOMPONENTSSERVICESPROVIDEDINCOMPONENTLEVELISONLYAVAILABLEWITHINTHATCOMPONENTINJECTORORINANYOFITSCHILDCOMPONENTS", + "original": "In addition to providing the service application-wide or within a particular `@NgModule`, services can also be provided in specific components. Services provided in component-level is only available within that component injector or in any of its child components.", + "translation": "除了提供给全应用级或特定的 `@NgModule` 中之外,服务还可以提供给指定的组件。在组件级提供的服务职能在该组件及其子组件的注入器中使用。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THEEXAMPLEBELOWSHOWSAREVISEDHEROESCOMPONENTTHATREGISTERSTHEHEROSERVICEINITSPROVIDERSARRAY", + "original": "The example below shows a revised `HeroesComponent` that registers the `HeroService` in its `providers` array.", + "translation": "下面的例子展示了一个修改过的 `HeroesComponent`,它在自己的 `providers` 数组中注册了 `HeroService`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "###INJECTABLENGMODULEORCOMPONENT", + "original": "### @Injectable, _@NgModule_ or _@Component_?", + "translation": "### @Injectable、_@NgModule_ 还是 _@Component_ ?", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "SHOULDYOUPROVIDEASERVICEWITHANINJECTABLEDECORATORINANNGMODULEORWITHINANCOMPONENTTHECHOICESLEADTODIFFERENCESINTHEFINALBUNDLESIZESERVICESCOPEANDSERVICELIFETIME", + "original": "Should you provide a service with an `@Injectable` decorator, in an `@NgModule`, or within an `@Component`?\nThe choices lead to differences in the final bundle size, service _scope_, and service _lifetime_.", + "translation": "你该使用 `@Injectable` 装饰器、`@NgModule`还是 `@Component` 来提供服务呢?\n这几个选择的差别在于最终的打包体积、服务的*范围*和服务的*生命周期*。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "WHENYOUREGISTERPROVIDERSINTHEINJECTABLEDECORATOROFTHESERVICEITSELFOPTIMIZATIONTOOLSSUCHASTHOSEUSEDBYTHECLISPRODUCTIONBUILDSCANPERFORMTREESHAKINGWHICHREMOVESSERVICESTHATARENTUSEDBYYOURAPPTREESHAKINGRESULTSINSMALLERBUNDLESIZES", + "original": "When you register providers in the **@Injectable** decorator of the service itself, optimization tools such as those used by the CLI's production builds can perform tree shaking, which removes services that aren't used by your app. Tree shaking results in smaller bundle sizes.", + "translation": "当你在服务本身的 **@Injectable** 装饰器中注册提供商时,优化工具(比如 CLI 产品模式构建时所用的)可以执行摇树优化,这会移除所有没在应用中使用过的服务。摇树优化会导致更小的打包体积。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9420,9 +9444,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "YOURELIKELYTOINJECTTHEUSERSERVICEINMANYPLACESTHROUGHOUTTHEAPPANDWILLWANTTOINJECTTHESAMESERVICEINSTANCEEVERYTIMEPROVIDINGTHEUSERSERVICEWITHANANGULARMODULEISAGOODCHOICE", - "original": "You're likely to inject the `UserService` in many places throughout the app\nand will want to inject the same service instance every time.\nProviding the `UserService` with an Angular module is a good choice.", - "translation": "如果你想要把这个 `UserService` 注入到应用中的很多地方,并且期望每次注入的都是同一个服务实例,那么在 Angular 的模块中提供 `UserService` 就是不错的选择。", + "key": "YOURELIKELYTOINJECTTHEUSERSERVICEINMANYPLACESTHROUGHOUTTHEAPPANDWILLWANTTOINJECTTHESAMESERVICEINSTANCEEVERYTIMEPROVIDINGTHEUSERSERVICEWITHANANGULARMODULEISAGOODCHOICEIFANINJECTABLEPROVIDERISNOTANOPTION", + "original": "You're likely to inject the `UserService` in many places throughout the app\nand will want to inject the same service instance every time.\nProviding the `UserService` with an Angular module is a good choice if an `@Injectable` provider is not an option.", + "translation": "你可能想要把这个 `UserService` 注入到应用中的很多地方,并期望每次注入的都是同一个服务实例。\n这时候如果不能用 `@Injectable`,那么就可以在 Angular 的模块中提供 `UserService`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -9467,246 +9491,6 @@ "translation": "由组件提供的服务,其范围和生命周期是 [Angular 如何创建组件实例](#component-child-injectors) 的必然结果。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, - { - "key": "##INJECTASERVICE", - "original": "## Inject a service", - "translation": "## 注入某个服务", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THEHEROLISTCOMPONENTSHOULDGETHEROESFROMTHEHEROSERVICE", - "original": "The `HeroListComponent` should get heroes from the `HeroService`.", - "translation": "`HeroListComponent` 应该从 `HeroService` 中获取这些英雄数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THECOMPONENTSHOULDNTCREATETHEHEROSERVICEWITHNEWITSHOULDASKFORTHEHEROSERVICETOBEINJECTED", - "original": "The component shouldn't create the `HeroService` with `new`.\nIt should ask for the `HeroService` to be injected.", - "translation": "该组件不应该使用 `new` 来创建 `HeroService`。\n它应该要求注入 `HeroService`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "YOUCANTELLANGULARTOINJECTADEPENDENCYINTHECOMPONENTSCONSTRUCTORBYSPECIFYINGACONSTRUCTORPARAMETERWITHTHEDEPENDENCYTYPEHERESTHEHEROLISTCOMPONENTCONSTRUCTORASKINGFORTHEHEROSERVICETOBEINJECTED", - "original": "You can tell Angular to inject a dependency in the component's constructor by specifying a **constructor parameter with the dependency type**.\nHere's the `HeroListComponent` constructor, asking for the `HeroService` to be injected.", - "translation": "你可以通过**在构造函数中添加一个带有该依赖类型的参数**来要求 Angular 把这个依赖注入到组件的构造函数中。\n下面是 `HeroListComponent` 的构造函数,它要求注入 `HeroService`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "OFCOURSETHEHEROLISTCOMPONENTSHOULDDOSOMETHINGWITHTHEINJECTEDHEROSERVICEHERESTHEREVISEDCOMPONENTMAKINGUSEOFTHEINJECTEDSERVICESIDEBYSIDEWITHTHEPREVIOUSVERSIONFORCOMPARISON", - "original": "Of course, the `HeroListComponent` should do something with the injected `HeroService`.\nHere's the revised component, making use of the injected service, side-by-side with the previous version for comparison.", - "translation": "当然,`HeroListComponent` 还应该使用注入的这个 `HeroService` 做点什么。\n下面输出修改过的组件,改用注入的服务,与前一个版本对比一下。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "NOTICETHATTHEHEROLISTCOMPONENTDOESNTKNOWWHERETHEHEROSERVICECOMESFROMYOUKNOWTHATITCOMESFROMTHEPARENTHEROESCOMPONENTBUTIFYOUDECIDEDINSTEADTOPROVIDETHEHEROSERVICEINTHEAPPMODULETHEHEROLISTCOMPONENTWOULDNTCHANGEATALLTHEONLYTHINGTHATMATTERSISTHATTHEHEROSERVICEISPROVIDEDINSOMEPARENTINJECTOR", - "original": "Notice that the `HeroListComponent` doesn't know where the `HeroService` comes from.\n_You_ know that it comes from the parent `HeroesComponent`.\nBut if you decided instead to provide the `HeroService` in the `AppModule`,\nthe `HeroListComponent` wouldn't change at all.\nThe _only thing that matters_ is that the `HeroService` is provided in some parent injector.", - "translation": "注意,`HeroListComponent` 并不知道 `HeroService` 来自哪里。\n当然*你自己*知道它来自父组件 `HeroesComponent`。\n但是如果你决定改在 `AppModule` 中提供 `HeroService`,`HeroListComponent` 不用做任何修改。\n它*唯一需要关心的事情*是 `HeroService` 是由某个父注入器提供的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "##SINGLETONSERVICES", - "original": "## Singleton services", - "translation": "## 单例服务", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "SERVICESARESINGLETONSWITHINTHESCOPEOFANINJECTORTHEREISATMOSTONEINSTANCEOFASERVICEINAGIVENINJECTOR", - "original": "Services are singletons _within the scope of an injector_.\nThere is at most one instance of a service in a given injector.", - "translation": "服务*在每个注入器的范围内*是单例的。\n在任何一个注入器中,最多只会有同一个服务的一个实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THEREISONLYONEROOTINJECTORANDTHEUSERSERVICEISREGISTEREDWITHTHATINJECTORTHEREFORETHERECANBEJUSTONEUSERSERVICEINSTANCEINTHEENTIREAPPANDEVERYCLASSTHATINJECTSUSERSERVICEGETTHISSERVICEINSTANCE", - "original": "There is only one root injector and the `UserService` is registered with that injector.\nTherefore, there can be just one `UserService` instance in the entire app\nand every class that injects `UserService` get this service instance.", - "translation": "这里只有一个根注入器,而 `UserService` 就是在该注入器中注册的。\n所以,在整个应用中只能有一个 `UserService` 实例,每个要求注入 `UserService` 的类都会得到这个服务实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "HOWEVERANGULARDIISAHIERARCHICALINJECTIONSYSTEMGUIDEHIERARCHICALDEPENDENCYINJECTIONWHICHMEANSTHATNESTEDINJECTORSCANCREATETHEIROWNSERVICEINSTANCESANGULARCREATESNESTEDINJECTORSALLTHETIME", - "original": "However, Angular DI is a \n[hierarchical injection system](guide/hierarchical-dependency-injection), \nwhich means that nested injectors can create their own service instances.\nAngular creates nested injectors all the time.", - "translation": "不过,Angular DI 是一个 [多级注入系统](guide/hierarchical-dependency-injection),这意味着各级注入器都可以创建它们自己的服务实例。\nAngular 总会创建多级注入器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "##COMPONENTCHILDINJECTORS", - "original": "## Component child injectors", - "translation": "## 组件的子注入器", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "FOREXAMPLEWHENANGULARCREATESANEWINSTANCEOFACOMPONENTTHATHASCOMPONENTPROVIDERSITALSOCREATESANEWCHILDINJECTORFORTHATINSTANCE", - "original": "For example, when Angular creates a new instance of a component that has `@Component.providers`,\nit also creates a new _child injector_ for that instance.", - "translation": "例如,当 Angular 创建一个带有 `@Component.providers` 的组件实例时,也会同时为这个实例创建一个新的*子注入器*。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "COMPONENTINJECTORSAREINDEPENDENTOFEACHOTHERANDEACHOFTHEMCREATESITSOWNINSTANCESOFTHECOMPONENTPROVIDEDSERVICES", - "original": "Component injectors are independent of each other and\neach of them creates its own instances of the component-provided services.", - "translation": "组件注入器是彼此独立的,每一个都会为这些组件提供的服务创建单独的实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "WHENANGULARDESTROYSONEOFTHESECOMPONENTINSTANCEITALSODESTROYSTHECOMPONENTSINJECTORANDTHATINJECTORSSERVICEINSTANCES", - "original": "When Angular destroys one of these component instance, it also destroys the\ncomponent's injector and that injector's service instances.", - "translation": "当 Angular 销毁任何一个组件实例时,也会同时销毁组件的注入器以及该注入器中的那些服务实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THANKSTOINJECTORINHERITANCEGUIDEHIERARCHICALDEPENDENCYINJECTIONYOUCANSTILLINJECTAPPLICATIONWIDESERVICESINTOTHESECOMPONENTSACOMPONENTSINJECTORISACHILDOFITSPARENTCOMPONENTSINJECTORANDADESCENDENTOFITSPARENTSPARENTSINJECTORANDSOONALLTHEWAYBACKTOTHEAPPLICATIONSROOTINJECTORANGULARCANINJECTASERVICEPROVIDEDBYANYINJECTORINTHATLINEAGE", - "original": "Thanks to [injector inheritance](guide/hierarchical-dependency-injection),\nyou can still inject application-wide services into these components.\nA component's injector is a child of its parent component's injector,\nand a descendent of its parent's parent's injector, and so on all the way back to the application's _root_ injector.\nAngular can inject a service provided by any injector in that lineage.", - "translation": "在[注入器继承机制](guide/hierarchical-dependency-injection)的帮助下,你仍然可以把全应用级的服务注入到这些组件中。\n组件的注入器也是其父组件的注入器的子注入器,这同样适用于其父组件的父组件的注入器,以此类推,最终会回到应用的*根*注入器。\nAngular 可以注入由这个注入器谱系提供的任何一个注入器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "FOREXAMPLEANGULARCOULDINJECTAHEROLISTCOMPONENTWITHBOTHTHEHEROSERVICEPROVIDEDINHEROCOMPONENTANDTHEUSERSERVICEPROVIDEDINAPPMODULE", - "original": "For example, Angular could inject a `HeroListComponent`\nwith both the `HeroService` provided in `HeroComponent`\nand the `UserService` provided in `AppModule`.", - "translation": "比如,Angular 可以把由 `HeroComponent` 提供的 `HeroService` 和由 `AppModule` 提供的 `UserService` 注入到 `HeroService` 中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "##TESTINGTHECOMPONENT", - "original": "## Testing the component", - "translation": "## 测试组件", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "EARLIERYOUSAWTHATDESIGNINGACLASSFORDEPENDENCYINJECTIONMAKESTHECLASSEASIERTOTESTLISTINGDEPENDENCIESASCONSTRUCTORPARAMETERSMAYBEALLYOUNEEDTOTESTAPPLICATIONPARTSEFFECTIVELY", - "original": "Earlier you saw that designing a class for dependency injection makes the class easier to test.\nListing dependencies as constructor parameters may be all you need to test application parts effectively.", - "translation": "前面强调过,设计一个适合依赖注入的类,可以让这个类更容易测试。\n要有效的测试应用中的一部分,只需要在构造函数的参数中列出依赖。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "FOREXAMPLEYOUCANCREATEANEWHEROLISTCOMPONENTWITHAMOCKSERVICETHATYOUCANMANIPULATEUNDERTEST:", - "original": "For example, you can create a new `HeroListComponent` with a mock service that you can manipulate\nunder test:", - "translation": "例如,新建的 `HeroListComponent` 实例使用一个模拟 (mock) 服务,以便可以在测试中操纵它:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "LEARNMOREINTHETESTINGGUIDETESTINGGUIDE", - "original": "Learn more in the [Testing](guide/testing) guide.", - "translation": "要学习更多知识,参见[测试](guide/testing)一章。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "##WHENTHESERVICENEEDSASERVICE", - "original": "## When the service needs a service", - "translation": "## 当服务需要别的服务时", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THEHEROSERVICEISVERYSIMPLEITDOESNTHAVEANYDEPENDENCIESOFITSOWN", - "original": "The `HeroService` is very simple. It doesn't have any dependencies of its own.", - "translation": "这个 `HeroService` 非常简单。它本身不需要任何依赖。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "WHATIFITHADADEPENDENCYWHATIFITREPORTEDITSACTIVITIESTHROUGHALOGGINGSERVICEYOUDAPPLYTHESAMECONSTRUCTORINJECTIONPATTERNADDINGACONSTRUCTORTHATTAKESALOGGERPARAMETER", - "original": "What if it had a dependency? What if it reported its activities through a logging service?\nYou'd apply the same *constructor injection* pattern,\nadding a constructor that takes a `Logger` parameter.", - "translation": "如果它也有依赖,该怎么办呢?例如,它需要通过日志服务来汇报自己的活动。\n你同样用*构造函数注入*模式,来添加一个带有 `Logger` 参数的构造函数。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "HEREISTHEREVISEDHEROSERVICETHATINJECTSTHELOGGERSIDEBYSIDEWITHTHEPREVIOUSSERVICEFORCOMPARISON", - "original": "Here is the revised `HeroService` that injects the `Logger`, side-by-side with the previous service for comparison.", - "translation": "下面是修改后的 `HeroService`,它注入了 `Logger`,对比前后这两个版本:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THECONSTRUCTORASKSFORANINJECTEDINSTANCEOFALOGGERANDSTORESITINAPRIVATEFIELDCALLEDLOGGERTHEGETHEROESMETHODLOGSAMESSAGEWHENASKEDTOFETCHHEROES", - "original": "The constructor asks for an injected instance of a `Logger` and stores it in a private field called `logger`.\nThe `getHeroes()` method logs a message when asked to fetch heroes.", - "translation": "这个构造函数要求注入一个 `Logger` 类的实例,并把它存到名为 `logger` 的私有字段中。\n 当请求英雄数据时,`getHeroes()` 中就会记录一个消息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "####THEDEPENDENTLOGGERSERVICE", - "original": "#### The dependent _Logger_ service", - "translation": "#### 被依赖的 `Logger` 服务", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THESAMPLEAPPSLOGGERSERVICEISQUITESIMPLE:", - "original": "The sample app's `Logger` service is quite simple:", - "translation": "这个范例应用的 `Logger` 服务非常简单:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "IFTHEAPPDIDNTPROVIDETHISLOGGERANGULARWOULDTHROWANEXCEPTIONWHENITLOOKEDFORALOGGERTOINJECTINTOTHEHEROSERVICE", - "original": "If the app didn't provide this `Logger`,\nAngular would throw an exception when it looked for a `Logger` to inject\ninto the `HeroService`.", - "translation": "如果该应用没有提供这个 `Logger` 服务,当 Angular 试图把 `Logger` 注入到 `HeroService` 中时,就会抛出一个异常。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "BECAUSEASINGLETONLOGGERSERVICEISUSEFULEVERYWHEREITSPROVIDEDINTHEROOTAPPMODULE", - "original": "Because a singleton logger service is useful everywhere,\nit's provided in the root `AppModule`.", - "translation": "因为 `Logger` 服务的单例应该随处可用,所以要在根模块 `AppModule` 中提供它。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THEINJECTABLEAPICOREINJECTABLEDECORATORIDENTIFIESASERVICECLASSTHATMIGHTREQUIREINJECTEDDEPENDENCIES", - "original": "The **[@Injectable()](api/core/Injectable)** decorator identifies a service class \nthat _might_ require injected dependencies.", - "translation": "**[@Injectable()](api/core/Injectable)** 装饰器表示*可能*需要往这个服务类中注入其它依赖。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THEHEROSERVICEMUSTBEANNOTATEDWITHINJECTABLEBECAUSEITREQUIRESANINJECTEDLOGGER", - "original": "The `HeroService` must be annotated with `@Injectable()` because it requires an injected `Logger`.", - "translation": "`HeroService` 必须带有 `@Injectable()` 装饰器,因为它需要把 `Logger` 注入进来。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "ALWAYSWRITEINJECTABLEWITHPARENTHESESNOTJUSTINJECTABLE", - "original": "Always write `@Injectable()` with parentheses, not just `@Injectable`.", - "translation": "写 `@Injectable()` 时必须带括号,不能只写 `@Injectable`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "WHENANGULARCREATESACLASSWHOSECONSTRUCTORHASPARAMETERSITLOOKSFORTYPEANDINJECTIONMETADATAABOUTTHOSEPARAMETERSSOTHATITCANINJECTTHERIGHTSERVICE", - "original": "When Angular creates a class whose constructor has parameters,\nit looks for type and injection metadata about those parameters\nso that it can inject the right service.", - "translation": "当 Angular 要创建一个构造函数中带参数的类时,会先查找这些参数的类型,以便根据这些参数的元数据注入正确的服务。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "IFANGULARCANTFINDTHATPARAMETERINFORMATIONITTHROWSANERROR", - "original": "If Angular can't find that parameter information, it throws an error.", - "translation": "如果不能找到该参数的信息,Angular 就会报错。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "ANGULARCANONLYFINDTHEPARAMETERINFORMATIONIFTHECLASSHASADECORATOROFSOMEKINDWHILEANYDECORATORWILLDOTHEINJECTABLEDECORATORISTHESTANDARDDECORATORFORSERVICECLASSES", - "original": "Angular can only find the parameter information _if the class has a decorator of some kind_.\nWhile _any_ decorator will do,\nthe `@Injectable()` decorator is the standard decorator for service classes.", - "translation": "Angular 只能在*带有某种装饰器的类*上查找参数信息。*任何*装饰器都可以,而 `@Injectable()` 装饰器是各种服务类的标准装饰器。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THEDECORATORREQUIREMENTISIMPOSEDBYTYPESCRIPT", - "original": "The decorator requirement is imposed by TypeScript.", - "translation": "之所以必须有装饰器,是因为 TypeScript 强制要求的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "TYPESCRIPTNORMALLYDISCARDSPARAMETERTYPEINFORMATIONWHENITTRANSPILESTHECODETOJAVASCRIPTITPRESERVESTHISINFORMATIONIFTHECLASSHASADECORATORANDTHEEMITDECORATORMETADATACOMPILEROPTIONISSETTRUEINTYPESCRIPTSTSCONFIGJSONCONFIGURATIONFILE", - "original": "TypeScript normally discards parameter type information when it _transpiles_ the code to JavaScript.\nIt preserves this information if the class has a decorator\nand the `emitDecoratorMetadata` compiler option is set `true` \nin TypeScript's `tsconfig.json` configuration file, .", - "translation": "当把 TypeScript 转译成 JavaScript 时,通常会丢弃参数的类型信息。\n但当该类带有装饰器并且当 `tsconfig.json` 配置文件中的 `emitDecoratorMetadata` 编译选项为 `true` 时,它就会保留这些信息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THECLICONFIGURESTSCONFIGJSONWITHEMITDECORATORMETADATA:TRUEITSYOURJOBTOPUTINJECTABLEONYOURSERVICECLASSES", - "original": "The CLI configures `tsconfig.json` with `emitDecoratorMetadata: true`\nIt's your job to put `@Injectable()` on your service classes.", - "translation": "CLI 生成的 `tsconfig.json` 中已经有 `emitDecoratorMetadata: true` 选项了,你只要把 `@Injectable()` 加到你的服务类上就可以了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "THELOGGERSERVICEISANNOTATEDWITHINJECTABLEDECORATORTOOALTHOUGHITHASNOCONSTRUCTORANDNODEPENDENCIES", - "original": "The `Logger` service is annotated with `@Injectable()` decorator too, \nalthough it has no constructor and no dependencies.", - "translation": "`Logger` 服务也带有 `@Injectable()` 装饰器,不过它没有构造器,也没有依赖。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "INFACTEVERYANGULARSERVICECLASSINTHISAPPISANNOTATEDWITHTHEINJECTABLEDECORATORWHETHERORNOTITHASACONSTRUCTORANDDEPENDENCIESINJECTABLEISAREQUIREDCODINGSTYLEFORSERVICES", - "original": "In fact, _every_ Angular service class in this app is annotated with the `@Injectable()` decorator, whether or not it has a constructor and dependencies.\n`@Injectable()` is a required coding style for services.", - "translation": "该应用中的*每个* Angular 服务类不管有没有构造器和依赖,都带有 `@Injectable()` 装饰器。\n事实上,`@Injectable()` 是风格指南中对服务类的要求。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, { "key": "##PROVIDERS", "original": "## Providers", @@ -9731,12 +9515,6 @@ "translation": "在下面的几节中会解释指定提供商的多种方式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, - { - "key": "ALMOSTALLOFTHEACCOMPANYINGCODESNIPPETSAREEXTRACTSFROMTHESAMPLEAPPSPROVIDERSCOMPONENTTSFILE", - "original": "Almost all of the accompanying code snippets are extracts from the sample app's `providers.component.ts` file.", - "translation": "几乎所有的代码片段都是从范例应用的 `providers.component.ts` 文件中提取出来的。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, { "key": "###THECLASSASITSOWNPROVIDER", "original": "### The class as its own provider", @@ -9983,6 +9761,264 @@ "translation": "在这个例子中,只在 `HeroesComponent` 中需要它,\n 这里,它代替了元数据 `providers` 数组中原来的 `HeroService` 注册。\n 对比一下新的和旧的实现:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, + { + "key": "###TREESHAKABLEPROVIDERS", + "original": "### Tree-shakable providers", + "translation": "### 可以被摇树优化的提供商", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "TREESHAKINGISTHEABILITYTOREMOVECODETHATISNOTREFERENCEDINANAPPLICATIONFROMTHEFINALBUNDLETREESHAKABLEPROVIDERSGIVEANGULARTHEABILITYTOREMOVESERVICESTHATARENOTUSEDINYOURAPPLICATIONFROMTHEFINALOUTPUTTHISSIGNIFICANTLYREDUCESTHESIZEOFYOURBUNDLES", + "original": "Tree shaking is the ability to remove code that is not referenced in an application from the final bundle. Tree-shakable providers give Angular the ability to remove services that are not used in your application from the final output. This significantly reduces the size of your bundles.", + "translation": "摇树优化可以在最终打包时移除应用中从未引用过的代码。可摇树优化的提供商可以让 Angular 从结果中移除应用中那些从未使用过的服务。这可以显著减小打包体积。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "IDEALLYIFANAPPLICATIONISNOTINJECTINGASERVICEITSHOULDNOTBEINCLUDEDINTHEFINALOUTPUTHOWEVERITTURNSOUTTHATTHEANGULARCOMPILERCANNOTIDENTIFYATBUILDTIMEIFTHESERVICEWILLBEREQUIREDORNOTBECAUSEITSALWAYSPOSSIBLETOINJECTASERVICEDIRECTLYUSINGINJECTORGETSERVICEANGULARCANNOTIDENTIFYALLOFTHEPLACESINYOURCODEWHERETHISINJECTIONCOULDHAPPENSOITHASNOCHOICEBUTTOINCLUDETHESERVICEINTHEINJECTORREGARDLESSTHUSSERVICESPROVIDEDINMODULESARENOTTREESHAKEABLE", + "original": "Ideally, if an application is not injecting a service, it should not be included in the final output. However, it turns out that the Angular compiler cannot identify at build time if the service will be required or not. Because it's always possible to inject a service directly using `injector.get(Service)`, Angular cannot identify all of the places in your code where this injection could happen, so it has no choice but to include the service in the injector regardless. Thus, services provided in modules are not tree-shakeable.", + "translation": "理想情况下,如果应用没有注入过某个服务,它就不应该被包含在最终结果中。不过,问题在于 Angular 的编译器无法在构建期间识别出该服务是不是必要的。\n因为总是可以使用 `injector.get(Service)` 的形式直接注入某个服务,而 Angular 不能从你的代码中识别出所有能够进行这种注入的地方。所以,Angular 别无选择,只能把这个服务包含到注入器中。因此,在模块中提供的服务也就无法进行摇树优化了。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "LETUSCONSIDERANEXAMPLEOFNONTREESHAKABLEPROVIDERSINANGULAR", + "original": "Let us consider an example of non-tree-shakable providers in Angular.", + "translation": "来看一个 Angular 无法对提供商进行摇树优化的例子。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "INTHISEXAMPLETOPROVIDESERVICESINANGULARYOUINCLUDETHEMINANNGMODULE:", + "original": "In this example, to provide services in Angular, you include them in an `@NgModule`:", + "translation": "在这个例子中,为了在 Angular 中提供服务,你把它们都包含进了 `@NgModule` 中:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THISMODULECANTHENBEIMPORTEDINTOYOURAPPLICATIONMODULETOMAKETHESERVICEAVAILABLEFORINJECTIONINYOURAPP:", + "original": "This module can then be imported into your application module, to make the service available for injection in your app:", + "translation": "接着,该模块可以导入到你的应用模块中,以便让该服务在整个应用中可用:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "WHENNGCRUNSITCOMPILESAPPMODULEINTOAMODULEFACTORYWHICHCONTAINSDEFINITIONSFORALLTHEPROVIDERSDECLAREDINALLTHEMODULESITINCLUDESATRUNTIMETHISFACTORYBECOMESANINJECTORTHATINSTANTIATESTHESESERVICES", + "original": "When `ngc` runs, it compiles AppModule into a module factory, which contains definitions for all the providers declared in all the modules it includes. At runtime, this factory becomes an injector that instantiates these services.", + "translation": "当运行 `ngc` 时,它会把 AppModule 编译进一个模块工厂里,该工厂中含有它包含的所有子模块中声明过的所有提供商。在运行期间,该工厂会编程一个用于实例化这些服务的注入器。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "TREESHAKINGDOESNTWORKINTHEMETHODABOVEBECAUSEANGULARCANNOTDECIDETOEXCLUDEONECHUNKOFCODETHEPROVIDERDEFINITIONFORTHESERVICEWITHINTHEMODULEFACTORYBASEDONWHETHERANOTHERCHUNKOFCODETHESERVICECLASSISUSEDTOMAKESERVICESTREESHAKEABLETHEINFORMATIONABOUTHOWTOCONSTRUCTANINSTANCEOFTHESERVICETHEPROVIDERDEFINITIONNEEDSTOBEAPARTOFTHESERVICECLASSITSELF", + "original": "Tree-shaking doesn't work in the method above because Angular cannot decide to exclude one chunk of code (the provider definition for the service within the module factory) based on whether another chunk of code (the service class) is used. To make services tree-shakeable, the information about how to construct an instance of the service (the provider definition) needs to be a part of the service class itself.", + "translation": "在这种方式下,摇树优化无法工作,因为 Angular 无法根据该代码(服务类)是否被其它代码块使用过(比如该服务的提供商就定义在了模块工厂里)来排除它。\n要让这些服务可以被摇树优化,所有关于如何构建该服务的实例的信息(提供商定义)就应该是该服务类本身的一部分。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "####CREATINGTREESHAKABLEPROVIDERS", + "original": "#### Creating tree-shakable providers", + "translation": "#### 创建可摇树优化的服务提供商", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "TOCREATEPROVIDERSTHATARETREESHAKABLETHEINFORMATIONTHATUSEDTOBESPECIFIEDINTHEMODULESHOULDBESPECIFIEDINTHEINJECTABLEDECORATORONTHESERVICEITSELF", + "original": "To create providers that are tree-shakable, the information that used to be specified in the module should be specified in the `@Injectable` decorator on the service itself.", + "translation": "要想创建可摇树优化的服务提供商,那些原本要通过模块来指定的信息就要改为在服务自身的 `@Injectable` 装饰器中提供。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THEFOLLOWINGEXAMPLESHOWSTHETREESHAKEABLEEQUIVALENTTOTHESERVICEMODULEEXAMPLEABOVE:", + "original": "The following example shows the tree-shakeable equivalent to the `ServiceModule` example above:", + "translation": "下面的例子展示了一个与上面的 `ServiceModule` 范例等价的可摇树的优化版本:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "INTHEEXAMPLEABOVEPROVIDEDINALLOWSYOUTODECLARETHEINJECTORWHICHINJECTSTHISSERVICEUNLESSTHEREISASPECIALCASETHEVALUESHOULDALWAYSBEROOTSETTINGTHEVALUETOROOTENSURESTHATTHESERVICEISSCOPEDTOTHEROOTINJECTORWITHOUTNAMINGAPARTICULARMODULETHATISPRESENTINTHATINJECTOR", + "original": "In the example above, `providedIn` allows you to declare the injector which injects this service. Unless there is a special case, the value should always be root. Setting the value to root ensures that the service is scoped to the root injector, without naming a particular module that is present in that injector.", + "translation": "上面这个例子中,`providedIn` 允许你声明要由哪个注入器来注入该服务。除了一些特殊情况外,这个值应该始终是 root(根注入器)。把该值设置为 root 可以确保该服务的范围是根注入器,而不是该注入器所在的那个特定模块。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THESERVICECANBEINSTANTIATEDBYCONFIGURINGAFACTORYFUNCTIONASSHOWNBELOW:", + "original": "The service can be instantiated by configuring a factory function as shown below:", + "translation": "该服务也可以通过配置一个工厂函数来实例化,例子如下:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "TOOVERRIDETREESHAKABLEPROVIDERSREGISTERTHEPROVIDERUSINGTHEPROVIDERS:ARRAYSYNTAXOFANYANGULARDECORATORTHATSUPPORTSIT", + "original": "To override tree-shakable providers, register the provider using the `providers: []` array syntax of any Angular decorator that supports it.", + "translation": "要想改写(override)一个可摇树优化的提供商,可以在任何支持 `providers: []` 数组的 Angular 装饰器中注册该提供商。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "##INJECTASERVICE", + "original": "## Inject a service", + "translation": "## 注入某个服务", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THEHEROLISTCOMPONENTSHOULDGETHEROESFROMTHEHEROSERVICE", + "original": "The `HeroListComponent` should get heroes from the `HeroService`.", + "translation": "`HeroListComponent` 应该从 `HeroService` 中获取这些英雄数据。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THECOMPONENTSHOULDNTCREATETHEHEROSERVICEWITHNEWITSHOULDASKFORTHEHEROSERVICETOBEINJECTED", + "original": "The component shouldn't create the `HeroService` with `new`.\nIt should ask for the `HeroService` to be injected.", + "translation": "该组件不应该使用 `new` 来创建 `HeroService`。\n它应该要求注入 `HeroService`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "YOUCANTELLANGULARTOINJECTADEPENDENCYINTHECOMPONENTSCONSTRUCTORBYSPECIFYINGACONSTRUCTORPARAMETERWITHTHEDEPENDENCYTYPEHERESTHEHEROLISTCOMPONENTCONSTRUCTORASKINGFORTHEHEROSERVICETOBEINJECTED", + "original": "You can tell Angular to inject a dependency in the component's constructor by specifying a **constructor parameter with the dependency type**.\nHere's the `HeroListComponent` constructor, asking for the `HeroService` to be injected.", + "translation": "你可以通过**在构造函数中添加一个带有该依赖类型的参数**来要求 Angular 把这个依赖注入到组件的构造函数中。\n下面是 `HeroListComponent` 的构造函数,它要求注入 `HeroService`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "OFCOURSETHEHEROLISTCOMPONENTSHOULDDOSOMETHINGWITHTHEINJECTEDHEROSERVICEHERESTHEREVISEDCOMPONENTMAKINGUSEOFTHEINJECTEDSERVICESIDEBYSIDEWITHTHEPREVIOUSVERSIONFORCOMPARISON", + "original": "Of course, the `HeroListComponent` should do something with the injected `HeroService`.\nHere's the revised component, making use of the injected service, side-by-side with the previous version for comparison.", + "translation": "当然,`HeroListComponent` 还应该使用注入的这个 `HeroService` 做点什么。\n下面输出修改过的组件,改用注入的服务,与前一个版本对比一下。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "NOTICETHATTHEHEROLISTCOMPONENTDOESNTKNOWWHERETHEHEROSERVICECOMESFROMYOUKNOWTHATITCOMESFROMTHEPARENTHEROESCOMPONENTIFYOUDECIDEDINSTEADTOPROVIDETHEHEROSERVICEINTHEAPPMODULETHEHEROLISTCOMPONENTWOULDNTCHANGEATALLTHEONLYTHINGTHATMATTERSISTHATTHEHEROSERVICEISPROVIDEDINSOMEPARENTINJECTOR", + "original": "Notice that the `HeroListComponent` doesn't know where the `HeroService` comes from.\n_You_ know that it comes from the parent `HeroesComponent`.\nIf you decided instead to provide the `HeroService` in the `AppModule`,\nthe `HeroListComponent` wouldn't change at all.\nThe _only thing that matters_ is that the `HeroService` is provided in some parent injector.", + "translation": "注意,`HeroListComponent` 并不知道 `HeroService` 来自哪里。\n不过,**你**知道它来自其父组件 `HeroesComponent`。\n如果你决定改为在 `AppModule` 中提供这个 `HeroService`,`HeroListComponent` 不需要做任何改动。\n**唯一需要关心的问题**是,`HeroService` 是由某个父注入器提供的。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "##SINGLETONSERVICES", + "original": "## Singleton services", + "translation": "## 单例服务", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "SERVICESARESINGLETONSWITHINTHESCOPEOFANINJECTORTHEREISATMOSTONEINSTANCEOFASERVICEINAGIVENINJECTOR", + "original": "Services are singletons _within the scope of an injector_.\nThere is at most one instance of a service in a given injector.", + "translation": "服务*在每个注入器的范围内*是单例的。\n在任何一个注入器中,最多只会有同一个服务的一个实例。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THEREISONLYONEROOTINJECTORANDTHEUSERSERVICEISREGISTEREDWITHTHATINJECTORTHEREFORETHERECANBEJUSTONEUSERSERVICEINSTANCEINTHEENTIREAPPANDEVERYCLASSTHATINJECTSUSERSERVICEGETTHISSERVICEINSTANCE", + "original": "There is only one root injector, and the `UserService` is registered with that injector.\nTherefore, there can be just one `UserService` instance in the entire app,\nand every class that injects `UserService` get this service instance.", + "translation": "这里只有一个根注入器,而 `UserService` 就是在该注入器中注册的。\n所以,在整个应用中只能有一个 `UserService` 实例,每个要求注入 `UserService` 的类都会得到这个服务实例。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "HOWEVERANGULARDIISAHIERARCHICALINJECTIONSYSTEMGUIDEHIERARCHICALDEPENDENCYINJECTIONWHICHMEANSTHATNESTEDINJECTORSCANCREATETHEIROWNSERVICEINSTANCESANGULARCREATESNESTEDINJECTORSALLTHETIME", + "original": "However, Angular DI is a \n[hierarchical injection system](guide/hierarchical-dependency-injection), \nwhich means that nested injectors can create their own service instances.\nAngular creates nested injectors all the time.", + "translation": "不过,Angular DI 是一个 [多级注入系统](guide/hierarchical-dependency-injection),这意味着各级注入器都可以创建它们自己的服务实例。\nAngular 总会创建多级注入器。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "##COMPONENTCHILDINJECTORS", + "original": "## Component child injectors", + "translation": "## 组件的子注入器", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "COMPONENTINJECTORSAREINDEPENDENTOFEACHOTHERANDEACHOFTHEMCREATESITSOWNINSTANCESOFTHECOMPONENTPROVIDEDSERVICES", + "original": "Component injectors are independent of each other and\neach of them creates its own instances of the component-provided services.", + "translation": "组件注入器是彼此独立的,每一个都会为这些组件提供的服务创建单独的实例。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "FOREXAMPLEWHENANGULARCREATESANEWINSTANCEOFACOMPONENTTHATHASCOMPONENTPROVIDERSITALSOCREATESANEWCHILDINJECTORFORTHATINSTANCE", + "original": "For example, when Angular creates a new instance of a component that has `@Component.providers`,\nit also creates a new _child injector_ for that instance.", + "translation": "例如,当 Angular 创建一个带有 `@Component.providers` 的组件实例时,也会同时为这个实例创建一个新的*子注入器*。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "WHENANGULARDESTROYSONEOFTHESECOMPONENTINSTANCESITALSODESTROYSTHECOMPONENTSINJECTORANDTHATINJECTORSSERVICEINSTANCES", + "original": "When Angular destroys one of these component instances, it also destroys the\ncomponent's injector and that injector's service instances.", + "translation": "当 Angular 销毁某个组件实例时,也会同时销毁该组件的注入器,以及该注入器中的服务实例。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "BECAUSEOFINJECTORINHERITANCEGUIDEHIERARCHICALDEPENDENCYINJECTIONYOUCANSTILLINJECTAPPLICATIONWIDESERVICESINTOTHESECOMPONENTSACOMPONENTSINJECTORISACHILDOFITSPARENTCOMPONENTSINJECTORANDADESCENDENTOFITSPARENTSPARENTSINJECTORANDSOONALLTHEWAYBACKTOTHEAPPLICATIONSROOTINJECTORANGULARCANINJECTASERVICEPROVIDEDBYANYINJECTORINTHATLINEAGE", + "original": "Because of [injector inheritance](guide/hierarchical-dependency-injection),\nyou can still inject application-wide services into these components.\nA component's injector is a child of its parent component's injector,\nand a descendent of its parent's parent's injector, and so on all the way back to the application's _root_ injector.\nAngular can inject a service provided by any injector in that lineage.", + "translation": "由于是[多层注入器](guide/hierarchical-dependency-injection),因此你仍然可以把全应用级的服务注入到这些组件中。\n组件的注入器是其父组件注入器的孩子,也是其爷爷注入器的孙子,以此类推,直到该应用的**根**注入器。\nAngular 可以注入这条线上的任何注入器所提供的服务。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "FOREXAMPLEANGULARCOULDINJECTAHEROLISTCOMPONENTWITHBOTHTHEHEROSERVICEPROVIDEDINHEROCOMPONENTANDTHEUSERSERVICEPROVIDEDINAPPMODULE", + "original": "For example, Angular could inject a `HeroListComponent`\nwith both the `HeroService` provided in `HeroComponent`\nand the `UserService` provided in `AppModule`.", + "translation": "比如,Angular 可以把由 `HeroComponent` 提供的 `HeroService` 和由 `AppModule` 提供的 `UserService` 注入到 `HeroService` 中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "##TESTINGTHECOMPONENT", + "original": "## Testing the component", + "translation": "## 测试组件", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "EARLIERYOUSAWTHATDESIGNINGACLASSFORDEPENDENCYINJECTIONMAKESTHECLASSEASIERTOTESTLISTINGDEPENDENCIESASCONSTRUCTORPARAMETERSMAYBEALLYOUNEEDTOTESTAPPLICATIONPARTSEFFECTIVELY", + "original": "Earlier you saw that designing a class for dependency injection makes the class easier to test.\nListing dependencies as constructor parameters may be all you need to test application parts effectively.", + "translation": "前面强调过,设计一个适合依赖注入的类,可以让这个类更容易测试。\n要有效的测试应用中的一部分,只需要在构造函数的参数中列出依赖。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "FOREXAMPLEYOUCANCREATEANEWHEROLISTCOMPONENTWITHAMOCKSERVICETHATYOUCANMANIPULATEUNDERTEST:", + "original": "For example, you can create a new `HeroListComponent` with a mock service that you can manipulate\nunder test:", + "translation": "例如,新建的 `HeroListComponent` 实例使用一个模拟 (mock) 服务,以便可以在测试中操纵它:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "LEARNMOREINTHETESTINGGUIDETESTINGGUIDE", + "original": "Learn more in the [Testing](guide/testing) guide.", + "translation": "要学习更多知识,参见[测试](guide/testing)一章。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "##WHENTHESERVICENEEDSASERVICE", + "original": "## When the service needs a service", + "translation": "## 当服务需要别的服务时", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THEHEROSERVICEISVERYSIMPLEITDOESNTHAVEANYDEPENDENCIESOFITSOWN", + "original": "The `HeroService` is very simple. It doesn't have any dependencies of its own.", + "translation": "这个 `HeroService` 非常简单。它本身不需要任何依赖。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "WHATIFITHADADEPENDENCYWHATIFITREPORTEDITSACTIVITIESTHROUGHALOGGINGSERVICEYOUDAPPLYTHESAMECONSTRUCTORINJECTIONPATTERNADDINGACONSTRUCTORTHATTAKESALOGGERPARAMETER", + "original": "What if it had a dependency? What if it reported its activities through a logging service?\nYou'd apply the same *constructor injection* pattern,\nadding a constructor that takes a `Logger` parameter.", + "translation": "如果它也有依赖,该怎么办呢?例如,它需要通过日志服务来汇报自己的活动。\n你同样用*构造函数注入*模式,来添加一个带有 `Logger` 参数的构造函数。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "HEREISTHEREVISEDHEROSERVICETHATINJECTSTHELOGGERSIDEBYSIDEWITHTHEPREVIOUSSERVICEFORCOMPARISON", + "original": "Here is the revised `HeroService` that injects the `Logger`, side-by-side with the previous service for comparison.", + "translation": "下面是修改后的 `HeroService`,它注入了 `Logger`,对比前后这两个版本:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THECONSTRUCTORASKSFORANINJECTEDINSTANCEOFALOGGERANDSTORESITINAPRIVATEFIELDCALLEDLOGGERTHEGETHEROESMETHODLOGSAMESSAGEWHENASKEDTOFETCHHEROES", + "original": "The constructor asks for an injected instance of a `Logger` and stores it in a private field called `logger`.\nThe `getHeroes()` method logs a message when asked to fetch heroes.", + "translation": "这个构造函数要求注入一个 `Logger` 类的实例,并把它存到名为 `logger` 的私有字段中。\n 当请求英雄数据时,`getHeroes()` 中就会记录一个消息。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "####THEDEPENDENTLOGGERSERVICE", + "original": "#### The dependent _Logger_ service", + "translation": "#### 被依赖的 `Logger` 服务", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "THESAMPLEAPPSLOGGERSERVICEISQUITESIMPLE:", + "original": "The sample app's `Logger` service is quite simple:", + "translation": "这个范例应用的 `Logger` 服务非常简单:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "IFTHEAPPDIDNTPROVIDETHISLOGGERANGULARWOULDTHROWANEXCEPTIONWHENITLOOKEDFORALOGGERTOINJECTINTOTHEHEROSERVICE", + "original": "If the app didn't provide this `Logger`,\nAngular would throw an exception when it looked for a `Logger` to inject\ninto the `HeroService`.", + "translation": "如果该应用没有提供这个 `Logger` 服务,当 Angular 试图把 `Logger` 注入到 `HeroService` 中时,就会抛出一个异常。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, + { + "key": "BECAUSEASINGLETONLOGGERSERVICEISUSEFULEVERYWHEREITSPROVIDEDINTHEROOTAPPMODULE", + "original": "Because a singleton logger service is useful everywhere,\nit's provided in the root `AppModule`.", + "translation": "因为 `Logger` 服务的单例应该随处可用,所以要在根模块 `AppModule` 中提供它。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" + }, { "key": "##DEPENDENCYINJECTIONTOKENS", "original": "## Dependency injection tokens", @@ -10080,15 +10116,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "THETYPEPARAMETERWHILEOPTIONALCONVEYSTHEDEPENDENCYSTYPETODEVELOPERSANDTOOLINGTHETOKENDESCRIPTIONISANOTHERDEVELOPERAID", - "original": "The type parameter, while optional, conveys the dependency's type to developers and tooling.\nThe token description is another developer aid.", - "translation": "类型参数,虽然是可选的,但可以向开发者和开发工具传达类型信息。\n而且这个令牌的描述信息也可以为开发者提供帮助。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "REGISTERTHEDEPENDENCYPROVIDERUSINGTHEINJECTIONTOKENOBJECT:", - "original": "Register the dependency provider using the `InjectionToken` object:", - "translation": "使用这个 `InjectionToken` 对象注册依赖的提供商:", + "key": "YOUCANDIRECTLYCONFIGUREAPROVIDERWHENCREATINGANINJECTIONTOKENTHEPROVIDERCONFIGURATIONDETERMINESWHICHINJECTORPROVIDESTHETOKENANDHOWTHEVALUEWILLBECREATEDTHISISSIMILARTOUSINGINJECTABLEEXCEPTTHATYOUCANNOTDEFINESTANDARDPROVIDERSSUCHASUSECLASSORUSEFACTORYWITHINJECTIONTOKENINSTEADYOUSPECIFYAFACTORYFUNCTIONWHICHRETURNSTHEVALUETOBEPROVIDEDDIRECTLY", + "original": "You can directly configure a provider when creating an `InjectionToken`. The provider configuration determines which injector provides the token and how the value will be created. This is similar to using `@Injectable`, except that you cannot define standard providers (such as `useClass` or `useFactory`) with `InjectionToken`. Instead, you specify a factory function which returns the value to be provided directly.", + "translation": "你可以在创建 `InjectionToken` 时直接配置一个提供商。该提供商的配置会决定由哪个注入器来提供这个令牌,以及如何创建它的值。\n这和 `@Injectable` 的用法很像,不过你没法用 `InjectionToken` 来定义标准提供商(比如 `useClass` 或 `useFactory`),而要指定一个工厂函数,该函数直接返回想要提供的值。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -10098,15 +10128,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "ALTHOUGHTHEAPPCONFIGINTERFACEPLAYSNOROLEINDEPENDENCYINJECTIONITSUPPORTSTYPINGOFTHECONFIGURATIONOBJECTWITHINTHECLASS", - "original": "Although the `AppConfig` interface plays no role in dependency injection,\nit supports typing of the configuration object within the class.", - "translation": "虽然 `AppConfig` 接口在依赖注入过程中没有任何作用,但它为该类中的配置对象提供了强类型信息。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" - }, - { - "key": "ALTERNATIVELYYOUCANPROVIDEANDINJECTTHECONFIGURATIONOBJECTINANNGMODULELIKEAPPMODULE", - "original": "Alternatively, you can provide and inject the configuration object in an ngModule like `AppModule`.", - "translation": "或者在 ngModule 中提供并注入这个配置对象,如 `AppModule`。", + "key": "IFTHEFACTORYFUNCTIONNEEDSACCESSTOOTHERDITOKENSITCANUSETHEINJECTFUNCTIONFROMANGULARCORETOREQUESTDEPENDENCIES", + "original": "If the factory function needs access to other DI tokens, it can use the inject function from `@angular/core` to request dependencies.", + "translation": "如果工厂函数需要访问其它的 DI 令牌,它可以使用来自 `@angular/core` 中的 `inject` 函数来申请它的依赖。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -10116,15 +10140,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "THEHEROSERVICEREQUIRESALOGGERBUTWHATIFITCOULDGETBYWITHOUTALOGGERYOUCANTELLANGULARTHATTHEDEPENDENCYISOPTIONALBYANNOTATINGTHECONSTRUCTORARGUMENTWITHOPTIONAL:", - "original": "The `HeroService` *requires* a `Logger`, but what if it could get by without\na `logger`?\nYou can tell Angular that the dependency is optional by annotating the\nconstructor argument with `@Optional()`:", - "translation": "`HeroService`*需要*一个 `Logger`,但是如果想不提供 Logger 也能得到它,该怎么办呢?\n可以把构造函数的参数标记为 `@Optional()`,告诉 Angular 该依赖是可选的:", + "key": "YOUCANTELLANGULARTHATTHEDEPENDENCYISOPTIONALBYANNOTATINGTHECONSTRUCTORARGUMENTWITHNULL:", + "original": "You can tell Angular that the dependency is optional by annotating the constructor argument with null:", + "translation": "可以把构造函数的参数标记为 `null` 来告诉 Angular 该依赖是可选的:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { - "key": "WHENUSINGOPTIONALYOURCODEMUSTBEPREPAREDFORANULLVALUEIFYOUDONTREGISTERALOGGERSOMEWHEREUPTHELINETHEINJECTORWILLSETTHEVALUEOFLOGGERTONULL", - "original": "When using `@Optional()`, your code must be prepared for a null value. If you\ndon't register a `logger` somewhere up the line, the injector will set the\nvalue of `logger` to null.", - "translation": "当使用 `@Optional()` 时,代码必须准备好如何处理空值。\n如果其它的代码没有注册一个 `logger`,注入器会设置该 `logger` 的值为空 null。", + "key": "WHENUSINGOPTIONALDEPENDENCIESYOURCODEMUSTBEPREPAREDFORANULLVALUE", + "original": "When using optional dependencies, your code must be prepared for a null value.", + "translation": "如果要使用可选依赖,你的代码就必须准备好处理空值。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dependency-injection.md" }, { @@ -10572,9 +10596,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/deployment.md" }, { - "key": "THEOUTPUTFOLDERISDISTBYDEFAULTTOOUTPUTTOADIFFERENTFOLDERCHANGETHEOUTDIRINANGULARCLIJSON", - "original": "The output folder is `dist/` by default.\nTo output to a different folder, change the `outDir` in `.angular-cli.json`.", - "translation": "默认的输出文件夹是 `dist/`。\n要输出到其它文件夹中,请修改 `.angular-cli.json` 中的 `outDir`。", + "key": "THEOUTPUTFOLDERISDISTBYDEFAULTTOOUTPUTTOADIFFERENTFOLDERCHANGETHEOUTPUTPATHINANGULARJSON", + "original": "The output folder is `dist/` by default.\nTo output to a different folder, change the `outputPath` in `angular.json`.", + "translation": "默认的输出文件夹是 `dist/`。\n要输出到其它文件夹中,请修改 `angular.json` 中的 `outputPath`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/deployment.md" }, { @@ -11657,6 +11681,18 @@ "translation": "[回到顶部](guide/dynamic-form#top)", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/dynamic-form.md" }, + { + "key": "###HOWITWORKS", + "original": "### How it works", + "translation": "### 工作原理", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/elements.md" + }, + { + "key": "BROWSER", + "original": "Browser", + "translation": "浏览器", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/elements.md" + }, { "key": "#ENTRYCOMPONENTS", "original": "# Entry Components", @@ -13638,9 +13674,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARHASITSOWNVOCABULARYMOSTANGULARTERMSARECOMMONENGLISHWORDSWITHASPECIFICMEANINGWITHINTHEANGULARSYSTEM", - "original": "Angular has its own vocabulary.\nMost Angular terms are common English words\nwith a specific meaning within the Angular system.", - "translation": "Angular 有自己的词汇表。\n虽然大多数 Angular 短语都是日常用语,但是在 Angular 体系中,它们有特别的含义。", + "key": "ANGULARHASITSOWNVOCABULARYMOSTANGULARTERMSARECOMMONENGLISHWORDSORCOMPUTINGTERMSTHATHAVEASPECIFICMEANINGWITHINTHEANGULARSYSTEM", + "original": "Angular has its own vocabulary.\nMost Angular terms are common English words or computing terms\nthat have a specific meaning within the Angular system.", + "translation": "Angular 有自己的词汇表。\n虽然大多数 Angular 短语都是日常用语或计算机术语,但是在 Angular 体系中,它们有特别的含义。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13656,9 +13692,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "YOUCANCOMPILEANGULARAPPLICATIONSATBUILDTIMEBYCOMPILINGYOURAPPLICATIONUSINGTHECOMPILERCLINGCYOUCANBOOTSTRAPDIRECTLYTOAMODULEFACTORYMEANINGYOUDONTNEEDTOINCLUDETHEANGULARCOMPILERINYOURJAVASCRIPTBUNDLEAHEADOFTIMECOMPILEDAPPLICATIONSALSOBENEFITFROMDECREASEDLOADTIMEANDINCREASEDPERFORMANCE", - "original": "You can compile Angular applications at build time.\nBy compiling your application using the compiler-cli, `ngc`, you can bootstrap directly to a module factory, meaning you don't need to include the Angular compiler in your JavaScript bundle.\nAhead-of-time compiled applications also benefit from decreased load time and increased performance.", - "translation": "开发者可以在构造时 (build-time) 编译 Angular 应用程序。\n 通过 `compiler-cli` - `ngc` 编译应用程序,应用可以从一个模块工厂直接启动,\n 意味着不再需要把 Angular 编译器添加到 JavaScript 包中。\n 预编译的应用程序加载迅速,具有更高的性能。", + "key": "THEANGULARAHEADOFTIMEAOTCOMPILERCONVERTSYOURANGULARHTMLANDTYPESCRIPTCODEINTOEFFICIENTJAVASCRIPTCODEDURINGTHEBUILDPHASEBEFORETHEBROWSERDOWNLOADSANDRUNSTHATCODETHISISTHEBESTCOMPILATIONMODEFORPRODUCTIONENVIRONMENTSWITHDECREASEDLOADTIMEANDINCREASEDPERFORMANCE", + "original": "The Angular ahead-of-time (AOT) compiler converts your Angular HTML and TypeScript code \ninto efficient JavaScript code during the build phase before the browser downloads \nand runs that code. \nThis is the best compilation mode for production environments, with decreased load time and increased performance.", + "translation": "Angular 的预先(AOT)编译器可以在编译期间把你的 HTML 代码和 TypeScript 代码转换成高效的 JavaScript 代码,这样浏览器就可以直接下载和运行它们。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "BYCOMPILINGYOURAPPLICATIONUSINGTHENGCCOMMANDLINETOOLYOUCANBOOTSTRAPDIRECTLYTOAMODULEFACTORYMEANINGYOUDONTNEEDTOINCLUDETHEANGULARCOMPILERINYOURJAVASCRIPTBUNDLE", + "original": "By compiling your application using the `ngc` command-line tool, you can bootstrap directly to a module factory, meaning you don't need to include the Angular compiler in your JavaScript bundle.", + "translation": "使用命令行工具 `ngc` 来编译你的应用之后,就可以直接启动一个模块工厂,这意味着你不必再在 JavaScript 打包文件中包含 Angular 编译器。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "COMPAREJUSTINTIMEJITCOMPILATIONGUIDEGLOSSARY#JIT", + "original": "Compare [just-in-time (JIT) compilation](guide/glossary#jit).", + "translation": "可以与[即时(JIT)编译](guide/glossary#jit)对比一下。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13668,9 +13716,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "INPRACTICEASYNONYMFORDECORATIONGUIDEGLOSSARY#DECORATOR", - "original": "In practice, a synonym for [Decoration](guide/glossary#decorator).", - "translation": "实际上,是[装饰 (decoration)](guide/glossary#decorator) 的同义词。", + "key": "ASTRUCTURETHATPROVIDESMETADATAFORACLASSSEEDECORATORGUIDEGLOSSARY#DECORATOR", + "original": "A structure that provides metadata for a class. See [Decorator](guide/glossary#decorator).", + "translation": "一种为类提供元数据的结构。参见 [装饰器](guide/glossary#decorator)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13686,63 +13734,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "FOREXAMPLEYOUCANUSETHENGCLASSDIRECTIVETOADDANDREMOVECSSCLASSNAMES", - "original": "For example, you can use the `ngClass` directive to add and remove CSS class names.", - "translation": "例如,`ngClass` 指令就是典型的属性型指令。它可以添加或移除 CSS 类名。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "LEARNABOUTTHEMINTHEATTRIBUTEDIRECTIVESGUIDEATTRIBUTEDIRECTIVESGUIDE", - "original": "Learn about them in the [_Attribute Directives_](guide/attribute-directives) guide.", - "translation": "要了解更多信息,请参见[*属性型指令*](guide/attribute-directives)页。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "##BARREL", - "original": "## Barrel", - "translation": "## 封装桶", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "AWAYTOROLLUPEXPORTSFROMSEVERALES2015MODULESINTOASINGLECONVENIENTES2015MODULETHEBARRELITSELFISANES2015MODULEFILETHATREEXPORTSSELECTEDEXPORTSOFOTHERES2015MODULES", - "original": "A way to *roll up exports* from several ES2015 modules into a single convenient ES2015 module.\nThe barrel itself is an ES2015 module file that re-exports *selected* exports of other ES2015 modules.", - "translation": "封装桶是把多个模块的*导出结果*汇总到单一的 ES2015 模块的一种方式。\n 封装桶本身是一个 ES2015 模块文件,它重新导出*选中的*导出,这些导入来自其它 ES2015 模块。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "FOREXAMPLEIMAGINETHREEES2015MODULESINAHEROESFOLDER:", - "original": "For example, imagine three ES2015 modules in a `heroes` folder:", - "translation": "例如,设想在 `heroes` 目录下有三个 ES2015 模块:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "WITHOUTABARRELACONSUMERNEEDSTHREEIMPORTSTATEMENTS:", - "original": "Without a barrel, a consumer needs three import statements:", - "translation": "如果没有封装桶,消费者需要三条导入语句:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "YOUCANADDABARRELTOTHEHEROESFOLDERCALLEDINDEXBYCONVENTIONTHATEXPORTSALLOFTHESEITEMS:", - "original": "You can add a barrel to the `heroes` folder (called `index`, by convention) that exports all of these items:", - "translation": "在 `heroes` 目录下添加一个封装桶(按约定叫做 `index`),它导出所有这三项:", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "NOWACONSUMERCANIMPORTWHATITNEEDSFROMTHEBARREL", - "original": "Now a consumer can import what it needs from the barrel.", - "translation": "现在,消费者就就可以从这个封装桶中导入它需要的东西了。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "THEANGULARSCOPEDPACKAGESGUIDEGLOSSARY#SCOPEDPACKAGEEACHHAVEABARRELNAMEDINDEX", - "original": "The Angular [scoped packages](guide/glossary#scoped-package) each have a barrel named `index`.", - "translation": "Angular 的每个[范围化包 (scoped package)](guide/glossary#scoped-package) 都有一个名为 `index` 的封装桶。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "YOUCANOFTENACHIEVETHESAMERESULTUSINGNGMODULESGUIDEGLOSSARY#NGMODULEINSTEAD", - "original": "You can often achieve the same result using [NgModules](guide/glossary#ngmodule) instead.", - "translation": "注意,你可以利用 [Angular 模块](guide/glossary#ngmodule)达到同样的目的。", + "key": "LEARNMOREINTHEATTRIBUTEDIRECTIVESGUIDEATTRIBUTEDIRECTIVESGUIDE", + "original": "Learn more in the [_Attribute Directives_](guide/attribute-directives) guide.", + "translation": "要了解更多,参见[*属性型指令*](guide/attribute-directives)", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13752,15 +13746,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "USUALLYREFERSTODATABINDINGGUIDEGLOSSARY#DATABINDINGANDTHEACTOFBINDINGANHTMLOBJECTPROPERTYTOADATAOBJECTPROPERTY", - "original": "Usually refers to [data binding](guide/glossary#data-binding) and the act of\nbinding an HTML object property to a data object property.", - "translation": "几乎都是指的[数据绑定 (data binding)](guide/glossary#data-binding) 和将 HTML 对象属性绑定到数据对象属性的行为。", + "key": "GENERALLYTHEPRACTICEOFSETTINGAVARIABLEORPROPERTYTOADATAVALUEWITHINANGULARTYPICALLYREFERSTODATABINDINGGUIDEGLOSSARY#DATABINDINGWHICHCOORDINATESDOMOBJECTPROPERTIESWITHDATAOBJECTPROPERTIES", + "original": "Generally, the practice of setting a variable or property to a data value. \nWithin Angular, typically refers to [data binding](guide/glossary#data-binding), \nwhich coordinates DOM object properties with data object properties.", + "translation": "广义上是指把变量或属性设置为某个数据值的一种实践。\n在 Angular 中,一般是指[数据绑定](guide/glossary#data-binding),它会根据数据对象属性的值来设置 DOM 对象的属性。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SOMETIMESREFERSTOADEPENDENCYINJECTIONGUIDEGLOSSARY#DEPENDENCYINJECTIONBINDINGBETWEENATOKENMDASHALSOREFERREDTOASAKEYMDASHANDADEPENDENCYPROVIDERGUIDEGLOSSARY#PROVIDER", - "original": "Sometimes refers to a [dependency-injection](guide/glossary#dependency-injection) binding\nbetween a \"token\"—also referred to as a \"key\"—and a dependency [provider](guide/glossary#provider).", - "translation": "有时也会指在“令牌”(也称为键)和依赖[提供商 (provider)](guide/glossary#provider)\n之间的[依赖注入 (dependency injection)](guide/glossary#dependency-injection) 绑定。\n这种用法很少,而且一般都会在上下文中写清楚。", + "key": "SOMETIMESREFERSTOADEPENDENCYINJECTIONGUIDEGLOSSARY#DEPENDENCYINJECTIONBINDINGBETWEENATOKENGUIDEGLOSSARY#TOKENANDADEPENDENCYPROVIDERGUIDEGLOSSARY#PROVIDER", + "original": "Sometimes refers to a [dependency-injection](guide/glossary#dependency-injection) binding\nbetween a [token](guide/glossary#token) and a dependency [provider](guide/glossary#provider).", + "translation": "有时也会指在“[令牌(Token)](guide/glossary#token)”和依赖[提供商(Provider)](guide/glossary#provider)\n之间的[依赖注入](guide/glossary#dependency-injection) 绑定。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13770,51 +13764,99 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "YOULAUNCHANANGULARAPPLICATIONBYBOOTSTRAPPINGITUSINGTHEAPPLICATIONROOTNGMODULEAPPMODULE", - "original": "You launch an Angular application by \"bootstrapping\" it using the application root NgModule (`AppModule`).", - "translation": "通过应用程序根 Angular 模块(`AppModule`)来启动 Angular 应用程序。", + "key": "AWAYTOINITIALIZEANDLAUNCHANAPPORSYSTEM", + "original": "A way to initialize and launch an app or system.", + "translation": "一种用来初始化和启动应用或系统的途径。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "BOOTSTRAPPINGIDENTIFIESANAPPLICATIONSTOPLEVELROOTCOMPONENTGUIDEGLOSSARY#COMPONENTWHICHISTHEFIRSTCOMPONENTTHATISLOADEDFORTHEAPPLICATION", - "original": "Bootstrapping identifies an application's top level \"root\" [component](guide/glossary#component),\nwhich is the first component that is loaded for the application.", - "translation": "启动过程标识应用的顶级“根”[组件 (component)](guide/glossary#component),也就是应用加载的第一个组件。", + "key": "INANGULARANAPPSROOTNGMODULEAPPMODULEHASABOOTSTRAPPROPERTYTHATIDENTIFIESTHEAPPSTOPLEVELCOMPONENTSGUIDEGLOSSARY#COMPONENTDURINGTHEBOOTSTRAPPROCESSANGULARCREATESANDINSERTSTHESECOMPONENTSINTOTHEINDEXHTMLHOSTWEBPAGEYOUCANBOOTSTRAPMULTIPLEAPPSINTHESAMEINDEXHTMLEACHAPPWITHITSOWNCOMPONENTS", + "original": "In Angular, an app's root NgModule (`AppModule`) has a `bootstrap` property that identifies the app's top-level [components](guide/glossary#component). \nDuring the bootstrap process, Angular creates and inserts these components into the `index.html` host web page. \nYou can bootstrap multiple apps in the same `index.html`, each app with its own components.", + "translation": "在 Angular 中,应用的根模块(`AppModule`)有一个 `bootstrap` 属性,用于指出该应用的的顶级[组件](guide/glossary#component)。\n在引导期间,Angular 会创建这些组件,并插入到宿主页面 `index.html` 中。\n你可以在同一个 `index.html` 中引导多个应用,每个应用都有一些自己的组件。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "YOUCANBOOTSTRAPMULTIPLEAPPSINTHESAMEINDEXHTMLEACHAPPWITHITSOWNTOPLEVELROOT", - "original": "You can bootstrap multiple apps in the same `index.html`, each app with its own top-level root.", - "translation": "你可以在同一个 `index.html` 中引导多个应用,每个应用都有它自己的顶级根组件。", + "key": "LEARNMOREINTHEBOOTSTRAPPINGGUIDEBOOTSTRAPPINGGUIDE", + "original": "Learn more in the [_Bootstrapping_](guide/bootstrapping) guide.", + "translation": "要了解更多,参见[*引导*](guide/bootstrapping)一章。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##CAMELCASE", - "original": "## camelCase", - "translation": "## 驼峰式命名法 (camelCase)", + "key": "##CASECONVENTIONS", + "original": "## Case conventions", + "translation": "## 大小写约定", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THEPRACTICEOFWRITINGCOMPOUNDWORDSORPHRASESSUCHTHATEACHWORDORABBREVIATIONBEGINSWITHACAPITALLETTEREXCEPTTHEFIRSTLETTERWHICHISLOWERCASE", - "original": "The practice of writing compound words or phrases such that each word or abbreviation begins with a capital letter\n_except the first letter, which is lowercase_.", - "translation": "驼峰式命名法是书写复合词或短语的一种形式,除首字母要小写外,每个单词或缩写都以大写字母开头。", + "key": "ANGULARUSESCAPITALIZATIONCONVENTIONSTODISTINGUISHTHENAMESOFVARIOUSTYPESASDESCRIBEDINTHESTYLEGUIDENAMINGSECTIONGUIDESTYLEGUIDE#0201", + "original": "Angular uses capitalization conventions to distinguish the names of various types, as described in the [Style Guide \"Naming\" section](guide/styleguide#02-01).", + "translation": "Angular 使用大小写约定来区分多种名字,详见[风格指南中的 \"命名\" 一节](guide/styleguide#02-01)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "FUNCTIONPROPERTYANDMETHODNAMESARETYPICALLYSPELLEDINCAMELCASEFOREXAMPLESQUAREFIRSTNAMEANDGETHEROESNOTICETHATSQUAREISANEXAMPLEOFHOWYOUWRITEASINGLEWORDINCAMELCASE", - "original": "Function, property, and method names are typically spelled in camelCase. For example, `square`, `firstName`, and `getHeroes`. Notice that `square` is an example of how you write a single word in camelCase.", - "translation": "通常,函数、属性和方法命名使用驼峰式拼写法。例如,`square`, `firstName` 和 `getHeroes`。注意这里的 `square` 是如何用驼峰式命名法表示单一词的例子。", + "key": "CAMELCASE:SYMBOLSPROPERTIESMETHODSPIPENAMESNONCOMPONENTDIRECTIVESELECTORSCONSTANTS", + "original": "- camelCase : symbols, properties, methods, pipe names, non-component directive selectors, constants", + "translation": "小驼峰形式(camelCase):符号、属性、方法、管道名、非组件指令的选择器、常量。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "CAMELCASEISALSOKNOWNASLOWERCAMELCASETODISTINGUISHITFROMUPPERCAMELCASEORPASCALCASEGUIDEGLOSSARY#PASCALCASEINANGULARDOCUMENTATIONCAMELCASEALWAYSMEANSLOWERCAMELCASE", - "original": "camelCase is also known as *lower camel case* to distinguish it from *upper camel case*, or [PascalCase](guide/glossary#pascalcase).\nIn Angular documentation, \"camelCase\" always means *lower camel case*.", - "translation": "这种形式也叫做**小写驼峰式命名法 (lower camel case)**,以区分于**大写驼峰式命名法**,也称 [Pascal 命名法 (PascalCase)](guide/glossary#pascalcase)。\nAngular 文档中提到“驼峰式命名法 (camelCase) ”的时候,所指的都是小驼峰命名法。", + "key": "UPPERCAMELCASEORPASCALCASE:CLASSNAMESINCLUDINGCLASSESTHATDEFINECOMPONENTSINTERFACESNGMODULESDIRECTIVESPIPESANDSOON", + "original": "- UpperCamelCase (or PascalCase): Class names, including classes that define components, interfaces, NgModules, directives, pipes, and so on.", + "translation": "大驼峰形式(UpperCamelCase)或叫帕斯卡形式(PascalCase):类名(也包括用来定义组件、接口、NgModule、指令、管道等的类)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THEANGULARCLIISACOMMANDLINEINTERFACETOOLTHATCANCREATEAPROJECTADDFILESANDPERFORMAVARIETYOFONGOINGDEVELOPMENTTASKSSUCHASTESTINGBUNDLINGANDDEPLOYMENT", - "original": "The Angular CLI is a `command line interface` tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.", - "translation": "Angular CLI 是个命令行接口(Command Line Interface)工具,它可以创建项目、添加文件以及执行各种正在进行的开发任务,比如测试、打包和部署。", + "key": "DASHCASEORKEBABCASE:DESCRIPTIVEPARTOFFILENAMESCOMPONENTSELECTORS", + "original": "- dash-case (or \"kebab-case\"): descriptive part of file names, component selectors", + "translation": "中线形式(dash-case)或叫烤串形式(kebab-case):文件名中的描述部分,组件的选择器", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "UNDERSCORECASEORSNAKECASE:NOTTYPICALLYUSEDINANGULAR", + "original": "- underscore_case (or \"snake_case\"): not typically used in Angular", + "translation": "下划线形式(underscore_case)或叫蛇形形式(snake_case):在 Angular 中没有典型用法。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "UPPERUNDERSCORECASEORUPPERSNAKECASE:TRADITIONALFORCONSTANTSACCEPTABLEBUTPREFERCAMELCASE", + "original": "- UPPER_UNDERSCORE_CASE (or UPPER_SNAKE_CASE): traditional for constants (acceptable, but prefer camelCase)", + "translation": "大写下划线形式(UPPER_UNDERSCORE_CASE)或叫大写蛇形形式(UPPER_SNAKE_CASE):传统的常量写法(可以接受,但更推荐用小驼峰形式(camelCase))", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##CLASSDECORATOR", + "original": "## Class decorator", + "translation": "## 类装饰器", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ADECORATORGUIDEGLOSSARY#DECORATORSTATEMENTIMMEDIATELYBEFOREACLASSDEFINITIONTHATDECLARESTHECLASSTOBEOFTHEGIVENTYPEANDPROVIDESMETADATASUITABLETOTHETYPE", + "original": "A [decorator](guide/glossary#decorator) statement immediately before a class definition that declares the class to be of the given type, and provides metadata suitable to the type.", + "translation": "出现在类定义紧前方的[装饰器](guide/glossary#decorator)语句用来声明该类具有指定的类型,并且提供适合该类型的元数据。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THEFOLLOWINGCLASSTYPESCANBEDECLARED:", + "original": "The following class types can be declared:", + "translation": "可以声明为下列类型之一:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##CLASSFIELDDECORATOR", + "original": "## Class field decorator", + "translation": "## 类字段装饰器", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ADECORATORGUIDEGLOSSARY#DECORATORSTATEMENTIMMEDIATELYBEFOREAFIELDINACLASSDEFINITIONTHATDECLARESTHETYPEOFTHATFIELDSOMEEXAMPLESAREINPUTANDOUTPUT", + "original": "A [decorator](guide/glossary#decorator) statement immediately before a field in a class definition that declares the type of that field. Some examples are `@Input` and `@Output`.", + "translation": "出现在类定义中属性紧前方的[装饰器](guide/glossary#decorator)语句用来声明该字段的类型。比如 `@Input` 和 `@Output`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THEANGULARCLIHTTPS:CLIANGULARIOISACOMMANDLINETOOLTHATCANCREATEAPROJECTADDFILESANDPERFORMAVARIETYOFONGOINGDEVELOPMENTTASKSSUCHASTESTINGBUNDLINGANDDEPLOYMENT", + "original": "The [Angular CLI](https://cli.angular.io/) is a command-line tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.", + "translation": "[Angular CLI](https://cli.angular.io/) 是个命令行(Command Line Interface)工具,它可以创建项目、添加文件以及执行各种正在进行的开发任务,比如测试、打包和部署。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13830,45 +13872,57 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANANGULARCLASSRESPONSIBLEFOREXPOSINGDATATOAVIEWGUIDEGLOSSARY#VIEWANDHANDLINGMOSTOFTHEVIEWSDISPLAYANDUSERINTERACTIONLOGIC", - "original": "An Angular class responsible for exposing data to a [view](guide/glossary#view) and handling most of the view’s display and user-interaction logic.", - "translation": "组件是一个 Angular 类,用于把数据展示到[视图 (view)](guide/glossary#view),并处理几乎所有的视图显示和交互逻辑。", + "key": "ACLASSWITHTHECOMPONENTDECORATORGUIDEGLOSSARY#DECORATORTHATASSOCIATESITWITHACOMPANIONTEMPLATEGUIDEGLOSSARY#TEMPLATE", + "original": "A class with the `@Component` [decorator](guide/glossary#decorator) that associates it with a companion [template](guide/glossary#template).", + "translation": "一个带有 `@Component` [装饰器](guide/glossary#decorator)的类,用来为它关联一个与之相伴的[模板](guide/glossary#template)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THECOMPONENTISONEOFTHEMOSTIMPORTANTBUILDINGBLOCKSINTHEANGULARSYSTEMITISINFACTANANGULARDIRECTIVEGUIDEGLOSSARY#DIRECTIVEWITHACOMPANIONTEMPLATEGUIDEGLOSSARY#TEMPLATE", - "original": "The *component* is one of the most important building blocks in the Angular system.\nIt is, in fact, an Angular [directive](guide/glossary#directive) with a companion [template](guide/glossary#template).", - "translation": "*组件*是 Angular 系统中最重要的基本构造块之一。\n它其实是一个拥有[模板 (template)](guide/glossary#template)的[指令 (directive)](guide/glossary#directive)。", + "key": "ACOMPONENTISASPECIALTYPEOFDIRECTIVEGUIDEGLOSSARY#DIRECTIVETHATREPRESENTSAVIEWGUIDEGLOSSARY#VIEWTHECOMPONENTDECORATOREXTENDSTHEDIRECTIVEDECORATORWITHTEMPLATEORIENTEDFEATURES", + "original": "A component is a special type of [directive](guide/glossary#directive) that represents a [view](guide/glossary#view).The `@Component` decorator extends the `@Directive` decorator with template-oriented features.", + "translation": "组件是[指令](guide/glossary#directive)的一种特例,它表示一个[视图](guide/glossary#view)。`@Component` 装饰器扩展了 `@Directive` 装饰器,增加了一些与模板有关的特性。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "APPLYTHECOMPONENTDECORATORGUIDEGLOSSARY#DECORATORTOTHECOMPONENTCLASSTHEREBYATTACHINGTOTHECLASSTHEESSENTIALCOMPONENTMETADATATHATANGULARNEEDSTOCREATEACOMPONENTINSTANCEANDRENDERTHECOMPONENTWITHITSTEMPLATEASAVIEW", - "original": "Apply the `@Component` [decorator](guide/glossary#decorator) to\nthe component class, thereby attaching to the class the essential component metadata\nthat Angular needs to create a component instance and render the component with its template\nas a view.", - "translation": "需要将 `#@Component`[装饰器](guide/glossary#decorator)应用到一个组件类,从而把必要的组件元数据附加到类上。\nAngular 会需要元数据来创建一个组件实例,并把组件的模板作为视图渲染出来。", + "key": "ANANGULARCOMPONENTCLASSISRESPONSIBLEFOREXPOSINGDATAANDHANDLINGMOSTOFTHEVIEWSDISPLAYANDUSERINTERACTIONLOGICTHROUGHDATABINDINGGUIDEGLOSSARY#DATABINDING", + "original": "An Angular component class is responsible for exposing data and handling most of the view's display and user-interaction logic through [data binding](guide/glossary#data-binding).", + "translation": "Angular 的组件类负责暴露数据,并通过[数据绑定机制](guide/glossary#data-binding)来处理绝大多数视图的显示和用户交互逻辑。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THOSEFAMILIARWITHMVCANDMVVMPATTERNSWILLRECOGNIZETHECOMPONENTINTHEROLEOFCONTROLLERORVIEWMODEL", - "original": "Those familiar with \"MVC\" and \"MVVM\" patterns will recognize\nthe component in the role of \"controller\" or \"view model\".", - "translation": "如果你熟悉 \"MVC\" 和 \"MVVM\" 模式,就会意识到组件充当了“控制器 (controller) ”和“视图模型 (view model) ”的角色。", + "key": "READMOREABOUTCOMPONENTSTEMPLATESANDVIEWSINTHEARCHITECTUREGUIDEARCHITECTUREGUIDE", + "original": "Read more about components, templates, and views in the [Architecture](guide/architecture) guide.", + "translation": "要了解更多关于组件、模板和视图的知识,参见 [架构](guide/architecture) 一章。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##DASHCASE", - "original": "## dash-case", - "translation": "## 中线命名法 (dash-case)", + "key": "##CUSTOMELEMENT", + "original": "## Custom element", + "translation": "## 自定义元素", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THEPRACTICEOFWRITINGCOMPOUNDWORDSORPHRASESSUCHTHATEACHWORDISSEPARATEDBYADASHORHYPHENTHISFORMISALSOKNOWNASKEBABCASE", - "original": "The practice of writing compound words or phrases such that each word is separated by a dash or hyphen (`-`).\nThis form is also known as kebab-case.", - "translation": "中线命名法是书写复合词或短语的一种形式,使用中线 (`-`) 分隔每个单词。\n这种形式也称为烤串命名法 kebab-case。", + "key": "AWEBPLATFORMFEATURECURRENTLYSUPPORTEDBYMOSTBROWSERSANDAVAILABLEINOTHERBROWSERSTHROUGHPOLYFILLSSEEBROWSERSUPPORTGUIDEBROWSERSUPPORT", + "original": "A Web Platform feature, currently supported by most browsers, and available in other browsers through polyfills (see [Browser Support](guide/browser-support)).", + "translation": "一种 Web 平台的特性,目前已经被绝大多数浏览器支持,在其它浏览器中也可以通过腻子脚本获得支持(参见[浏览器支持](guide/browser-support))。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "DIRECTIVEGUIDEGLOSSARY#DIRECTIVESELECTORSLIKEMYAPPANDTHEROOTOFFILENAMESSUCHASHEROLISTCOMPONENTTSAREOFTENSPELLEDINDASHCASE", - "original": "[Directive](guide/glossary#directive) selectors (like `my-app`) and\nthe root of filenames (such as `hero-list.component.ts`) are often\nspelled in dash-case.", - "translation": "[指令](guide/glossary#directive)的选择器(例如 `my-app`)和文件名(例如 `hero-list.component.ts`)通常是用中线命名法来命名。", + "key": "THECUSTOMELEMENTFEATUREEXTENDSHTMLBYALLOWINGYOUTODEFINEATAGWHOSECONTENTISCREATEDANDCONTROLLEDBYJAVASCRIPTCODEACUSTOMELEMENTALSOCALLEDAWEBCOMPONENTISRECOGNIZEDBYABROWSERWHENITISADDEDTOTHECUSTOMELEMENTREGISTRYHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBAPICUSTOMELEMENTREGISTRY", + "original": "The custom element feature extends HTML by allowing you to define a tag whose content is created and controlled by JavaScript code. A custom element (also called a *web component*) is recognized by a browser when it is added to the [CustomElementRegistry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry).", + "translation": "这种自定义元素特性通过允许你定义标签(其内容是由 JavaScript 代码来创建和控制的)来扩展 HTML。当自定义元素(也叫 *Web Component*)被添加到 [CustomElementRegistry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry) 之后就会被浏览器识别。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "YOUCANUSETHEAPITOTRANSFORMANANGULARCOMPONENTSOTHATITCANBEREGISTEREDWITHTHEBROWSERANDUSEDINANYHTMLTHATYOUADDDIRECTLYTOTHEDOMWITHINANANGULARAPPTHECUSTOMELEMENTTAGINSERTSTHECOMPONENTSVIEWWITHCHANGEDETECTIONANDDATABINDINGFUNCTIONALITYINTOCONTENTTHATWOULDOTHERWISEBEDISPLAYEDWITHOUTANGULARPROCESSING", + "original": "You can use the API to transform an Angular component so that it can be registered with the browser and used in any HTML that you add directly to the DOM within an Angular app. The custom element tag inserts the component's view, with change-detection and data-binding functionality, into content that would otherwise be displayed without Angular processing.", + "translation": "你可以使用 API 来转换 Angular 组件,以便它能够注册进浏览器中,并且可以用在你往 DOM 中添加的任意 HTML 中。\n自定义元素标签可以把组件的视图(包括变更检测和数据绑定功能)插入到不受 Angular 控制的内容中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "SEEALSODYNAMICCOMPONENTSGUIDEGLOSSARY#DYNAMICCOMPONENTS", + "original": "See also [Dynamic components](guide/glossary#dynamic-components).", + "translation": "参见[动态组件](guide/glossary#dynamic-components)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13878,9 +13932,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "APPLICATIONSDISPLAYDATAVALUESTOAUSERANDRESPONDTOUSERACTIONSSUCHASCLICKSTOUCHESANDKEYSTROKES", - "original": "Applications display data values to a user and respond to user\nactions (such as clicks, touches, and keystrokes).", - "translation": "应用程序会将数据展示给用户,并对用户的操作(点击、触屏、按键)做出回应。", + "key": "DATABINDINGALLOWAPPSTODISPLAYDATAVALUESTOAUSERANDRESPONDTOUSERACTIONSSUCHASCLICKSTOUCHESANDKEYSTROKES", + "original": "Data binding allow apps to display data values to a user and respond to user\nactions (such as clicks, touches, and keystrokes).", + "translation": "数据绑定允许应用程序将数据展示给用户,并对用户的操作(点击、触屏、按键)做出回应。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13889,12 +13943,6 @@ "translation": "在数据绑定机制下,你只要声明一下 HTML 部件和数据源之间的关系,把细节交给框架去处理。\n而以前的手动操作过程是:将数据推送到 HTML 页面中、添加事件监听器、从屏幕获取变化后的数据,并更新应用中的值。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, - { - "key": "ANGULARHASARICHDATABINDINGFRAMEWORKWITHAVARIETYOFDATABINDINGOPERATIONSANDSUPPORTINGDECLARATIONSYNTAX", - "original": "Angular has a rich data-binding framework with a variety of data-binding\noperations and supporting declaration syntax.", - "translation": "Angular 有一个非常强大的数据绑定框架,具有各种数据绑定操作,并支持声明式语法。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, { "key": "READABOUTTHEFOLLOWINGFORMSOFBINDINGINTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE:", "original": "Read about the following forms of binding in the [Template Syntax](guide/template-syntax) page:", @@ -13943,6 +13991,60 @@ "translation": "[基于 ngModel 的双向数据绑定 (Two-way data binding with ngModel)](guide/template-syntax#ngModel)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, + { + "key": "##DECLARABLE", + "original": "## Declarable", + "translation": "## 可声明对象", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ACLASSTYPETHATYOUCANADDTOTHEDECLARATIONSLISTOFANNGMODULEGUIDEGLOSSARY#NGMODULE", + "original": "A class type that you can add to the `declarations` list of an [NgModule](guide/glossary#ngmodule).", + "translation": "类的一种类型,你可以把它们添加到 [NgModule](guide/glossary#ngmodule) 的 `declarations` 列表中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "YOUCANDECLARECOMPONENTSGUIDEGLOSSARY#COMPONENTDIRECTIVESGUIDEGLOSSARY#DIRECTIVEANDPIPESGUIDEGLOSSARY#PIPE", + "original": "You can declare [components](guide/glossary#component), [directives](guide/glossary#directive), and [pipes](guide/glossary#pipe).", + "translation": "你可以声明[组件](guide/glossary#component)、[指令](guide/glossary#directive)和[管道](guide/glossary#pipe)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "DONOTDECLARETHEFOLLOWING:", + "original": "Do not declare the following:", + "translation": "*不要*声明:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ACLASSTHATSALREADYDECLAREDINANOTHERNGMODULE", + "original": "- A class that's already declared in another NgModule.", + "translation": "已经在其它 NgModule 中声明过的类。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANARRAYOFDIRECTIVESIMPORTEDFROMANOTHERPACKAGEFOREXAMPLEDONTDECLAREFORMSDIRECTIVESFROMANGULARFORMS", + "original": "- An array of directives imported from another package. For example, don't declare `FORMS_DIRECTIVES` from `@angular/forms`.", + "translation": "从其它包中导入的指令数组。比如,不要再次声明来自 `@angular/forms` 中的 `FORMS_DIRECTIVES`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "NGMODULECLASSES", + "original": "- NgModule classes.", + "translation": "NgModule 类。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "SERVICECLASSES", + "original": "- Service classes.", + "translation": "服务类", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "NONANGULARCLASSESANDOBJECTSSUCHASSTRINGSNUMBERSFUNCTIONSENTITYMODELSCONFIGURATIONSBUSINESSLOGICANDHELPERCLASSES", + "original": "- Non-Angular classes and objects, such as strings, numbers, functions, entity models, configurations, business logic, and helper classes", + "translation": "非 Angular 的类和对象,比如:字符串、数字、函数、实体模型、配置、业务逻辑和辅助类。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, { "key": "##DECORATORDECORATION", "original": "## Decorator | decoration", @@ -13950,39 +14052,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AFUNCTIONTHATADDSMETADATATOACLASSITSMEMBERSPROPERTIESMETHODSANDFUNCTIONARGUMENTS", - "original": "A *function* that adds metadata to a class, its members (properties, methods) and function arguments.", - "translation": "装饰器是一个**函数**,它将元数据添加到类、类成员(属性、方法)和函数参数。", + "key": "AFUNCTIONTHATMODIFIESTHEIMMEDIATELYFOLLOWINGCLASSORPROPERTYDEFINITIONDECORATORSALSOCALLEDANNOTATIONSAREANEXPERIMENTALSTAGE2JAVASCRIPTLANGUAGEFEATUREHTTPS:GITHUBCOMWYCATSJAVASCRIPTDECORATORSTYPESCRIPTADDSSUPPORTFORDECORATORS", + "original": "A function that modifies the immediately following class or property definition. \nDecorators (also called annotations) are an experimental (stage 2), JavaScript language [feature](https://github.com/wycats/javascript-decorators). \nTypeScript adds support for decorators.", + "translation": "一个函数,用来修饰紧随其后的类或属性定义。\n装饰器(也叫注解)是 JavaScript 的一种语言[特性](https://github.com/wycats/javascript-decorators),是一项位于阶段2(stage 2)的试验特性。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "DECORATORSAREANEXPERIMENTALSTAGE2JAVASCRIPTLANGUAGEFEATUREHTTPS:GITHUBCOMWYCATSJAVASCRIPTDECORATORSTYPESCRIPTADDSSUPPORTFORDECORATORS", - "original": "Decorators are an experimental (stage 2), JavaScript language [feature](https://github.com/wycats/javascript-decorators). TypeScript adds support for decorators.", - "translation": "装饰器是一个 JavaScript 的语言[特性](https://github.com/wycats/javascript-decorators),装饰器在 TypeScript 里已经实现,并被推荐到了 ES2016(也就是 ES7)。", + "key": "ANGULARDEFINESDECORATORSTHATATTACHMETADATATOCLASSESORPROPERTIESSOTHATITKNOWSWHATTHOSECLASSESORPROPERTIESMEANANDHOWTHEYSHOULDWORK", + "original": "Angular defines decorators that attach metadata to classes or properties so that it knows what those classes or properties mean and how they should work.", + "translation": "Angular 定义了一些装饰器,用来为类或属性附加元数据,以便 Angular 了解那些类或属性的含义,以及要如何处理它们。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "TOAPPLYADECORATORPOSITIONITIMMEDIATELYABOVEORTOTHELEFTOFTHEITEMITDECORATES", - "original": "To apply a decorator, position it immediately above or to the left of the item it decorates.", - "translation": "要想应用装饰器,把它放到被装饰对象的上面或左边。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ANGULARHASITSOWNSETOFDECORATORSTOHELPITINTEROPERATEWITHYOURAPPLICATIONPARTSTHEFOLLOWINGEXAMPLEISACOMPONENTDECORATORTHATIDENTIFIESACLASSASANANGULARCOMPONENTGUIDEGLOSSARY#COMPONENTANDANINPUTDECORATORAPPLIEDTOTHENAMEPROPERTYOFTHATCOMPONENTTHEELIDEDOBJECTARGUMENTTOTHECOMPONENTDECORATORWOULDCONTAINTHEPERTINENTCOMPONENTMETADATA", - "original": "Angular has its own set of decorators to help it interoperate with your application parts.\nThe following example is a `@Component` decorator that identifies a\nclass as an Angular [component](guide/glossary#component) and an `@Input` decorator applied to the `name` property\nof that component. The elided object argument to the `@Component` decorator would contain the pertinent component metadata.", - "translation": "Angular 使用自己的一套装饰器来实现应用程序各部件之间的相互操作。\n下面的例子中使用了 `@Component` 装饰器来将一个类标记为 Angular [组件 (component)](guide/glossary#component),\n并将 `@Input` 装饰器来应用到组件的 `name` 属性。\n`@Component` 装饰器中省略的参数对象会包含与组件有关的元数据。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "THESCOPEOFADECORATORISLIMITEDTOTHELANGUAGEFEATURETHATITDECORATESNONEOFTHEDECORATIONSSHOWNHEREWILLLEAKTOOTHERCLASSESTHATFOLLOWITINTHEFILE", - "original": "The scope of a decorator is limited to the language feature\nthat it decorates. None of the decorations shown here will \"leak\" to other\nclasses that follow it in the file.", - "translation": "装饰器的作用域会被限制在它所装饰的语言特性。\n在同一文件中,装饰器不会“泄露”到它后面的其它类。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ALWAYSINCLUDEPARENTHESESWHENAPPLYINGADECORATOR", - "original": "Always include parentheses `()` when applying a decorator.", - "translation": "永远别忘了在装饰器后面加括号 `()`。", + "key": "SEECLASSDECORATORGUIDEGLOSSARY#CLASSDECORATORCLASSFIELDDECORATORGUIDEGLOSSARY#CLASSFIELDDECORATOR", + "original": "See [Class decorator](guide/glossary#class-decorator), [Class field decorator](guide/glossary#class-field-decorator).", + "translation": "参见 [类装饰器](guide/glossary#class-decorator)、[类属性装饰器](guide/glossary#class-field-decorator)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -13992,81 +14076,33 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ADESIGNPATTERNANDMECHANISMFORCREATINGANDDELIVERINGPARTSOFANAPPLICATIONTOOTHERPARTSOFANAPPLICATIONTHATREQUESTTHEM", - "original": "A design pattern and mechanism\nfor creating and delivering parts of an application to other\nparts of an application that request them.", - "translation": "依赖注入既是设计模式,同时又是一种机制:当应用程序的一些部件需要另一些部件时,\n利用依赖注入来创建被请求的部件,并将它们注入到发出请求的部件中。", + "key": "ADESIGNPATTERNANDMECHANISMFORCREATINGANDDELIVERINGPARTSOFANAPPLICATIONDEPENDENCIESTOOTHERPARTSOFANAPPLICATIONTHATREQUIRETHEM", + "original": "A design pattern and mechanism for creating and delivering parts of an application (dependencies) to other parts of an application that require them.", + "translation": "依赖注入既是设计模式,同时又是一种机制:当应用程序的一些部件(即一些依赖)需要另一些部件时,\n利用依赖注入来创建被请求的部件,并将它们注入到需要它们的部件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARDEVELOPERSPREFERTOBUILDAPPLICATIONSBYDEFININGMANYSIMPLEPARTSTHATEACHDOONETHINGWELLANDTHENWIRINGTHEMTOGETHERATRUNTIME", - "original": "Angular developers prefer to build applications by defining many simple parts\nthat each do one thing well and then wiring them together at runtime.", - "translation": "Angular 开发者构建应用程序时的首选方法是:定义许多简单部件,\n每个部件只做一件事并做好它,然后在运行时把它们装配在一起组成应用程序。", + "key": "INANGULARDEPENDENCIESARETYPICALLYSERVICESBUTCANALSOBEVALUESSUCHASSTRINGSORFUNCTIONSANINJECTORGUIDEGLOSSARY#INJECTORFORANAPPCREATEDAUTOMATICALLYDURINGBOOTSTRAPCREATESDEPENDENCIESWHENNEEDEDUSINGAREGISTEREDPROVIDERGUIDEGLOSSARY#PROVIDEROFTHESERVICEORVALUEDIFFERENTPROVIDERSCANPROVIDEDIFFERENTIMPLEMENTATIONSOFTHESAMESERVICE", + "original": "In Angular, dependencies are typically services, but can also be values, such as strings or functions. An [injector](guide/glossary#injector) for an app (created automatically during bootstrap) creates dependencies when needed, using a registered [provider](guide/glossary#provider) of the service or value. Different providers can provide different implementations of the same service.", + "translation": "在 Angular 中,依赖通常是服务,但是也可以是值,比如字符串或函数。应用的[注入器](guide/glossary#injector)(它是在启动期间自动创建的)会使用该服务或值的已注册[提供商](guide/glossary#provider)来按需创建这些依赖。各个不同的提供商可以为同一个服务提供不同的实现。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THESEPARTSOFTENRELYONOTHERPARTSANANGULARCOMPONENTGUIDEGLOSSARY#COMPONENTPARTMIGHTRELYONASERVICEPARTTOGETDATAORPERFORMACALCULATIONWHENPARTARELIESONANOTHERPARTBYOUSAYTHATADEPENDSONBANDTHATBISADEPENDENCYOFA", - "original": "These parts often rely on other parts. An Angular [component](guide/glossary#component)\npart might rely on a service part to get data or perform a calculation. When\npart \"A\" relies on another part \"B,\" you say that \"A\" depends on \"B\" and\nthat \"B\" is a dependency of \"A.\"", - "translation": "这些部件通常会依赖其它部件。一个 Angular [组件 (component)](guide/glossary#component)\n可能依赖一个服务部件来获取数据或执行运算。\n如果部件 “A” 要靠另一个部件 “B” 才能工作,你就会说 “A” 依赖 “B” ,“B” 是 “A” 的依赖。", + "key": "LEARNMOREINTHEDEPENDENCYINJECTIONGUIDEDEPENDENCYINJECTIONGUIDE", + "original": "Learn more in the [Dependency Injection](guide/dependency-injection) guide.", + "translation": "要了解更多,参见[依赖注入](guide/dependency-injection)一章。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "YOUCANASKADEPENDENCYINJECTIONSYSTEMTOCREATEAFORUSANDHANDLEALLTHEDEPENDENCIESIFANEEDSBANDBNEEDSCTHESYSTEMRESOLVESTHATCHAINOFDEPENDENCIESANDRETURNSAFULLYPREPAREDINSTANCEOFA", - "original": "You can ask a \"dependency injection system\" to create \"A\"\nfor us and handle all the dependencies.\nIf \"A\" needs \"B\" and \"B\" needs \"C,\" the system resolves that chain of dependencies\nand returns a fully prepared instance of \"A.\"", - "translation": "你可以要求“依赖注入系统”创建 “A” 并处理所有依赖。如果 “A” 需要 “B” ,“B” 需要 “C ”,\n系统将解析这个依赖链,返回一个完全准备好的 “A” 实例。", + "key": "##DITOKEN", + "original": "## DI token", + "translation": "## DI 令牌", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARPROVIDESANDRELIESUPONITSOWNSOPHISTICATEDDEPENDENCYINJECTIONSYSTEMTOASSEMBLEANDRUNAPPLICATIONSBYINJECTINGAPPLICATIONPARTSINTOOTHERAPPLICATIONPARTSWHEREANDWHENNEEDED", - "original": "Angular provides and relies upon its own sophisticated\ndependency-injection system\nto assemble and run applications by \"injecting\" application parts\ninto other application parts where and when needed.", - "translation": "Angular 提供并使用自己精心设计的[依赖注入 (dependency injection)](guide/dependency-injection)系统来组装和运行应用程序,在需要的地方和时刻,将一些部件“注入”到另一些部件里面。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ATTHECOREANINJECTORGUIDEGLOSSARY#INJECTORRETURNSDEPENDENCYVALUESONREQUESTTHEEXPRESSIONINJECTORGETTOKENRETURNSTHEVALUEASSOCIATEDWITHTHEGIVENTOKEN", - "original": "At the core, an [`injector`](guide/glossary#injector) returns dependency values on request.\nThe expression `injector.get(token)` returns the value associated with the given token.", - "translation": "在 Angular 内核中有一个[注入器 (injector)](guide/glossary#injector),当请求时返回依赖值。\n表达式 `injector.get(token)` 返回与该 token(令牌)参数相关的值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ATOKENISANANGULARTYPEINJECTIONTOKENYOURARELYNEEDTOWORKWITHTOKENSDIRECTLYMOSTMETHODSACCEPTACLASSNAMEFOOORASTRINGFOOANDANGULARCONVERTSITTOATOKENWHENYOUWRITEINJECTORGETFOOTHEINJECTORRETURNSTHEVALUEASSOCIATEDWITHTHETOKENFORTHEFOOCLASSTYPICALLYANINSTANCEOFFOOITSELF", - "original": "A token is an Angular type (`InjectionToken`). You rarely need to work with tokens directly; most\nmethods accept a class name (`Foo`) or a string (\"foo\") and Angular converts it\nto a token. When you write `injector.get(Foo)`, the injector returns\nthe value associated with the token for the `Foo` class, typically an instance of `Foo` itself.", - "translation": "令牌是一个 Angular 中的类型 (`InjectionToken`)。你很少直接处理令牌。\n绝大多数方法都接受类名 (`Foo`) 或字符串 (\"foo\"), Angular 会把这些类名称和字符串转换成令牌。\n当调用 `injector.get(Foo)` 时,注入器返回用 `Foo` 类生成的令牌所对应的依赖值,该依赖值通常是 `Foo` 类的实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "DURINGMANYOFITSOPERATIONSANGULARMAKESSIMILARREQUESTSINTERNALLYSUCHASWHENITCREATESACOMPONENTGUIDEGLOSSARY#COMPONENTFORDISPLAY", - "original": "During many of its operations, Angular makes similar requests internally, such as when it creates a [`component`](guide/glossary#component) for display.", - "translation": "Angular 在内部执行很多类似的依赖注入请求,例如,在创建用于显示的[组件 (component)](guide/glossary#component)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "THEINJECTORMAINTAINSANINTERNALMAPOFTOKENSTODEPENDENCYVALUESIFTHEINJECTORCANTFINDAVALUEFORAGIVENTOKENITCREATESANEWVALUEUSINGAPROVIDERFORTHATTOKEN", - "original": "The `Injector` maintains an internal map of tokens to dependency values.\nIf the `Injector` can't find a value for a given token, it creates\na new value using a `Provider` for that token.", - "translation": "注入器 (`Injector`) 维护一个令牌到依赖值的映射表。\n如果注入器找不到给定令牌对应的依赖值,它会使用提供商 (`Provider`) 创建一个依赖值。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "APROVIDERGUIDEGLOSSARY#PROVIDERISARECIPEFORCREATINGNEWINSTANCESOFADEPENDENCYVALUEASSOCIATEDWITHAPARTICULARTOKEN", - "original": "A [provider](guide/glossary#provider) is a recipe for\ncreating new instances of a dependency value associated with a particular token.", - "translation": "[提供商 (provider)](guide/glossary#provider)是一个“菜谱”,用于创建特定令牌对应的依赖实例。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ANINJECTORCANONLYCREATEAVALUEFORAGIVENTOKENIFITHASAPROVIDERFORTHATTOKENINITSINTERNALPROVIDERREGISTRYREGISTERINGPROVIDERSISACRITICALPREPARATORYSTEP", - "original": "An injector can only create a value for a given token if it has\na `provider` for that token in its internal provider registry.\nRegistering providers is a critical preparatory step.", - "translation": "只有当注入器内部提供商注册表中存在与令牌对应的提供商时,\n注入器才能为这个令牌创建一个依赖值。所以注册提供商是一个非常关键的准备步骤。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ANGULARREGISTERSSOMEOFITSOWNPROVIDERSWITHEVERYINJECTORYOUCANREGISTERYOUROWNPROVIDERS", - "original": "Angular registers some of its own providers with every injector.\nYou can register your own providers.", - "translation": "Angular 会为每个注册器注册很多内置提供商。\n你也可以注册自己的提供商。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "READMOREINTHEDEPENDENCYINJECTIONGUIDEDEPENDENCYINJECTIONPAGE", - "original": "Read more in the [Dependency Injection](guide/dependency-injection) page.", - "translation": "更多信息,参见[依赖注入 (dependency injection)](guide/dependency-injection)。", + "key": "ALOOKUPTOKENASSOCIATEDWITHADEPENDENCYPROVIDERGUIDEGLOSSARY#PROVIDERFORUSEWITHTHEDEPENDENCYINJECTIONGUIDEGLOSSARY#DISYSTEM", + "original": "A lookup token associated with a dependency [provider](guide/glossary#provider), for use with the [dependency injection](guide/glossary#di) system.", + "translation": "一种用来查阅的令牌,它关联到一个依赖[提供商](guide/glossary#provider),用于[依赖注入](guide/glossary#di)系统中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14076,51 +14112,81 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANANGULARCLASSRESPONSIBLEFORCREATINGRESHAPINGANDINTERACTINGWITHHTMLELEMENTSINTHEBROWSERDOMTHEDIRECTIVEISANGULARSMOSTFUNDAMENTALFEATURE", - "original": "An Angular class responsible for creating, reshaping, and interacting with HTML elements\nin the browser DOM. The directive is Angular's most fundamental feature.", - "translation": "指令是一个 Angular 类,负责创建和重塑浏览器 DOM 中的 HTML 元素,并与之互动。\n指令是 Angular 中最基本的特性之一。", + "key": "ACLASSWITHTHEDIRECTIVEDECORATORGUIDEGLOSSARY#DECORATORTHATCANMODIFYTHESTRUCTUREOFTHEDOMORMODIFYATTRIBUTESINTHEDOMANDCOMPONENTDATAMODEL", + "original": "A class with the `@Directive` [decorator](guide/glossary#decorator) that can modify the structure of the DOM, or modify attributes in the DOM and component data model.", + "translation": "一个带有 `@Directive` [装饰器](guide/glossary#decorator)的类,它可以修改 DOM 结构或者修改 DOM 的属性和组件数据模型的属性。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ADIRECTIVEISUSUALLYASSOCIATEDWITHANHTMLELEMENTORATTRIBUTETHISELEMENTORATTRIBUTEISOFTENREFERREDTOASTHEDIRECTIVEITSELF", - "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) 当做指令本身。", + "key": "ADIRECTIVECLASSISUSUALLYASSOCIATEDWITHANHTMLELEMENTORATTRIBUTEANDTHATELEMENTORATTRIBUTEISOFTENREFERREDTOASTHEDIRECTIVEITSELFWHENANGULARFINDSADIRECTIVEINANHTMLTEMPLATEGUIDEGLOSSARY#TEMPLATEITCREATESTHEMATCHINGDIRECTIVECLASSINSTANCEANDGIVESTHEINSTANCECONTROLOVERTHATPORTIONOFTHEBROWSERDOM", + "original": "A directive class is usually associated with an HTML element or attribute, and that element or attribute is often referred to as the directive itself. \nWhen Angular finds a directive in an HTML [template](guide/glossary#template), it creates the matching directive class instance and gives the instance control over that portion of the browser DOM.", + "translation": "指令类几乎总与 HTML 元素或属性 (attribute) 相关。\n通常会把这些 HTML 元素或者属性 (attribute) 当做指令本身。\n当 Angular 在 HTML [模板中](guide/glossary#template)发现某个指令时,会创建与之相匹配的指令类的实例,并且把这部分 DOM 的控制权交给它。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "WHENANGULARFINDSADIRECTIVEINANHTMLTEMPLATEITCREATESTHEMATCHINGDIRECTIVECLASSINSTANCEANDGIVESTHEINSTANCECONTROLOVERTHATPORTIONOFTHEBROWSERDOM", - "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/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "YOUCANINVENTCUSTOMHTMLMARKUPFOREXAMPLEMYDIRECTIVETOASSOCIATEWITHYOURCUSTOMDIRECTIVESYOUADDTHISCUSTOMMARKUPTOHTMLTEMPLATESASIFYOUWEREWRITINGNATIVEHTMLINTHISWAYDIRECTIVESBECOMEEXTENSIONSOFHTMLITSELF", - "original": "You can invent custom HTML markup (for example, ``) to\nassociate with your custom directives. You add this custom markup to HTML templates\nas if you were writing native HTML. In this way, directives become extensions of\nHTML itself.", - "translation": "你可以自定义 HTML 标签(例如 ``)来关联自定义指令。\n然后,可以像写原生 HTML 一样把这些自定义标签放到 HTML 模板里。\n这样,指令就变成了 HTML 本身的拓展。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "DIRECTIVESFALLINTOONEOFTHEFOLLOWINGCATEGORIES:", - "original": "Directives fall into one of the following categories:", + "key": "THEREARETHREECATEGORIESOFDIRECTIVE:", + "original": "There are three categories of directive:", "translation": "指令分为三类:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "COMPONENTSGUIDEGLOSSARY#COMPONENTCOMBINEAPPLICATIONLOGICWITHANHTMLTEMPLATETORENDERAPPLICATIONVIEWSGUIDEGLOSSARY#VIEWCOMPONENTSAREUSUALLYREPRESENTEDASHTMLELEMENTSTHEYARETHEBUILDINGBLOCKSOFANANGULARAPPLICATION", - "original": "* [Components](guide/glossary#component) combine application logic with an HTML template to\nrender application [views](guide/glossary#view). Components are usually represented as HTML elements.\nThey are the building blocks of an Angular application.", - "translation": "[组件 (component)](guide/glossary#component): 用于组合程序逻辑和 HTML 模板,渲染出应用程序的[视图](guide/glossary#view)。\n 组件一般表示成 HTML 元素的形式,它们是构建 Angular 应用程序的基本单元。", + "key": "COMPONENTSGUIDEGLOSSARY#COMPONENTUSECOMPONENTANEXTENSIONOFDIRECTIVETOASSOCIATEATEMPLATEWITHACLASS", + "original": "- [Components](guide/glossary#component) use `@Component` (an extension of `@Directive`) to associate a template with a class.", + "translation": "[组件](guide/glossary#component)使用 `@Component`(继承自 `@Directive`)为某个类关联一个模板。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ATTRIBUTEDIRECTIVESGUIDEGLOSSARY#ATTRIBUTEDIRECTIVECANLISTENTOANDMODIFYTHEBEHAVIOROFOTHERHTMLELEMENTSATTRIBUTESPROPERTIESANDCOMPONENTSTHEYAREUSUALLYREPRESENTEDASHTMLATTRIBUTESHENCETHENAME", - "original": "* [Attribute directives](guide/glossary#attribute-directive) can listen to and modify the behavior of\nother HTML elements, attributes, properties, and components. They are usually represented\nas HTML attributes, hence the name.", - "translation": "[属性型指令 (attribute directive)](guide/glossary#attribute-directive):可以监控和修改其它 HTML 元素、 \n HTML 属性 (attribute)、 DOM 属性 (property)、组件等行为等等。它们通常表示为 HTML 属性 (attibute),故名。", + "key": "ATTRIBUTEDIRECTIVESGUIDEGLOSSARY#ATTRIBUTEDIRECTIVEMODIFYBEHAVIORANDAPPEARANCEOFPAGEELEMENTS", + "original": "- [Attribute directives](guide/glossary#attribute-directive) modify behavior and appearance of page elements.", + "translation": "[属性型指令](guide/glossary#attribute-directive)修改页面元素的行为和外观。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "STRUCTURALDIRECTIVESGUIDEGLOSSARY#STRUCTURALDIRECTIVEARERESPONSIBLEFORSHAPINGORRESHAPINGHTMLLAYOUTTYPICALLYBYADDINGREMOVINGORMANIPULATINGELEMENTSANDTHEIRCHILDREN", - "original": "* [Structural directives](guide/glossary#structural-directive) are responsible for\nshaping or reshaping HTML layout, typically by adding, removing, or manipulating\nelements and their children.", - "translation": "[结构型指令 (structural directive)](guide/glossary#structural-directive):负责塑造或重塑 HTML\n布局。这一般是通过添加、删除或者操作 HTML 元素及其子元素来实现的。", + "key": "STRUCTURALDIRECTIVESGUIDEGLOSSARY#STRUCTURALDIRECTIVEMODIFYTHESTRUCTUREOFTHEDOM", + "original": "- [Structural directives](guide/glossary#structural-directive) modify the structure of the DOM.", + "translation": "[结构型指令](guide/glossary#structural-directive)修改 DOM 的结构。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANGULARSUPPLIESANUMBEROFBUILTINDIRECTIVESTHATBEGINWITHTHENGPREFIXYOUCANALSOCREATENEWDIRECTIVESTOIMPLEMENTYOUROWNFUNCTIONALITYYOUASSOCIATEASELECTORANHTMLTAGSUCHASMYDIRECTIVEWITHACUSTOMDIRECTIVETHEREBYEXTENDINGTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXTHATYOUCANUSEINYOURAPPS", + "original": "Angular supplies a number of built-in directives that begin with the `ng` prefix. You can also create new directives to implement your own functionality. \nYou associate a _selector_ (an HTML tag such as ``) with a custom directive, thereby extending the [template syntax](guide/template-syntax) that you can use in your apps.", + "translation": "Angular 提供了一些以 `ng` 为前缀的内置指令。你也可以创建新的指令来实现自己的功能。\n你可以为自定义指令关联一个*选择器*(一种形如 `` 的 HTML 标记),以扩展[模板语法](guide/template-syntax),从而让你能在应用中使用它。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##DOMAINSPECIFICLANGUAGEDSL", + "original": "## Domain-specific language (DSL)", + "translation": "## 领域特定语言(DSL)", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ASPECIALPURPOSELIBRARYORAPISEEDOMAINSPECIFICLANGUAGEHTTPS:ENWIKIPEDIAORGWIKIDOMAINSPECIFICLANGUAGE", + "original": "A special-purpose library or API; see [Domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language).", + "translation": "一种特殊用途的库或 API,参见[领域特定语言](https://en.wikipedia.org/wiki/Domain-specific_language)词条。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANGULAREXTENDSTYPESCRIPTWITHDOMAINSPECIFICLANGUAGESFORANUMBEROFDOMAINSRELEVANTTOANGULARAPPSDEFINEDINNGMODULESSUCHASANIMATIONSGUIDEANIMATIONSFORMSGUIDEFORMSANDROUTINGANDNAVIGATIONGUIDEROUTER", + "original": "Angular extends TypeScript with domain-specific languages for a number of domains relevant to Angular apps, defined in ngModules such as [animations](guide/animations), [forms](guide/forms), and [routing and navigation](guide/router).", + "translation": "Angular 在一些相关的应用领域中用领域特定语言扩展了 TypeScript,这些 DSL 都定义在 NgModule 中,比如 [动画](guide/animations)、[表单](guide/forms)和[路由与导航](guide/router)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##DYNAMICCOMPONENTLOADING", + "original": "## Dynamic component loading", + "translation": "## 动态组件加载", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ATECHNIQUEFORADDINGACOMPONENTTOTHEDOMATRUNTIMEWHICHREQUIRESTHATYOUEXCLUDETHECOMPONENTFROMCOMPILATIONTHENCONNECTITTOANGULARSCHANGEDETECTIONANDEVENTHANDLINGFRAMEWORKWHENYOUADDITTOTHEDOM", + "original": "A technique for adding a component to the DOM at run time, which requires that you exclude the component from compilation, then connect it to Angular's change-detection and event handling framework when you add it to the DOM.", + "translation": "一种在运行期间把组件添加到 DOM 中的技术,它需要你从编译期间排除该组件,然后,当你把它添加到 DOM 中时,再把它接入 Angular 的变更检测与事件处理框架。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "SEEALSOCUSTOMELEMENTGUIDEGLOSSARY#CUSTOMELEMENTWHICHPROVIDESANEASIERPATHWITHTHESAMERESULT", + "original": "See also [Custom element](guide/glossary#custom-element), which provides an easier path with the same result.", + "translation": "参见[自定义组件](guide/glossary#custom-element),它提供了一种更简单的方式来达到相同的效果。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14136,57 +14202,69 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THELATESTAPPROVEDVERSIONOFJAVASCRIPTISECMASCRIPT2017HTTP:WWWECMAINTERNATIONALORGECMA26280ALSOKNOWNASES2017ORES8MANYANGULARDEVELOPERSWRITETHEIRAPPLICATIONSINES8ORADIALECTTHATSTRIVESTOBECOMPATIBLEWITHITSUCHASTYPESCRIPTGUIDEGLOSSARY#TYPESCRIPT", - "original": "The latest approved version of JavaScript is\n[ECMAScript 2017](http://www.ecma-international.org/ecma-262/8.0/)\n(also known as \"ES2017\" or \"ES8\"). Many Angular developers write their applications\nin ES8 or a dialect that strives to be\ncompatible with it, such as [TypeScript](guide/glossary#typescript).", - "translation": "最新批准的 JavaScript 版本是[ECMAScript 2016](http://www.ecma-international.org/ecma-262/7.0/)(也称“ES2016”或“ES7”)。\nAngular 的开发人员要么使用这个版本的语言,要么使用与之兼容的方言,例如 [TypeScript](guide/glossary#typescript)。", + "key": "NOTALLBROWSERSSUPPORTTHELATESTECMASCRIPTSTANDARDBUTYOUCANUSEATRANSPILERGUIDEGLOSSARY#TRANSPILELIKETYPESCRIPTGUIDEGLOSSARY#TYPESCRIPTTOWRITECODEUSINGTHELATESTFEATURESWHICHWILLTHENBETRANSPILEDTOCODETHATRUNSONVERSIONSTHATARESUPPORTEDBYBROWSERS", + "original": "Not all browsers support the latest ECMAScript standard, but you can use a [transpiler](guide/glossary#transpile) (like [TypeScript](guide/glossary#typescript)) to write code using the latest features, which will then be transpiled to code that runs on versions that are supported by browsers.", + "translation": "并不是所有浏览器都支持最新的 ECMAScript 标准,不过你可以使用[转译器](guide/glossary#transpile)(比如[TypeScript](guide/glossary#typescript))来用最新特性写代码,然后它会被转译成可以在浏览器的其它版本上运行的代码。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "MOSTMODERNBROWSERSONLYSUPPORTTHEMUCHOLDERECMASCRIPT5ALSOKNOWNASES5STANDARDAPPLICATIONSWRITTENINES2017ES2016ES2015ORONEOFTHEIRDIALECTSMUSTBETRANSPILEDGUIDEGLOSSARY#TRANSPILETOES5JAVASCRIPT", - "original": "Most modern browsers only support the much older \"ECMAScript 5\" (also known as \"ES5\") standard.\nApplications written in ES2017, ES2016, ES2015, or one of their dialects must be [transpiled](guide/glossary#transpile)\nto ES5 JavaScript.", - "translation": "目前,几乎所有现代游览器只支持很老的“ECMAScript 5” (也称 ES5)标准。\n使用 ES2016、ES2015 或者其它方言开发的应用程序,必须“[转译 (transpile)](guide/glossary#transpile)”成 ES5 JavaScript。", + "key": "TOLEARNMORESEETHEBROWSERSUPPORTGUIDEBROWSERSUPPORTPAGE", + "original": "To learn more, see the [Browser Support](guide/browser-support) page.", + "translation": "要了解更多,参见[浏览器支持](guide/browser-support)页。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARDEVELOPERSCANWRITEINES5DIRECTLY", - "original": "Angular developers can write in ES5 directly.", - "translation": "Angular 的开发人员也可以选择直接使用 ES5 编程。", + "key": "##ELEMENT", + "original": "## Element", + "translation": "## 元素", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##ES2015", - "original": "## ES2015", - "translation": "## ES2015 语言", + "key": "ANGULARDEFINESANELEMENTREFCLASSTOWRAPRENDERSPECIFICNATIVEUIELEMENTSTHISALLOWSYOUUSEANGULARTEMPLATESANDDATABINDINGTOACCESSDOMELEMENTSWITHOUTREFERENCETOTHENATIVEELEMENTINMOSTCASES", + "original": "Angular defines an `ElementRef` class to wrap render-specific native UI elements. This allows you use Angular templates and data-binding to access DOM elements without reference to the native element in most cases.", + "translation": "Angular 定义了 `ElementRef` 类来包装与渲染有关的原生 UI 元素。这让你可以在大多数情况下使用 Angular 的模板和数据绑定机制来访问 DOM 元素,而不必再引用原生元素。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SHORTHANDFORECMASCRIPTGUIDEGLOSSARY#ECMASCRIPT2015", - "original": "Short hand for [ECMAScript](guide/glossary#ecmascript) 2015.", - "translation": "[ECMAScript](guide/glossary#ecmascript) 2015 的简写。", + "key": "THEDOCUMENTATIONGENERALLYREFERSTOEITHERELEMENTSELEMENTREFINSTANCESORDOMELEMENTSWHICHCOULDBEACCESSEDDIRECTLYIFNECESSARY", + "original": "The documentation generally refers to either elements (`ElementRef` instances) or DOM elements (which could be accessed directly if necessary).", + "translation": "本文档中一般会使用**元素(Element)**来指代 `ElementRef` 的实例,而用 **DOM 元素**来指代直接访问的 DOM。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##ES5", - "original": "## ES5", - "translation": "## ES5 语言", + "key": "COMPARECUSTOMELEMENTGUIDEGLOSSARY#CUSTOMELEMENT", + "original": "Compare [Custom element](guide/glossary#custom-element).", + "translation": "可以对比下[自定义元素](guide/glossary#custom-element)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SHORTHANDFORECMASCRIPTGUIDEGLOSSARY#ECMASCRIPT5THEVERSIONOFJAVASCRIPTRUNBYMOSTMODERNBROWSERS", - "original": "Short hand for [ECMAScript](guide/glossary#ecmascript) 5, the version of JavaScript run by most modern browsers.", - "translation": "“[ECMAScript](guide/glossary#ecmascript) 5”的简写,大部分现代浏览器使用的 JavaScript 版本。", + "key": "##ENTRYPOINT", + "original": "## Entry point", + "translation": "## 入口点", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##ES6", - "original": "## ES6", - "translation": "## ES6 语言", + "key": "AJAVASCRIPTIDTHATMAKESPARTSOFANNPMPACKAGEAVAILABLEFORIMPORTBYOTHERCODETHEANGULARSCOPEDPACKAGESGUIDEGLOSSARY#SCOPEDPACKAGEEACHHAVEANENTRYPOINTNAMEDINDEX", + "original": "A JavaScript ID that makes parts of an NPM package available for import by other code. \nThe Angular [scoped packages](guide/glossary#scoped-package) each have an entry point named `index`.", + "translation": "JavaScript 的 ID 用来让这段代码成为 NPM 包的一部分,从而让其它代码能导入它。\nAngular 的每个[范围化的包](guide/glossary#scoped-package)都有一个名叫 `index` 的入口点。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SHORTHANDFORECMASCRIPTGUIDEGLOSSARY#ECMASCRIPT2015", - "original": "Short hand for [ECMAScript](guide/glossary#ecmascript) 2015.", - "translation": "[ECMAScript](guide/glossary#ecmascript) 2015 的简写。", + "key": "WITHINANGULARUSENGMODULESGUIDEGLOSSARY#NGMODULETOACHIEVETHESAMERESULT", + "original": "Within Angular, use [NgModules](guide/glossary#ngmodule) to achieve the same result.", + "translation": "在 Angular 领域中,[NgModules](guide/glossary#ngmodule) 起到同样的作用。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANANGULARCLASSOROTHERDEFINITIONTHATPROVIDESADEPENDENCYUSINGTHEDEPENDENCYINJECTIONGUIDEGLOSSARY#DIMECHANISMANINJECTABLECLASSISMARKEDBYTHEINJECTABLEDECORATORGUIDEGLOSSARY#DECORATOR", + "original": "An Angular class or other definition that provides a dependency using the [dependency injection](guide/glossary#di) mechanism. An injectable class is marked by the `@Injectable` [decorator](guide/glossary#decorator).", + "translation": "Angular 中的类或其它概念使用[依赖注入](guide/glossary#di)机制来提供依赖。要用 `@Injectable` [装饰器](guide/glossary#decorator)标出可注入的类。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "BOTHASERVICEGUIDEGLOSSARY#SERVICEANDACOMPONENTGUIDEGLOSSARY#COMPONENTTHATDEPENDSONTHATSERVICEMUSTBEMARKEDASINJECTABLEOTHERITEMSSUCHASCONSTANTVALUESCANBEINJECTABLE", + "original": "Both a [service](guide/glossary#service) and a [component](guide/glossary#component) that depends on that service must be marked as injectable. Other items, such as constant values, can be injectable.", + "translation": "无论[服务](guide/glossary#service)还是[组件](guide/glossary#component),只要它们依赖服务,就必须标记为可注入的(可作为注入目标的)。其它内容(比如常量)也可以作为注入源。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14196,9 +14274,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANOBJECTINTHEANGULARDEPENDENCYINJECTIONSYSTEMGUIDEGLOSSARY#DEPENDENCYINJECTIONTHATCANFINDANAMEDDEPENDENCYINITSCACHEORCREATEADEPENDENCYWITHAREGISTEREDPROVIDERGUIDEGLOSSARY#PROVIDER", - "original": "An object in the Angular [dependency-injection system](guide/glossary#dependency-injection)\nthat can find a named dependency in its cache or create a dependency\nwith a registered [provider](guide/glossary#provider).", - "translation": "Angular [依赖注入系统 (Dependency Injection System)](guide/glossary#dependency-injection)中的一个对象,\n它可以在自己的缓存中找到一个命名的“依赖”或者利用已注册的[提供商 (provider)](guide/glossary#provider) 创建这样一个依赖。", + "key": "ANOBJECTINTHEANGULARDEPENDENCYINJECTIONSYSTEMGUIDEGLOSSARY#DEPENDENCYINJECTIONTHATCANFINDANAMEDDEPENDENCYINITSCACHEORCREATEADEPENDENCYWITHAREGISTEREDPROVIDERGUIDEGLOSSARY#PROVIDERINJECTORSARECREATEDFORNGMODULESAUTOMATICALLYASPARTOFTHEBOOTSTRAPPROCESSANDINHERITEDTHROUGHTHECOMPONENTHIERARCHY", + "original": "An object in the Angular [dependency-injection system](guide/glossary#dependency-injection)\nthat can find a named dependency in its cache or create a dependency\nwith a registered [provider](guide/glossary#provider). Injectors are created for NgModules automatically as part of the bootstrap process, and inherited through the component hierarchy.", + "translation": "Angular [依赖注入系统](guide/glossary#dependency-injection)中可以在缓存中根据名字查找依赖,也可以通过已注册的[提供商](guide/glossary#provider)来创建依赖。\n启动过程中会自动为每个模块创建一个注入器,并被组件树继承。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14208,15 +14286,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ADIRECTIVEPROPERTYTHATCANBETHETARGETOFAPROPERTYBINDINGGUIDETEMPLATESYNTAX#PROPERTYBINDINGEXPLAINEDINDETAILINTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGEDATAVALUESFLOWINTOTHISPROPERTYFROMTHEDATASOURCEIDENTIFIEDINTHETEMPLATEEXPRESSIONTOTHERIGHTOFTHEEQUALSIGN", - "original": "A directive property that can be the *target* of a\n[property binding](guide/template-syntax#property-binding) (explained in detail in the [Template Syntax](guide/template-syntax) page).\nData values flow *into* this property from the data source identified\nin the template expression to the right of the equal sign.", - "translation": "输入属性是一个指令属性,可以作为[属性绑定 (property binding)](guide/template-syntax#property-binding)(详情参见[模板语法](guide/template-syntax)页)的目标。\n数据值会从模板表达式等号右侧的数据源流入这个属性。", + "key": "WHENDEFININGADIRECTIVEGUIDEGLOSSARY#DIRECTIVETHEINPUTDECORATORONADIRECTIVEPROPERTYMAKESTHATPROPERTYAVAILABLEASATARGETOFAPROPERTYBINDINGGUIDETEMPLATESYNTAX#PROPERTYBINDINGDATAVALUESFLOWINTOANINPUTPROPERTYFROMTHEDATASOURCEIDENTIFIEDINTHETEMPLATEEXPRESSIONGUIDEGLOSSARY#TEMPLATEEXPRESSIONTOTHERIGHTOFTHEEQUALSIGN", + "original": "When defining a [directive](guide/glossary#directive), the `@Input` decorator on a directive property makes that property available as a *target* of a\n[property binding](guide/template-syntax#property-binding).\nData values flow into an input property from the data source identified\nin the [template expression](guide/glossary#template-expression) to the right of the equal sign.", + "translation": "当定义[指令](guide/glossary#directive)时,指令属性上的 `@Input` 装饰器让该属性可以作为[属性绑定](guide/template-syntax#property-binding)的*目标*使用。\n数据值会从等号右侧的[模板表达式](guide/glossary#template-expression)所指定的数据源流入组件的输入属性。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SEETHEINPUTANDOUTPUTPROPERTIESGUIDETEMPLATESYNTAX#INPUTSOUTPUTSSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "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)部分。", + "key": "TOLEARNMORESEEINPUTANDOUTPUTPROPERTIESGUIDETEMPLATESYNTAX#INPUTSOUTPUTS", + "original": "To learn more, see [input and output properties](guide/template-syntax#inputs-outputs).", + "translation": "要了解更多,参见[输入与输出属性](guide/template-syntax#inputs-outputs)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14226,8 +14304,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AFORMOFPROPERTYDATABINDINGGUIDEGLOSSARY#DATABINDINGINWHICHATEMPLATEEXPRESSIONGUIDEGLOSSARY#TEMPLATEEXPRESSIONBETWEENDOUBLECURLYBRACESRENDERSASTEXTTHATTEXTMAYBECONCATENATEDWITHNEIGHBORINGTEXTBEFOREITISASSIGNEDTOANELEMENTPROPERTYORDISPLAYEDBETWEENELEMENTTAGSASINTHISEXAMPLE", - "original": "A form of [property data binding](guide/glossary#data-binding) in which a\n[template expression](guide/glossary#template-expression) between double-curly braces\nrenders as text. That text may be concatenated with neighboring text\nbefore it is assigned to an element property\nor displayed between element tags, as in this example.", + "key": "AFORMOFPROPERTYDATABINDINGGUIDEGLOSSARY#DATABINDINGINWHICHATEMPLATEEXPRESSIONGUIDEGLOSSARY#TEMPLATEEXPRESSIONBETWEENDOUBLECURLYBRACESRENDERSASTEXTTHATTEXTCANBECONCATENATEDWITHNEIGHBORINGTEXTBEFOREITISASSIGNEDTOANELEMENTPROPERTYORDISPLAYEDBETWEENELEMENTTAGSASINTHISEXAMPLE", + "original": "A form of [property data binding](guide/glossary#data-binding) in which a\n[template expression](guide/glossary#template-expression) between double-curly braces\nrenders as text. That text can be concatenated with neighboring text\nbefore it is assigned to an element property\nor displayed between element tags, as in this example.", "translation": "[属性数据绑定 (property data binding)](guide/glossary#data-binding) 的一种形式,位于双大括号中的[模板表达式 (template expression)](guide/glossary#template-expression)会被渲染成文本。\n在被赋值给元素属性或者显示在元素标签中之前,这些文本可能会先与周边的文本合并,参见下面的例子。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, @@ -14237,6 +14315,12 @@ "translation": "更多信息,见[模板语法](guide/template-syntax)中的[插值表达式](guide/template-syntax#interpolation)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, + { + "key": "SEEECMASCRIPTGUIDEGLOSSARY#ECMATYPESCRIPTGUIDEGLOSSARY#TYPESCRIPT", + "original": "See [ECMAScript](guide/glossary#ecma), [TypeScript](guide/glossary#typescript).", + "translation": "参见 [ECMAScript](guide/glossary#ecma) 和 [TypeScript](guide/glossary#typescript)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, { "key": "##JUSTINTIMEJITCOMPILATION", "original": "## Just-in-time (JIT) compilation", @@ -14244,39 +14328,39 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ABOOTSTRAPPINGMETHODOFCOMPILINGCOMPONENTSANDMODULESINTHEBROWSERANDLAUNCHINGTHEAPPLICATIONDYNAMICALLYJUSTINTIMEMODEISAGOODCHOICEDURINGDEVELOPMENTCONSIDERUSINGTHEAHEADOFTIMEGUIDEGLOSSARY#AOTMODEFORPRODUCTIONAPPS", - "original": "A bootstrapping method of compiling components and modules in the browser\nand launching the application dynamically. Just-in-time mode is a good choice during development.\nConsider using the [ahead-of-time](guide/glossary#aot) mode for production apps.", - "translation": "Angular 的即时编译在浏览器中启动并编译所有的组件和模块,动态运行应用程序。\n 它很适合在开发过程中使用。但是在产品发布时,推荐采用[预编译 (ahead-of-time)](guide/glossary#aot) 模式。", + "key": "THEANGULARJUSTINTIMEJITCOMPILERCONVERTSYOURANGULARHTMLANDTYPESCRIPTCODEINTOEFFICIENTJAVASCRIPTCODEATRUNTIMEASPARTOFBOOTSTRAPPINGJITCOMPILATIONISTHEDEFAULTWHENYOURUNANGULARSNGBUILDANDNGSERVECLICOMMANDSANDISAGOODCHOICEDURINGDEVELOPMENTJITMODEISSTRONGLYDISCOURAGEDFORPRODUCTIONUSEBECAUSEITRESULTSINLARGEAPPLICATIONPAYLOADSTHATHINDERTHEBOOTSTRAPPERFORMANCE", + "original": "The Angular Just-in-Time (JIT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code at run time, as part of bootstrapping. \nJIT compilation is the default when you run Angular's `ng build` and `ng serve` CLI commands, and is a good choice during development. JIT mode is strongly discouraged for production use because it results in large application payloads that hinder the bootstrap performance.", + "translation": "在启动期间,Angular 的即时编译器(JIT)会在运行期间把你的 HTML 和 TypeScript 代码转换成高效的 JavaScript 代码。\n当你运行 Angular 的 CLI 命令 `ng build` 和 `ng serve` 时,JIT 编译是默认选项,而且是开发期间的最佳实践。但是强烈建议你不要在生产环境下使用 JIT 模式,因为它会导致巨大的应用负担,从而拖累启动时的性能。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##KEBABCASE", - "original": "## kebab-case", - "translation": "## 烤串命名法 (kebab-case)", + "key": "COMPAREAHEADOFTIMEAOTCOMPILATIONGUIDEGLOSSARY#AOT", + "original": "Compare [ahead-of-time (AOT) compilation](guide/glossary#aot).", + "translation": "参见 [预先 (AOT) 编译](guide/glossary#aot)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SEEDASHCASEGUIDEGLOSSARY#DASHCASE", - "original": "See [dash-case](guide/glossary#dash-case).", - "translation": "见[中线命名法 (dash-case)](guide/glossary#dash-case)。", + "key": "##LAZYLOADING", + "original": "## Lazy loading", + "translation": "## 惰性加载", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##LIFECYCLEHOOKS", - "original": "## Lifecycle hooks", + "key": "LAZYLOADINGSPEEDSUPAPPLICATIONLOADTIMEBYSPLITTINGTHEAPPLICATIONINTOMULTIPLEBUNDLESANDLOADINGTHEMONDEMANDFOREXAMPLEDEPENDENCIESCANBELAZYLOADEDASNEEDEDEMDASHASOPPOSEDTOEAGERLOADEDMODULESTHATAREREQUIREDBYTHEROOTMODULEANDARETHUSLOADEDONLAUNCHSIMILARLYTHEROUTERGUIDEGLOSSARY#ROUTERCANLOADCHILDVIEWSONLYWHENTHEPARENTVIEWISACTIVATEDANDYOUCANBUILDCUSTOMELEMENTSTHATCANBELOADEDINTOANANGULARAPPWHENNEEDED", + "original": "Lazy loading speeds up application load time by splitting the application into multiple bundles and loading them on demand. \nFor example, dependencies can be lazy-loaded as needed&emdash;as opposed to \"eager-loaded\" modules that are required by the root module, and are thus loaded on launch. \nSimilarly, the [router](guide/glossary#router) can load child views only when the parent view is activated, and you can build custom elements that can be loaded into an Angular app when needed.", + "translation": "惰性加载会把应用拆分成多个包并且按需加载它们,从而提高应用加载速度。\n比如,一些依赖可以根据需要进行惰性加载,与之相对的是那些 \"急性加载\" 的模块,它们是根模块所要用的,因此会在启动期间加载。\n同样,[路由器](guide/glossary#router)只有当父视图激活时才需要加载子视图,你还可以构建一些自定义元素,它们也可以在需要时才加载进 Angular 应用。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##LIFECYCLEHOOK", + "original": "## Lifecycle hook", "translation": "## 生命周期钩子", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "DIRECTIVESGUIDEGLOSSARY#DIRECTIVEANDCOMPONENTSGUIDEGLOSSARY#COMPONENTHAVEALIFECYCLEMANAGEDBYANGULARASITCREATESUPDATESANDDESTROYSTHEM", - "original": "[Directives](guide/glossary#directive) and [components](guide/glossary#component) have a lifecycle\nmanaged by Angular as it creates, updates, and destroys them.", - "translation": "[指令 (directive)](guide/glossary#directive) 和[组件 (component)](guide/glossary#component) 具有生命周期,由 Angular 在创建、更新和销毁它们的过程中进行管理。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "YOUCANTAPINTOKEYMOMENTSINTHATLIFECYCLEBYIMPLEMENTINGONEORMOREOFTHELIFECYCLEHOOKINTERFACES", - "original": "You can tap into key moments in that lifecycle by implementing\none or more of the lifecycle hook interfaces.", - "translation": "你可以通过实现一个或多个生命周期钩子接口,切入到生命周期中的关键时间点。", + "key": "ANINTERFACETHATALLOWSYOUTOTAPINTOTHELIFECYCLEOFDIRECTIVESGUIDEGLOSSARY#DIRECTIVEANDCOMPONENTSGUIDEGLOSSARY#COMPONENTASTHEYARECREATEDUPDATEDANDDESTROYED", + "original": "An interface that allows you to tap into the lifecycle of [directives](guide/glossary#directive) and [components](guide/glossary#component) as they are created, updated, and destroyed.", + "translation": "一种接口,它允许你监听[指令](guide/glossary#directive)和[组件](guide/glossary#component)的生命周期,比如创建、更新和销毁等。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14340,9 +14424,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "READMOREINTHELIFECYCLEHOOKSGUIDELIFECYCLEHOOKSPAGE", - "original": "Read more in the [Lifecycle Hooks](guide/lifecycle-hooks) page.", - "translation": "更多信息,见[生命周期钩子 (lifecycle hook)](guide/lifecycle-hooks)。", + "key": "TOLEARNMORESEETHELIFECYCLEHOOKSGUIDELIFECYCLEHOOKSPAGE", + "original": "To learn more, see the [Lifecycle Hooks](guide/lifecycle-hooks) page.", + "translation": "要了解更多,参见[生命周期钩子](guide/lifecycle-hooks)页。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14352,111 +14436,105 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARHASTHEFOLLOWINGTYPESOFMODULES:", - "original": "Angular has the following types of modules:", - "translation": "Angular 有下列模块类型:", + "key": "INGENERALAMODULECOLLECTSABLOCKOFCODEDEDICATEDTOASINGLEPURPOSEANGULARUSESSTANDARDJAVASCRIPTMODULESANDALSODEFINESANANGULARMODULENGMODULE", + "original": "In general, a module collects a block of code dedicated to a single purpose. Angular uses standard JavaScript modules, and also defines an Angular module, `NgModule`.", + "translation": "通常,模块会收集一组专注于单一目的的代码块。Angular 既使用 JavaScript 的标准模块,也定义了 Angular 自己的模块,也就是 `NgModule`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "NGMODULESGUIDEGLOSSARY#NGMODULEFORDETAILSANDEXAMPLESSEETHENGMODULESGUIDENGMODULESPAGE", - "original": "* [NgModules](guide/glossary#ngmodule).\nFor details and examples, see the [NgModules](guide/ngmodules) page.", - "translation": "[Angular 模块](guide/glossary#ngmodule),见[Angular 模块](guide/ngmodules)。", + "key": "INJAVASCRIPTECMASCRIPTEACHFILEISAMODULEANDALLOBJECTSDEFINEDINTHEFILEBELONGTOTHATMODULEOBJECTSCANEXPORTEDMAKINGTHEMPUBLICANDPUBLICOBJECTSCANBEIMPORTEDFORUSEBYOTHERMODULES", + "original": "In JavaScript (ECMAScript), each file is a module and all objects defined in the file belong to that module. Objects can exported, making them public, and public objects can be imported for use by other modules.", + "translation": "在 JavaScript (ECMAScript) 中,每个文件都是一个模块,该文件中定义的所有对象都属于这个模块。这些对象可以导出为公共对象,而这些公共对象可以被其它模块导入后使用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ES2015MODULESASDESCRIBEDINTHISSECTION", - "original": "* ES2015 modules, as described in this section.", - "translation": "ES2015 模块,如本节所述。", + "key": "ANGULARSHIPSASACOLLECTIONOFJAVASCRIPTMODULESORLIBRARIESEACHANGULARLIBRARYNAMEBEGINSWITHTHEANGULARPREFIXINSTALLTHEMWITHTHENPMPACKAGEMANAGERANDIMPORTPARTSOFTHEMWITHJAVASCRIPTIMPORTDECLARATIONS", + "original": "Angular ships as a collection of JavaScript modules, or libraries. Each Angular library name begins with the `@angular` prefix. Install them with the NPM package manager and import parts of them with JavaScript `import` declarations.", + "translation": "Angular 就是用一组 JavaScript 模块(或叫库)的形式发布的。每个 Angular 库都带有 `@angular` 前缀。\n使用 NPM 包管理器安装它们,并且使用 JavaScript 的 `import` 声明语句从中导入各个部件。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "FORACOMPARISONSEEJAVASCRIPTMODULESVSNGMODULESGUIDENGMODULEVSJSMODULE", - "original": "For a comparison, see [JavaScript Modules vs. NgModules](guide/ngmodule-vs-jsmodule).", - "translation": "要对比这两个概念,请参见[JavaScript 模块 vs. NgModules](guide/ngmodule-vs-jsmodule)。", + "key": "COMPARETHEANGULARNGMODULEGUIDEGLOSSARY#NGMODULE", + "original": "Compare the Angular [NgModule](guide/glossary#ngmodule).", + "translation": "参见 Angular [NgModule](guide/glossary#ngmodule)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ACOHESIVEBLOCKOFCODEDEDICATEDTOASINGLEPURPOSE", - "original": "A cohesive block of code dedicated to a single purpose.", - "translation": "模块是一个内聚的代码块,具有单一用途。", + "key": "ACLASSDEFINITIONWITHANNGMODULEDECORATORGUIDEGLOSSARY#DECORATORTHATDECLARESANDSERVESASAMANIFESTFORABLOCKOFCODEDEDICATEDTOANAPPLICATIONDOMAINAWORKFLOWORACLOSELYRELATEDSETOFCAPABILITIES", + "original": "A class definition with an `@NgModule` [decorator](guide/glossary#decorator), that declares and serves as a manifest for a block of code dedicated to an application domain, a workflow, or a closely related set of capabilities.", + "translation": "一种带有 `@NgModule` [装饰器](guide/glossary#decorator)的类定义,它会声明并提供一组专注于特定功能的代码块,比如业务领域、工作流或一组紧密相关的能力集等。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARAPPSAREMODULAR", - "original": "Angular apps are modular.", - "translation": "Angular 应用程序是模块化的。", + "key": "LIKEAJAVASCRIPTMODULEGUIDEGLOSSARY#MODULEANNGMODULECANEXPORTFUNCTIONALITYFORUSEBYOTHERNGMODULESANDIMPORTPUBLICFUNCTIONALITYFROMOTHERNGMODULES", + "original": "Like a [JavaScript module](guide/glossary#module), an NgModule can export functionality for use by other NgModules, and import public functionality from other NgModules.", + "translation": "像 [JavaScript 模块](guide/glossary#module)一样,NgModule 能导出那些可供其它 NgModule 使用的功能,也可以从其它 NgModule 中导入其公开的功能。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "INGENERALYOUASSEMBLEANAPPLICATIONFROMMANYMODULESBOTHTHEONESYOUWRITEANDTHEONESYOUACQUIREFROMOTHERS", - "original": "In general, you assemble an application from many modules, both the ones you write and the ones you acquire from others.", - "translation": "一般来说,你用模块来组装应用程序,这些模块包含自己编写的模块和从其它地方获取的模块。", + "key": "THEMETADATAFORANNGMODULECLASSCOLLECTSCOMPONENTSDIRECTIVESANDPIPESTHATTHEAPPLICATIONUSESALONGWITHTHELISTOFIMPORTSANDEXPORTSSEEALSODECLARABLEGUIDEGLOSSARY#DECLARABLE", + "original": "The metadata for an NgModule class collects components, directives, and pipes that the application uses along with the list of imports and exports. See also [Declarable](guide/glossary#declarable).", + "translation": "NgModule 类的元数据中包括一些供应用使用的组件、指令和管道,以及导入、导出列表。参见[可声明对象](guide/glossary#declarable)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AMODULEEXPORTSSOMETHINGOFVALUEINTHATCODETYPICALLYONETHINGSUCHASACLASSAMODULETHATNEEDSTHATCLASSIMPORTSIT", - "original": "A module *exports* something of value in that code, typically one thing such as a class;\na module that needs that class *imports* it.", - "translation": "模块会**导出 (export) **代码中的某些值,最典型的就是类。\n模块如果需要什么东西,那就**导入 (import) **它。", + "key": "NGMODULESARETYPICALLYNAMEDAFTERTHEFILEINWHICHTHEEXPORTEDTHINGISDEFINEDFOREXAMPLETHEANGULARDATEPIPEAPICOMMONDATEPIPECLASSBELONGSTOAFEATUREMODULENAMEDDATEPIPEINTHEFILEDATEPIPETSYOUIMPORTTHEMFROMANANGULARSCOPEDPACKAGEGUIDEGLOSSARY#SCOPEDPACKAGESUCHASANGULARCORE", + "original": "NgModules are typically named after the file in which the exported thing is defined; for example, the Angular [DatePipe](api/common/DatePipe) class belongs to a feature module named `date_pipe` in the file `date_pipe.ts`. You import them from an Angular [scoped package](guide/glossary#scoped-package) such as `@angular/core`.", + "translation": "NgModule 通常会根据它导出的内容决定其文件名,比如,Angular 的 [DatePipe](api/common/DatePipe) 类就属于 `date_pipe.ts` 文件中一个名叫 `date_pipe` 的特性模块。\n你可以从 Angular 的[范围化包](guide/glossary#scoped-package)中导入它们,比如 `@angular/core` 。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THESTRUCTUREOFNGMODULESANDTHEIMPORTEXPORTSYNTAXISBASEDONTHEES2015MODULESTANDARDHTTP:WWW2ALITYCOM201409ES6MODULESFINALHTML", - "original": "The structure of NgModules and the import/export syntax\nis based on the [ES2015 module standard](http://www.2ality.com/2014/09/es6-modules-final.html).", - "translation": "Angular 的模块结构和导入/导出语法是基于 [ES2015 模块标准](http://www.2ality.com/2014/09/es6-modules-final.html)的。", + "key": "EVERYANGULARAPPLICATIONHASAROOTMODULEBYCONVENTIONTHECLASSISCALLEDAPPMODULEANDRESIDESINAFILENAMEDAPPMODULETS", + "original": "Every Angular application has a root module. By convention, the class is called `AppModule` and resides in a file named `app.module.ts`.", + "translation": "每个 Angular 应用都有一个根模块。通常,这个类会命名为 `AppModule`,并且位于一个名叫 `app.module.ts` 的文件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANAPPLICATIONTHATADHERESTOTHISSTANDARDREQUIRESAMODULELOADERTOLOADMODULESONREQUESTANDRESOLVEINTERMODULEDEPENDENCIESANGULARDOESNTINCLUDEAMODULELOADERANDDOESNTHAVEAPREFERENCEFORANYPARTICULARTHIRDPARTYLIBRARYYOUCANUSEANYMODULELIBRARYTHATCONFORMSTOTHESTANDARD", - "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/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "MODULESARETYPICALLYNAMEDAFTERTHEFILEINWHICHTHEEXPORTEDTHINGISDEFINEDTHEANGULARDATEPIPEHTTPS:GITHUBCOMANGULARANGULARBLOBMASTERPACKAGESCOMMONSRCPIPESDATEPIPETSCLASSBELONGSTOAFEATUREMODULENAMEDDATEPIPEINTHEFILEDATEPIPETS", - "original": "Modules are typically named after the file in which the exported thing is defined.\nThe Angular [DatePipe](https://github.com/angular/angular/blob/master/packages/common/src/pipes/date_pipe.ts)\nclass belongs to a feature module named `date_pipe` in the file `date_pipe.ts`.", - "translation": "模块一般与它定义导出物的文件同名。例如,Angular 的 [DatePipe](https://github.com/angular/angular/blob/master/modules/angular2/src/common/pipes/date_pipe.ts) 类属于名叫 `date_pipe` 的特性模块,位于 `date_pipe.ts` 文件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "YOURARELYACCESSANGULARFEATUREMODULESDIRECTLYYOUUSUALLYIMPORTTHEMFROMANANGULARSCOPEDPACKAGEGUIDEGLOSSARY#SCOPEDPACKAGESUCHASANGULARCORE", - "original": "You rarely access Angular feature modules directly. You usually import them from an Angular [scoped package](guide/glossary#scoped-package) such as `@angular/core`.", - "translation": "你很少需要直接访问 Angular 的特性模块。\n而通常会从一个 Angular [范围化包 (scoped package)](guide/glossary#scoped-package)中导入它们,例如 `@angular/core`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "HELPSYOUORGANIZEANAPPLICATIONINTOCOHESIVEBLOCKSOFFUNCTIONALITYANNGMODULEIDENTIFIESTHECOMPONENTSDIRECTIVESANDPIPESTHATTHEAPPLICATIONUSESALONGWITHTHELISTOFEXTERNALNGMODULESTHATTHEAPPLICATIONNEEDSSUCHASFORMSMODULE", - "original": "Helps you organize an application into cohesive blocks of functionality.\nAn NgModule identifies the components, directives, and pipes that the application uses along with the list of external NgModules that the application needs, such as `FormsModule`.", - "translation": "帮助你把应用组织成多个内聚的功能块。\nNgModule 表示应用的组件、指令和管道以及所用到的外部模块的列表,比如 `FormsModule`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "EVERYANGULARAPPLICATIONHASANAPPLICATIONROOTMODULECLASSBYCONVENTIONTHECLASSISCALLEDAPPMODULEANDRESIDESINAFILENAMEDAPPMODULETS", - "original": "Every Angular application has an application root-module class. By convention, the class is\ncalled `AppModule` and resides in a file named `app.module.ts`.", - "translation": "每个 Angular 应用都有一个应用级根模块类。这类通常叫做 `AppModule`,并且位于一个名叫 `app.module.ts` 的文件中。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "FORDETAILSANDEXAMPLESSEENGMODULESGUIDENGMODULESANDTHERELATEDFILESINTHATSECTION", - "original": "For details and examples, see [NgModules](guide/ngmodules) and the \nrelated files in that section.", - "translation": "要获得详情和范例,参见 [NgModule](guide/ngmodules) 及其相关文件。", + "key": "TOLEARNMORESEETHENGMODULESGUIDENGMODULESGUIDE", + "original": "To learn more, see the [NgModules](guide/ngmodules) guide.", + "translation": "要了解更多,参见 [NgModules](guide/ngmodules)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { "key": "##OBSERVABLE", "original": "## Observable", - "translation": "## Observable 对象", + "translation": "## Observable(可观察对象)", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANARRAYWHOSEITEMSARRIVEASYNCHRONOUSLYOVERTIMEOBSERVABLESHELPYOUMANAGEASYNCHRONOUSDATASUCHASDATACOMINGFROMABACKENDSERVICEOBSERVABLESAREUSEDWITHINANGULARITSELFINCLUDINGANGULARSEVENTSYSTEMANDITSHTTPCLIENTSERVICE", - "original": "An array whose items arrive asynchronously over time.\nObservables help you manage asynchronous data, such as data coming from a backend service.\nObservables are used within Angular itself, including Angular's event system and its HTTP client service.", - "translation": "一个 `Observable` 是一个数组,其中的元素随着时间的流逝异步地到达。\n`Observable` 帮助你管理异步数据,例如来自后台服务的数据。\nAngular 自身使用了 `Observable`,包括 Angular 的事件系统和它的 http 客户端服务。", + "key": "APRODUCEROFMULTIPLEVALUESWHICHITPUSHESTOSUBSCRIBERSGUIDEGLOSSARY#SUBSCRIBERUSEDFORASYNCHRONOUSEVENTHANDLINGTHROUGHOUTANGULARYOUEXECUTEANOBSERVABLEBYSUBSCRIBINGTOITWITHITSSUBSCRIBEMETHODPASSINGCALLBACKSFORNOTIFICATIONSOFNEWVALUESERRORSORCOMPLETION", + "original": "A producer of multiple values, which it pushes to [subscribers](guide/glossary#subscriber). Used for asynchronous event handling throughout Angular. You execute an observable by subscribing to it with its `subscribe()` method, passing callbacks for notifications of new values, errors, or completion.", + "translation": "一个多值生成器,这些值会被推送给[订阅者](guide/glossary#subscriber)。\nAngular 中到处都会用到异步事件处理。你要通过调用可观察对象的 `subscribe()` 方法来订阅它,从而让这个可观察对象得以执行,你还要给该方法传入一些回调函数来接收 \"有新值\"、\"错误\" 或 \"完成\" 等通知。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "TOUSEOBSERVABLESANGULARUSESATHIRDPARTYLIBRARYCALLEDREACTIVEEXTENSIONSRXJSOBSERVABLESAREAPROPOSEDFEATUREFORES2016THENEXTVERSIONOFJAVASCRIPT", - "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` 是建议的特性之一。", + "key": "OBSERVABLESCANDELIVERSINGLEORMULTIPLEVALUESOFANYTYPETOSUBSCRIBERSEITHERSYNCHRONOUSLYASAFUNCTIONDELIVERSAVALUETOITSCALLERORONASCHEDULEASUBSCRIBERRECEIVESNOTIFICATIONOFNEWVALUESASTHEYAREPRODUCEDANDOFEITHERERRORORNORMALCOMPLETION", + "original": "Observables can deliver single or multiple values of any type to subscribers, either synchronously (as a function delivers a value to its caller), or on a schedule. A subscriber receives notification of new values as they are produced, and of either error or normal completion.", + "translation": "可观察对象可以把任意类型的一个或多个值传给订阅者,无论是同步(就像函数把值返回给它的调用者一样)还是异步。\n一旦生成了新值,订阅者就会收到通知,并且还会收到错误或正常完成的通知。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANGULARUSESATHIRDPARTYLIBRARYCALLEDREACTIVEEXTENSIONSRXJSHTTP:REACTIVEXIORXJS", + "original": "Angular uses a third-party library called [Reactive Extensions (RxJS)](http://reactivex.io/rxjs/).", + "translation": "Angular 使用一个名叫[响应式扩展 (RxJS)](http://reactivex.io/rxjs/)的第三方包来实现这些功能。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "TOLEARNMORESEETHEOBSERVABLESGUIDEGLOSSARY#OBSERVABLEGUIDE", + "original": "To learn more, see the [Observables](guide/glossary#observable) guide.", + "translation": "要了解更多,参见[可观察对象](guide/glossary#observable)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##OBSERVER", + "original": "## Observer", + "translation": "## 观察者", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANOBJECTPASSEDTOTHESUBSCRIBEMETHODFORANOBSERVABLEGUIDEGLOSSARY#OBSERVABLETHATDEFINESTHECALLBACKSFORTHESUBSCRIBERGUIDEGLOSSARY#SUBSCRIBER", + "original": "An object passed to the `subscribe()` method for an [observable](guide/glossary#observable) that defines the callbacks for the [subscriber](guide/glossary#subscriber).", + "translation": "传给[可观察对象](guide/glossary#observable) 的 `subscribe()` 方法的一个对象,其中定义了[订阅者](guide/glossary#subscriber)的一组回调函数。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14466,33 +14544,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ADIRECTIVEPROPERTYTHATCANBETHETARGETOFEVENTBINDINGREADMOREINTHEEVENTBINDINGGUIDETEMPLATESYNTAX#EVENTBINDINGSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGEEVENTSSTREAMOUTOFTHISPROPERTYTOTHERECEIVERIDENTIFIEDINTHETEMPLATEEXPRESSIONTOTHERIGHTOFTHEEQUALSIGN", - "original": "A directive property that can be the *target* of event binding\n(read more in the [event binding](guide/template-syntax#event-binding)\nsection of the [Template Syntax](guide/template-syntax) page).\nEvents stream *out* of this property to the receiver identified\nin the template expression to the right of the equal sign.", - "translation": "输出属性是一个指令属性,可作为[事件绑定](guide/template-syntax.html#event-binding)的 **目标** 。\n事件流从这个属性流*出*到模板表达式等号的右边的接收者。", + "key": "WHENDEFININGADIRECTIVEGUIDEGLOSSARY#DIRECTIVETHEOUTPUTDECORATORONADIRECTIVEPROPERTYMAKESTHATPROPERTYAVAILABLEASATARGETOFEVENTBINDINGGUIDETEMPLATESYNTAX#EVENTBINDING", + "original": "When defining a [directive](guide/glossary#directive), the `@Output` decorator on a directive property makes that property available as a *target* of [event binding](guide/template-syntax#event-binding).", + "translation": "当定义[指令](guide/glossary#directive)时,指令属性上的 `@Output` 装饰器会让该属性可用作[事件绑定](guide/template-syntax#event-binding)的*目标*。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "SEETHEINPUTANDOUTPUTPROPERTIESGUIDETEMPLATESYNTAX#INPUTSOUTPUTSSECTIONOFTHETEMPLATESYNTAXGUIDETEMPLATESYNTAXPAGE", - "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)部分。", + "key": "EVENTSSTREAMOUTOFTHISPROPERTYTOTHERECEIVERIDENTIFIEDINTHETEMPLATEEXPRESSIONGUIDEGLOSSARY#TEMPLATEEXPRESSIONTOTHERIGHTOFTHEEQUALSIGN", + "original": "Events stream *out* of this property to the receiver identified\nin the [template expression](guide/glossary#template-expression) to the right of the equal sign.", + "translation": "事件从该属性流*出*到等号右侧指定的[模板表达式](guide/glossary#template-expression)中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "##PASCALCASE", - "original": "## PascalCase", - "translation": "## Pascal 命名法 (PascalCase)", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "THEPRACTICEOFWRITINGINDIVIDUALWORDSCOMPOUNDWORDSORPHRASESSUCHTHATEACHWORDORABBREVIATIONBEGINSWITHACAPITALLETTERCLASSNAMESARETYPICALLYSPELLEDINPASCALCASEFOREXAMPLEPERSONANDHERODETAILCOMPONENT", - "original": "The practice of writing individual words, compound words, or phrases such that each word or abbreviation begins with a capital letter.\nClass names are typically spelled in PascalCase. For example, `Person` and `HeroDetailComponent`.", - "translation": "Pascal 命名法是书写单词、复合词或短语的一种形式,每个单词或缩写都以大写开头。\n类名一般都采用 Pascal 命名法。例如 `Person` 和 `HeroDetailComponent`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "THISFORMISALSOKNOWNASUPPERCAMELCASETODISTINGUISHITFROMLOWERCAMELCASEORSIMPLYCAMELCASEGUIDEGLOSSARY#CAMELCASEINTHISDOCUMENTATIONPASCALCASEMEANSUPPERCAMELCASEANDCAMELCASEMEANSLOWERCAMELCASE", - "original": "This form is also known as *upper camel case* to distinguish it from *lower camel case* or simply [camelCase](guide/glossary#camelcase).\nIn this documentation, \"PascalCase\" means *upper camel case* and \"camelCase\" means *lower camel case*.", - "translation": "这种形式也称**大写驼峰式命名法**,以区别于**小写驼峰式命名法”或[驼峰式命名法 (camelCase)](guide/glossary#camelcase)** 。\n在本文档中,“Pascal 命名法”都是指的*大写驼峰式命名法*,“驼峰式命名法”指的都是*小写驼峰式命名法*。", + "key": "TOLEARNMORESEEINPUTANDOUTPUTPROPERTIESGUIDETEMPLATESYNTAX#INPUTSOUTPUTS", + "original": "To learn more, see [input and output properties](guide/template-syntax#inputs-outputs).", + "translation": "要了解更多,参见[输入与输出属性](guide/template-syntax#inputs-outputs)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14502,15 +14568,33 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANANGULARPIPEISAFUNCTIONTHATTRANSFORMSINPUTVALUESTOOUTPUTVALUESFORDISPLAYINAVIEWGUIDEGLOSSARY#VIEWHERESANEXAMPLETHATUSESTHEBUILTINCURRENCYPIPETODISPLAYANUMERICVALUEINTHELOCALCURRENCY", - "original": "An Angular pipe is a function that transforms input values to output values for\ndisplay in a [view](guide/glossary#view).\nHere's an example that uses the built-in `currency` pipe to display\na numeric value in the local currency.", - "translation": "Angular 管道是一个函数,用于把输入值转换成输出值以供[视图 (view)](guide/glossary#view)显示。\n下面这个例子中,用内置的 `currency` 管道把数字值显示为本地货币格式。", + "key": "ACLASSWITHTHEPIPEDECORATORWHICHDEFINESAFUNCTIONTHATTRANSFORMSINPUTVALUESTOOUTPUTVALUESFORDISPLAYINAVIEWGUIDEGLOSSARY#VIEW", + "original": "A class with the `@Pipe` decorator which defines a function that transforms input values to output values for display in a [view](guide/glossary#view).", + "translation": "一个带有 `@Pipe` 装饰器的类,它定义了一个函数,用来把输入值转换成输出值,以显示在[视图](guide/glossary#view)中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "YOUCANALSOWRITEYOUROWNCUSTOMPIPESREADMOREINTHEPAGEONPIPESGUIDEPIPES", - "original": "You can also write your own custom pipes.\nRead more in the page on [pipes](guide/pipes).", - "translation": "你还可以写自己的自定义管道。\n更多信息,见[管道](guide/pipes)。", + "key": "ANGULARDEFINESVARIOUSPIPESANDYOUCANDEFINENEWPIPES", + "original": "Angular defines various pipes, and you can define new pipes.", + "translation": "Angular 定义了很多管道,并且你还可可以自定义新的管道。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "TOLEARNMORESEETHEPIPESGUIDEPIPESPAGE", + "original": "To learn more, see the [pipes](guide/pipes) page.", + "translation": "要了解更多,参见[管道](guide/pipes)页。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##POLYFILL", + "original": "## Polyfill", + "translation": "## 腻子脚本(polyfill)", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANNPMPACKAGEGUIDENPMPACKAGESTHATPLUGSGAPSINABROWSERSJAVASCRIPTIMPLEMENTATIONSEETHEBROWSERSUPPORTGUIDEBROWSERSUPPORTGUIDEFORPOLYFILLSTHATSUPPORTPARTICULARFUNCTIONALITYFORPARTICULARPLATFORMS", + "original": "An [NPM package](guide/npm-packages) that plugs gaps in a browser's JavaScript implementation. See the [Browser Support](guide/browser-support) guide for polyfills that support particular functionality for particular platforms.", + "translation": "一个 [NPM 包](guide/npm-packages),它负责弥补浏览器 JavaScript 实现与最新标准之间的 \"缝隙\"。参见[浏览器支持](guide/browser-support)页,以了解要在特定平台支持特定功能时所需的腻子脚本。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14520,9 +14604,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "APROVIDERCREATESANEWINSTANCEOFADEPENDENCYFORTHEDEPENDENCYINJECTIONGUIDEGLOSSARY#DEPENDENCYINJECTIONSYSTEMITRELATESALOOKUPTOKENTOCODEMDASHSOMETIMESCALLEDARECIPEMDASHTHATCANCREATEADEPENDENCYVALUE", - "original": "A _provider_ creates a new instance of a dependency for the\n[dependency injection](guide/glossary#dependency-injection) system.\nIt relates a lookup token to code—sometimes called a \"recipe\"—that can create a dependency value.", - "translation": "依赖注入系统依靠提供商来创建依赖的实例。\n它把一个查找令牌和代码(有时也叫“配方”)关联到一起,以便创建依赖值。", + "key": "APROVIDEROFANINJECTABLESERVICEMDASHSPECIFICALLYACODERECIPEASSOCIATEDWITHADITOKENGUIDEGLOSSARY#TOKENWHICHANINJECTORGUIDEGLOSSARY#INJECTORUSESTOCREATEANEWINSTANCEOFADEPENDENCYFORACLASSTHATREQUIRESIT", + "original": "A provider of an injectable service—specifically, a code recipe associated with a [DI token](guide/glossary#token), which an [injector](guide/glossary#injector) uses to create a new instance of a dependency for a class that requires it.", + "translation": "一种可注入服务的提供商。更准确的说是一个与 [DI 令牌](guide/glossary#token)相关的代码 \"菜谱\",[注入器](guide/glossary#injector)会使用这个菜谱来创建它所依赖的那些类的实例。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANGULARREGISTERSITSOWNPROVIDERSWITHEVERYINJECTORFORSERVICESTHATANGULARDEFINESYOUCANREGISTERYOUROWNPROVIDERSFORSERVICESTHATYOURAPPNEEDS", + "original": "Angular registers its own providers with every injector, for services that Angular defines. You can register your own providers for services that your app needs.", + "translation": "Angular 会为其自带的服务在每个注入器中注册它自己的提供商。你也可以自己注册应用所需的自己的服务提供商。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "SEEALSOSERVICEGUIDEGLOSSARY#SERVICEDEPENDENCYINJECTIONGUIDEGLOSSARY#DI", + "original": "See also [Service](guide/glossary#service), [Dependency Injection](guide/glossary#di).", + "translation": "参见[服务](guide/glossary#service)和[依赖注入](guide/glossary#di)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14580,39 +14676,27 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "MOSTAPPLICATIONSCONSISTOFMANYSCREENSORVIEWSGUIDEGLOSSARY#VIEWTHEUSERNAVIGATESAMONGTHEMBYCLICKINGLINKSANDBUTTONSANDPERFORMINGOTHERSIMILARACTIONSTHATCAUSETHEAPPLICATIONTOREPLACEONEVIEWWITHANOTHER", - "original": "Most applications consist of many screens or [views](guide/glossary#view).\nThe user navigates among them by clicking links and buttons,\nand performing other similar actions that cause the application to\nreplace one view with another.", - "translation": "大多数应用程序包含多个屏幕或[视图 (view)](guide/glossary#view)。\n用户通过点击链接、按钮和其它类似动作,在它们之间导航,使应用程序从一个视图切换到另一个视图。", + "key": "ATOOLTHATCONFIGURESANDIMPLEMENTSNAVIGATIONAMONGSTATESANDVIEWSGUIDEGLOSSARY#VIEWWITHINANANGULARAPP", + "original": "A tool that configures and implements navigation among states and [views](guide/glossary#view) within an Angular app.", + "translation": "一种工具,用来配置和实现 Angular 应用中各个状态和[视图](guide/glossary#view)之间的导航。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THEANGULARCOMPONENTROUTERISARICHLYFEATUREDMECHANISMFORCONFIGURINGANDMANAGINGTHEENTIREVIEWNAVIGATIONPROCESSINCLUDINGTHECREATIONANDDESTRUCTIONOFVIEWS", - "original": "The Angular component router is a richly featured mechanism for configuring and managing the entire view navigation process, including the creation and destruction\nof views.", - "translation": "Angular 的组件路由器是一个特性丰富的机制,可以配置和管理整个导航过程,包括建立和销毁视图。", + "key": "THEROUTERMODULEISANNGMODULEGUIDEGLOSSARY#NGMODULETHATPROVIDESTHENECESSARYSERVICEPROVIDERSANDDIRECTIVESFORNAVIGATINGTHROUGHAPPLICATIONVIEWSAROUTINGCOMPONENTGUIDEGLOSSARY#ROUTINGCOMPONENTISONETHATIMPORTSTHEROUTERMODULEANDWHOSETEMPLATECONTAINSAROUTEROUTLETELEMENTWHEREITCANDISPLAYVIEWSPRODUCEDBYTHEROUTER", + "original": "The Router module is an [NgModule](guide/glossary#ngmodule) that provides the necessary service providers and directives for navigating through application views. A [routing component](guide/glossary#routing-component) is one that imports the Router module and whose template contains a `RouterOutlet` element where it can display views produced by the router.", + "translation": "路由器模块是一个 [NgModule](guide/glossary#ngmodule),它提供在应用视图间导航时需要的服务提供商和指令。[路由组件](guide/glossary#routing-component)是一种组件,它导入了路由模块,并且其模板中包含 `RouterOutlet` 元素,路由器生成的视图就会被显示在那里。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "INMOSTCASESCOMPONENTSBECOMEATTACHEDTOAROUTERBYMEANSOFAROUTERCONFIGTHATDEFINESROUTESTOVIEWS", - "original": "In most cases, components become attached to a router by means\nof a `RouterConfig` that defines routes to views.", - "translation": "多数情况下,组件会通过 `RouterConfig` 中定义的路由到视图的对照表来附加到[路由器](guide/glossary#router)上。", + "key": "THEROUTERDEFINESNAVIGATIONAMONGVIEWSONASINGLEPAGEASOPPOSEDTONAVIGATIONAMONGPAGESITINTERPRETSURLLIKELINKSTODETERMINEWHICHVIEWSTOCREATEORDESTROYANDWHICHCOMPONENTSTOLOADORUNLOADITALLOWSYOUTOTAKEADVANTAGEOFLAZYLOADINGGUIDEGLOSSARY#LAZYLOADINYOURANGULARAPPS", + "original": "The Router defines navigation among views on a single page, as opposed to navigation among pages. It interprets URL-like links to determine which views to create or destroy, and which components to load or unload. It allows you to take advantage of [lazy-loading](guide/glossary#lazy-load) in your Angular apps.", + "translation": "路由器定义了在单页面中的各个视图之间导航的方式,而不是在页面之间。它会解释类似 URL 的链接,以决定该创建或销毁哪些视图,以及要加载或卸载哪些组件。它让你可以在 Angular 应用中获得[惰性加载](guide/glossary#lazy-load)的好处。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AROUTINGCOMPONENTSGUIDEGLOSSARY#ROUTINGCOMPONENTTEMPLATEHASAROUTEROUTLETELEMENTWHEREITCANDISPLAYVIEWSPRODUCEDBYTHEROUTER", - "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/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "OTHERVIEWSINTHEAPPLICATIONLIKELYHAVEANCHORTAGSORBUTTONSWITHROUTERLINKDIRECTIVESTHATUSERSCANCLICKTONAVIGATE", - "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/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "FORMOREINFORMATIONSEETHEROUTINGNAVIGATIONGUIDEROUTERPAGE", - "original": "For more information, see the [Routing & Navigation](guide/router) page.", - "translation": "更多信息,见[路由与导航](guide/router)。", + "key": "TOLEARNMORESEETHEROUTINGNAVIGATIONGUIDEROUTERGUIDE", + "original": "To learn more, see the [Routing & Navigation](guide/router) guide.", + "translation": "要了解更多,参见[路由与导航](guide/router)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14633,6 +14717,18 @@ "translation": "更多信息,见[路由与导航](guide/router)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, + { + "key": "##ROUTEROUTLET", + "original": "## Router outlet", + "translation": "## 路由出口", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ADIRECTIVETHATACTSASAPLACEHOLDERINAROUTINGCOMPONENTSTEMPLATEWHICHANGULARDYNAMICALLYFILLSBASEDONTHECURRENTROUTERSTATE", + "original": "A directive that acts as a placeholder in a routing component's template, which Angular dynamically fills based on the current router state.", + "translation": "一种指令,它在路由组件的模板中充当占位符的角色,Angular 会根据当前的路由状态动态填充它。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, { "key": "##ROUTINGCOMPONENT", "original": "## Routing component", @@ -14658,21 +14754,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AWAYTOGROUPRELATEDNPMPACKAGESREADMOREATTHENPMSCOPEHTTPS:DOCSNPMJSCOMMISCSCOPEPAGE", - "original": "A way to group related *npm* packages.\nRead more at the [npm-scope](https://docs.npmjs.com/misc/scope) page.", - "translation": "对相关的 *npm* 包进行分组的一种方式,参阅[npm-scope](https://docs.npmjs.com/misc/scope)。", + "key": "AWAYTOGROUPRELATEDNPMPACKAGESNGMODULESAREDELIVEREDWITHINSCOPEDPACKAGESWHOSENAMESBEGINWITHTHEANGULARSCOPENAMEANGULARFOREXAMPLEANGULARCOREANGULARCOMMONANGULARHTTPANDANGULARROUTER", + "original": "A way to group related NPM packages. \nNgModules are delivered within *scoped packages* whose names begin with the Angular *scope name* `@angular`. For example, `@angular/core`, `@angular/common`, `@angular/http`, and `@angular/router`.", + "translation": "一种把相关的 NPM 包分组到一起的方式。\nAngular 的 NgModule 都是在一些以 `@angular` 为范围名的*范围化包*中发布的。比如 `@angular/core`、`@angular/common`、`@angular/http` 和 `@angular/router`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "NGMODULESAREDELIVEREDWITHINSCOPEDPACKAGESSUCHASANGULARCOREANGULARCOMMONANGULARPLATFORMBROWSERDYNAMICANGULARHTTPANDANGULARROUTER", - "original": "NgModules are delivered within *scoped packages* such as `@angular/core`,\n`@angular/common`, `@angular/platform-browser-dynamic`, `@angular/http`, and `@angular/router`.", - "translation": "Angular 模块是用一系列*范围化包*的形式发布的,例如 `@angular/core`、`@angular/common`、`@angular/platform-browser-dynamic`、`@angular/http` 和 `@angular/router`。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "IMPORTASCOPEDPACKAGETHESAMEWAYTHATYOUIMPORTANORMALPACKAGETHEONLYDIFFERENCEFROMACONSUMERPERSPECTIVEISTHATTHESCOPEDPACKAGENAMEBEGINSWITHTHEANGULARSCOPENAMEANGULAR", - "original": "Import a scoped package the same way that you import a normal package.\nThe only difference, from a consumer perspective,\nis that the scoped package name begins with the Angular *scope name*, `@angular`.", - "translation": "导入范围化包与导入*普通*包方式相同。\n 从消费者的视角看,唯一的不同是那些包的名字是用 Angular 的*范围化包名*`@angular` 开头的。", + "key": "IMPORTASCOPEDPACKAGEINTHESAMEWAYTHATYOUIMPORTANORMALPACKAGE", + "original": "Import a scoped package in the same way that you import a normal package.", + "translation": "和导入普通包相同的方式导入范围化包。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14682,45 +14772,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "FORDATAORLOGICTHATISNOTASSOCIATEDWITHASPECIFICVIEWORTHATYOUWANTTOSHAREACROSSCOMPONENTSBUILDSERVICES", - "original": "For data or logic that is not associated\nwith a specific view or that you want to share across components, build services.", - "translation": "服务用于封装不与任何特定视图相关的数据和逻辑,或者用于在组件之间共享数据和逻辑。", + "key": "INANGULARASERVICEISACLASSWITHTHEINJECTABLEGUIDEGLOSSARY#INJECTABLEDECORATORTHATENCAPSULATESNONUILOGICANDCODETHATCANBEREUSEDACROSSANAPPLICATIONANGULARDISTINGUISHESCOMPONENTSFROMSERVICESINORDERTOINCREASEMODULARITYANDREUSABILITY", + "original": "In Angular, a service is a class with the [@Injectable](guide/glossary#injectable) decorator that encapsulates non-UI logic and code that can be re-used across an application. \nAngular distinguishes components from services in order to increase modularity and reusability.", + "translation": "在 Angular 中,服务就是一个带有 [@Injectable](guide/glossary#injectable) 装饰器的类,它封装了可以在应用程序中复用的非 UI 逻辑和代码。\nAngular 把组件和服务分开,是为了增进模块化程度和可复用性。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "APPLICATIONSOFTENREQUIRESERVICESSUCHASAHERODATASERVICEORALOGGINGSERVICE", - "original": "Applications often require services such as a hero data service or a logging service.", - "translation": "应用程序经常需要服务,例如英雄数据服务或者日志服务。", + "key": "THEINJECTABLEMETADATAALLOWSTHESERVICECLASSTOBEUSEDWITHTHEDEPENDENCYINJECTIONGUIDEGLOSSARY#DIMECHANISMTHEINJECTABLECLASSISINSTANTIATEDBYAPROVIDERGUIDEGLOSSARY#PROVIDERANDAMODULEMAINTAINSALISTOFPROVIDERSTHATCANPROVIDEAPARTICULARTYPEOFSERVICEASNEEDEDBYCOMPONENTSOROTHERSERVICESTHATREQUIREIT", + "original": "The `@Injectable` metadata allows the service class to be used with the [dependency injection](guide/glossary#di) mechanism. The injectable class is instantiated by a [provider](guide/glossary#provider), and a module maintains a list of providers that can provide a particular type of service as needed by components or other services that require it.", + "translation": "`@Injectable` 元数据让服务类能用于[依赖注入](guide/glossary#di)机制中。可注入的类是用[提供商](guide/glossary#provider)进行实例化的,模块中包含一个提供商列表,它可以为依赖它的组件或其它服务提供该服务的具体类。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ASERVICEISACLASSWITHAFOCUSEDPURPOSEYOUOFTENCREATEASERVICETOIMPLEMENTFEATURESTHATAREINDEPENDENTFROMANYSPECIFICVIEWPROVIDESHAREDDATAORLOGICACROSSCOMPONENTSORENCAPSULATEEXTERNALINTERACTIONS", - "original": "A service is a class with a focused purpose.\nYou often create a service to implement features that are\nindependent from any specific view,\nprovide shared data or logic across components, or encapsulate external interactions.", - "translation": "服务是一个具有特定功能的类。\n你经常创建服务来实现不依赖任何特定视图的特征,\n在组件之间提供共享数据或逻辑,或者封装外部的交互。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "APPLICATIONSOFTENREQUIRESERVICESSUCHASADATASERVICEORALOGGINGSERVICE", - "original": "Applications often require services such as a data service or a logging service.", - "translation": "应用通常都需要服务,比如数据服务或者日志服务。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "FORMOREINFORMATIONSEETHESERVICESTUTORIALTOHPT4PAGEOFTHETOUROFHEROESTUTORIALTUTORIAL", - "original": "For more information, see the [Services](tutorial/toh-pt4) page of the [Tour of Heroes](tutorial) tutorial.", - "translation": "更多信息,见[英雄指南](tutorial)中的[服务](tutorial/toh-pt4)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "##SNAKECASE", - "original": "## snake_case", - "translation": "## 蛇形命名法", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "THEPRACTICEOFWRITINGCOMPOUNDWORDSORPHRASESSUCHTHATANUNDERSCORESEPARATESONEWORDFROMTHENEXTTHISFORMISALSOKNOWNASUNDERSCORECASE", - "original": "The practice of writing compound words or phrases such that an\nunderscore (`_`) separates one word from the next. This form is also known as *underscore case*.", - "translation": "写复合词或短语的一种方式,在多个词之间用下划线(`_`)分隔。也叫*下划线命名法*", + "key": "TOLEARNMORESEEINTRODUCTIONTOSERVICESGUIDEARCHITECTURESERVICES", + "original": "To learn more, see [Introduction to Services](guide/architecture-services).", + "translation": "要了解更多,参见[服务简介](guide/architecture-services)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14730,15 +14796,57 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ACATEGORYOFDIRECTIVEGUIDEGLOSSARY#DIRECTIVETHATCANSHAPEORRESHAPEHTMLLAYOUTTYPICALLYBYADDINGANDREMOVINGELEMENTSINTHEDOMTHENGIFCONDITIONALELEMENTDIRECTIVEANDTHENGFORREPEATERDIRECTIVEAREWELLKNOWNEXAMPLES", - "original": "A category of [directive](guide/glossary#directive) that can\nshape or reshape HTML layout, typically by adding and removing elements in the DOM.\nThe `ngIf` \"conditional element\" directive and the `ngFor` \"repeater\" directive are well-known examples.", - "translation": "结构型指令是[指令 (directive)](guide/glossary#directive)一种,\n可以通过在 DOM 中添加、删除或操作元素和其各级子元素来塑造或重塑 HTML 布局。\n例如,`ngIf` 这个“条件化元素”指令,`ngFor` 这个“重复器”指令都是众所周知的例子。", + "key": "ACATEGORYOFDIRECTIVEGUIDEGLOSSARY#DIRECTIVETHATISRESPONSIBLEFORSHAPINGORRESHAPINGHTMLLAYOUTBYMODIFYINGTHEDOMADDINGREMOVINGORMANIPULATINGELEMENTSANDTHEIRCHILDREN", + "original": "A category of [directive](guide/glossary#directive) that is responsible for shaping or reshaping HTML layout by modifying the DOM (adding, removing, or manipulating elements and their children).", + "translation": "一种[指令](guide/glossary#directive)类型,它能通过修改 DOM (添加、删除或操纵元素及其子元素)来修整或重塑 HTML 的布局。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "READMOREINTHESTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVESPAGE", - "original": "Read more in the [Structural Directives](guide/structural-directives) page.", - "translation": "更多信息,见[结构型指令](guide/structural-directives)。", + "key": "TOLEARNMORESEETHESTRUCTURALDIRECTIVESGUIDESTRUCTURALDIRECTIVESPAGE", + "original": "To learn more, see the [Structural Directives](guide/structural-directives) page.", + "translation": "要了解更多,参见[结构型指令](guide/structural-directives)页。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##SUBSCRIBER", + "original": "## Subscriber", + "translation": "## 订阅者", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "AFUNCTIONTHATDEFINESHOWTOOBTAINORGENERATEVALUESORMESSAGESTOBEPUBLISHEDTHISFUNCTIONISEXECUTEDWHENACONSUMERCALLSTHESUBSCRIBEMETHODOFANOBSERVABLEGUIDEGLOSSARY#OBSERVABLE", + "original": "A function that defines how to obtain or generate values or messages to be published. This function is executed when a consumer calls the `subscribe()` method of an [observable](guide/glossary#observable).", + "translation": "一个函数,用于定义如何获取或生成要发布的值或消息。\n当有消费者调用[可观察对象](guide/glossary#observable)的 `subscribe()` 方法时,该函数就会执行。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THEACTOFSUBSCRIBINGTOANOBSERVABLETRIGGERSITSEXECUTIONASSOCIATESCALLBACKSWITHITANDCREATESASUBSCRIPTIONOBJECTTHATLETSYOUUNSUBSCRIBE", + "original": "The act of subscribing to an observable triggers its execution, associates callbacks with it, and creates a `Subscription` object that lets you unsubscribe.", + "translation": "订阅一个可观察对象就会触发该对象的执行、为该对象关联一些回调函数,并创建一个 `Subscription`(订阅记录)对象来让你能取消订阅。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THESUBSCRIBEMETHODTAKESAJAVASCRIPTOBJECTCALLEDANOBSERVERWITHUPTOTHREECALLBACKSONEFOREACHTYPEOFNOTIFICATIONTHATANOBSERVABLECANDELIVER:", + "original": "The `subscribe()` method takes a JavaScript object (called an \"observer\") with up to three callbacks, one for each type of notification that an observable can deliver:", + "translation": "`subscribe()` 方法接收一个 JavaScript 对象(叫做 \"观察者\"),其中最多可以包含三个回调,分别对应可观察对象可以发出的几种通知类型:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THENEXTNOTIFICATION:SENDSAVALUESUCHASANUMBERASTRINGANOBJECTETC", + "original": "- The `next` notification: sends a value such as a Number, a String, an Object, etc.", + "translation": "`next`(下一个)通知会发送一个值,比如数字、字符串、对象等。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THEERRORNOTIFICATIONSENDSAJAVASCRIPTERROROREXCEPTION", + "original": "- The `error` notification sends a JavaScript Error or exception.", + "translation": "`error`(错误)通知会发送 JavaScript 错误或异常。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THECOMPLETENOTIFICATIONDOESNOTSENDAVALUEBUTTHEHANDLERISCALLEDWHENTHECALLCOMPLETESSCHEDULEDVALUESCANCONTINUETOBERETURNEDAFTERTHECALLCOMPLETES", + "original": "- The `complete` notification does not send a value, but the handler is called when the call completes. Scheduled values can continue to be returned after the call completes.", + "translation": "`complete`(完成)通知不会发送值,但是当调用结束时会调用这个处理器。异步的值可能会在调用了完成之后继续发送过来。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14748,9 +14856,27 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ACHUNKOFHTMLTHATANGULARUSESTORENDERAVIEWGUIDEGLOSSARY#VIEWWITHTHESUPPORTANDGUIDANCEOFANANGULARDIRECTIVEGUIDEGLOSSARY#DIRECTIVEMOSTNOTABLYACOMPONENTGUIDEGLOSSARY#COMPONENT", - "original": "A chunk of HTML that Angular uses to render a [view](guide/glossary#view) with\nthe support and guidance of an Angular [directive](guide/glossary#directive),\nmost notably a [component](guide/glossary#component).", - "translation": "模板是一大块 HTML。Angular 会在[指令 (directive)](guide/glossary#directive) 特别是[组件 (component)](guide/glossary#component)\n 的支持和持续指导下,用它来渲染[视图 (view)](guide/glossary#view)。", + "key": "ATEMPLATEDEFINESHOWTORENDERACOMPONENTSVIEWGUIDEGLOSSARY#VIEWINHTML", + "original": "A template defines how to render a component's [view](guide/glossary#view) in HTML", + "translation": "模板用来定义如何在 HTML 中渲染组件的[视图](guide/glossary#view)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ATEMPLATECOMBINESSTRAIGHTHTMLWITHANGULARDATABINDINGGUIDEGLOSSARY#DATABINDINGSYNTAXDIRECTIVESGUIDEGLOSSARY#DIRECTIVEANDTEMPLATEEXPRESSIONSGUIDEGLOSSARY#TEMPLATEEXPRESSIONLOGICALCONSTRUCTSTHEANGULARELEMENTSINSERTORCALCULATEVALUESTHATMODIFYTHEHTMLELEMENTSBEFORETHEPAGEISDISPLAYED", + "original": "A template combines straight HTML with Angular [data-binding](guide/glossary#data-binding) syntax, [directives](guide/glossary#directive), and [template expressions](guide/glossary#template-expression) (logical constructs). The Angular elements insert or calculate values that modify the HTML elements before the page is displayed.", + "translation": "模板会把纯 HTML 和 Angular 的[数据绑定](guide/glossary#data-binding)语法、[指令](guide/glossary#directive)和[模板表达式](guide/glossary#template-expression)组合起来。Angular 的元素会插入或计算那些值,以便在页面显示出来之前修改 HTML 元素。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ATEMPLATEISASSOCIATEDWITHACOMPONENTGUIDEGLOSSARY#COMPONENTCLASSTHROUGHCOMPONENTDECORATORGUIDEGLOSSARY#DECORATORTHEHTMLCANBEPROVIDEDINLINEASTHEVALUEOFTHETEMPLATEPROPERTYORINASEPARATEHTMLFILELINKEDTHROUGHTHETEMPLATEURLPROPERTY", + "original": "A template is associated with a [component](guide/glossary#component) class through `@Component` [decorator](guide/glossary#decorator). The HTML can be provided inline, as the value of the `template` property, or in a separate HTML file linked through the `templateUrl` property.", + "translation": "模板通过 `@Component` [装饰器](guide/glossary#decorator)与[组件](guide/glossary#component)类关联起来。其 HTML 可以作为 `template` 属性的值用内联的方式提供,也可以通过 `templateUrl` 属性链接到一个独立的 HTML 文件。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ADDITIONALTEMPLATESREPRESENTEDBYATEMPLATEREFOBJECTCANDEFINEALTERNATIVEOREMBEDDEDVIEWSWHICHCANBEREFERENCEDFROMMULTIPLECOMPONENTS", + "original": "Additional templates, represented by a `TemplateRef` object, can define alternative or _embedded_ views, which can be referenced from multiple components.", + "translation": "用 `TemplateRef` 对象表示的其它模板用来定义一些备用视图或*内嵌*视图,它们可以来自多个不同的组件。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14825,6 +14951,18 @@ "translation": "到[模板语法](guide/template-syntax)一章的[模板表达式](guide/template-syntax#template-expressions)部分了解更多模板表达式的知识。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, + { + "key": "##TOKEN", + "original": "## Token", + "translation": "## 令牌", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ANOPAQUEIDENTIFIERUSEDFOREFFICIENTTABLELOOKUPINANGULARADITOKENGUIDEGLOSSARY#DITOKENISUSEDTOFINDPROVIDERSGUIDEGLOSSARY#PROVIDEROFDEPENDENCIESINTHEDEPENDENCYINJECTIONGUIDEGLOSSARY#DISYSTEM", + "original": "An opaque identifier used for efficient table lookup. In Angular, a [DI token](guide/glossary#di-token) is used to find [providers](guide/glossary#provider) of dependencies in the [dependency injection](guide/glossary#di) system.", + "translation": "用于高效查表的不透明标识符(译注:不透明是指你不必了解其细节)。在 Angular 中,[DI 令牌](guide/glossary#di-token)用于在[依赖注入](guide/glossary#di)系统中查找[服务提供商](guide/glossary#provider)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, { "key": "##TRANSPILE", "original": "## Transpile", @@ -14832,9 +14970,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THEPROCESSOFTRANSFORMINGCODEWRITTENINONEFORMOFJAVASCRIPTSUCHASTYPESCRIPTINTOANOTHERFORMOFJAVASCRIPTSUCHASES5GUIDEGLOSSARY#ES5", - "original": "The process of transforming code written in one form of JavaScript\n(such as TypeScript) into another form of JavaScript (such as [ES5](guide/glossary#es5)).", - "translation": "把一种形式的 JavaScript(例如 TypeScript)转换成另一种形式的 JavaScript(例如 [ES5](guide/glossary#es5))的过程。", + "key": "THETRANSLATIONPROCESSTHATTRANFORMSONEVERSIONOFJAVASCRIPTTOANOTHERVERSIONFOREXAMPLEDOWNLEVELINGES2015TOTHEOLDERES5VERSION", + "original": "The translation process that tranforms one version of JavaScript to another version; for example, down-leveling ES2015 to the older ES5 version.", + "translation": "一种翻译过程,它会把一个版本的 JavaScript 转换成另一个版本,比如把下一版的 ES2015 转换成老版本的 ES5。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14844,27 +14982,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AVERSIONOFJAVASCRIPTTHATSUPPORTSMOSTECMASCRIPT2015GUIDEGLOSSARY#ES2015LANGUAGEFEATURESSUCHASDECORATORSGUIDEGLOSSARY#DECORATOR", - "original": "A version of JavaScript that supports most [ECMAScript 2015](guide/glossary#es2015)\nlanguage features such as [decorators](guide/glossary#decorator).", - "translation": "JavaScript 的一个版本,支持了几乎所有 [ECMAScript 2015](guide/glossary#es2015) 语言特性,例如[装饰器 (decorator)](guide/glossary#decorator))。", + "key": "TYPESCRIPTISAPROGRAMMINGLANGUAGENOTABLEFORITSOPTIONALTYPINGSYSTEMWHICHPROVIDESCOMPILETIMETYPECHECKINGANDSTRONGTOOLINGSUPPORTSUCHASCODECOMPLETIONREFACTORINGINLINEDOCUMENTATIONANDINTELLIGENTSEARCHMANYCODEEDITORSANDIDESSUPPORTTYPESCRIPTEITHERNATIVELYORWITHPLUGINS", + "original": "TypeScript is a programming language notable for its optional typing system, which provides\ncompile-time type checking and strong tooling support (such as\ncode completion, refactoring, inline documentation, and intelligent search). Many code editors\nand IDEs support TypeScript either natively or with plug-ins.", + "translation": "TypeScript 是一种程序设计语言,以其可选类型系统著称。\n该类型系统提供了编译时类型检查和强大的工具支持(比如代码补齐、重构、内联文档和智能搜索等)。\n许多代码编辑器和 IDE 都原生支持 TypeScript 或通过插件提供支持。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "TYPESCRIPTISALSONOTABLEFORITSOPTIONALTYPINGSYSTEMWHICHPROVIDESCOMPILETIMETYPECHECKINGANDSTRONGTOOLINGSUPPORTSUCHASINTELLISENSECODECOMPLETIONREFACTORINGANDINTELLIGENTSEARCHMANYCODEEDITORSANDIDESSUPPORTTYPESCRIPTEITHERNATIVELYORWITHPLUGINS", - "original": "TypeScript is also notable for its optional typing system, which provides\ncompile-time type checking and strong tooling support (such as \"intellisense,\"\ncode completion, refactoring, and intelligent search). Many code editors\nand IDEs support TypeScript either natively or with plugins.", - "translation": "TypeScript 还以它的可选类型系统而著称。\n该类型系统提供了编译时类型检查和强大的工具支持(例如 “Intellisense”,代码补齐,重构和智能搜索等)。\n许多代码编辑器和 IDE 都原生支持 TypeScript 或通过插件提供支持。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "TYPESCRIPTISTHEPREFERREDLANGUAGEFORANGULARDEVELOPMENTALTHOUGHYOUCANUSEOTHERJAVASCRIPTDIALECTSSUCHASES5GUIDEGLOSSARY#ES5", - "original": "TypeScript is the preferred language for Angular development, although\nyou can use other JavaScript dialects such as [ES5](guide/glossary#es5).", - "translation": "TypeScript 是 Angular 的首选语言,当然,你可以使用其它 JavaScript 方言,例如[ES5](guide/glossary#es5)。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "READMOREABOUTTYPESCRIPTATTYPESCRIPTLANGORGHTTP:WWWTYPESCRIPTLANGORG", - "original": "Read more about TypeScript at [typescriptlang.org](http://www.typescriptlang.org/).", - "translation": "更多信息,见[typescript.org](http://www.typescriptlang.org/)。", + "key": "TYPESCRIPTISTHEPREFERREDLANGUAGEFORANGULARDEVELOPMENTREADMOREABOUTTYPESCRIPTATTYPESCRIPTLANGORGHTTP:WWWTYPESCRIPTLANGORG", + "original": "TypeScript is the preferred language for Angular development. Read more about TypeScript at [typescriptlang.org](http://www.typescriptlang.org/).", + "translation": "TypeScript 是 Angular 的首选语言。要了解更多,参见 [typescriptlang.org](http://www.typescriptlang.org/)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14874,21 +15000,63 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "APORTIONOFTHESCREENTHATDISPLAYSINFORMATIONANDRESPONDSTOUSERACTIONSSUCHASCLICKSMOUSEMOVESANDKEYSTROKES", - "original": "A portion of the screen that displays information and responds\nto user actions such as clicks, mouse moves, and keystrokes.", - "translation": "视图是屏幕中一小块,用来显示信息并响应用户动作,例如点击、移动鼠标和按键。", + "key": "AVIEWISTHESMALLESTGROUPINGOFDISPLAYELEMENTSTHATCANBECREATEDANDDESTROYEDTOGETHER", + "original": "A view is the smallest grouping of display elements that can be created and destroyed together.", + "translation": "视图是指显示元素的最小分组单位,它们会被同时创建和销毁。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ANGULARRENDERSAVIEWUNDERTHECONTROLOFONEORMOREDIRECTIVESGUIDEGLOSSARY#DIRECTIVEESPECIALLYCOMPONENTGUIDEGLOSSARY#COMPONENTDIRECTIVESANDTHEIRCOMPANIONTEMPLATESGUIDEGLOSSARY#TEMPLATETHECOMPONENTPLAYSSUCHAPROMINENTROLETHATITSOFTENCONVENIENTTOREFERTOACOMPONENTASAVIEW", - "original": "Angular renders a view under the control of one or more [directives](guide/glossary#directive),\nespecially [component](guide/glossary#component) directives and their companion [templates](guide/glossary#template).\nThe component plays such a prominent role that it's often\nconvenient to refer to a component as a view.", - "translation": "Angular 在一个或多个[指令 (directive)](guide/glossary#directive) 的控制下渲染视图,\n尤其是[组件 (component)](guide/glossary#component) 指令及其[模板 (template)](guide/glossary#template)。\n组件扮演着非常重要的角色,以至于习惯上会把组件视为一种视图。", + "key": "ANGULARRENDERSAVIEWUNDERTHECONTROLOFONEORMOREDIRECTIVESGUIDEGLOSSARY#DIRECTIVEESPECIALLYCOMPONENTGUIDEGLOSSARY#COMPONENTDIRECTIVESANDTHEIRCOMPANIONTEMPLATESGUIDEGLOSSARY#TEMPLATE", + "original": "Angular renders a view under the control of one or more [directives](guide/glossary#directive),\nespecially [component](guide/glossary#component) directives and their companion [templates](guide/glossary#template).", + "translation": "Angular 在一个或多个[指令 (directive)](guide/glossary#directive) 的控制下渲染视图,\n尤其是[组件 (component)](guide/glossary#component) 指令及其[模板 (template)](guide/glossary#template)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "VIEWSOFTENCONTAINOTHERVIEWSANYVIEWMIGHTBELOADEDANDUNLOADEDDYNAMICALLYASTHEUSERNAVIGATESTHROUGHTHEAPPLICATIONTYPICALLYUNDERTHECONTROLOFAROUTERGUIDEGLOSSARY#ROUTER", - "original": "Views often contain other views. Any view might be loaded and unloaded\ndynamically as the user navigates through the application, typically\nunder the control of a [router](guide/glossary#router).", - "translation": "视图一般包含其它视图,在用户在应用程序中导航时,\n任何视图都可能被动态加载或卸载,这一般会在[路由器 (router)](guide/glossary#router) 的控制下进行。", + "key": "AVIEWISSPECIFICALLYREPRESENTEDBYAVIEWREFINSTANCEASSOCIATEDWITHTHECOMPONENTAVIEWTHATBELONGSTOACOMPONENTISCALLEDAHOSTVIEWVIEWSARETYPICALLYCOLLECTEDINTOVIEWHIERARCHIESGUIDEGLOSSARY#VIEWTREE", + "original": "A view is specifically represented by a `ViewRef` instance associated with the component. \nA view that belongs to a component is called a _host view_. \nViews are typically collected into [view hierarchies](guide/glossary#view-tree).", + "translation": "具体实现上,视图由一个与该组件相关的 `ViewRef` 实例表示。\n属于某个组件的视图叫做*宿主视图*。\n通常会把视图组织成一些[视图树(view hierarchies)](guide/glossary#view-tree)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "PROPERTIESOFELEMENTSINAVIEWCANCHANGEDYNAMICALLYINRESPONSETOUSERACTIONSTHESTRUCTURENUMBERANDORDEROFELEMENTSINAVIEWCANNOTYOUCANCHANGETHESTRUCTUREOFELEMENTSBYINSERTINGMOVINGORREMOVINGNESTEDVIEWSWITHINTHEIRVIEWCONTAINERS", + "original": "Properties of elements in a view can change dynamically, in response to user actions; the structure (number and order) of elements in a view cannot. You can change the structure of elements by inserting, moving, or removing nested views within their view containers.", + "translation": "视图中各个元素的属性可以动态修改以响应用户的操作,而这些元素的结构(数量或顺序)则不能。你可以通过在它们的视图容器中插入、移动或移除内嵌视图来修改这些元素的结构。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "VIEWHIERARCHIESCANBELOADEDANDUNLOADEDDYNAMICALLYASTHEUSERNAVIGATESTHROUGHTHEAPPLICATIONTYPICALLYUNDERTHECONTROLOFAROUTERGUIDEGLOSSARY#ROUTER", + "original": "View hierarchies can be loaded and unloaded dynamically as the user navigates through the application, typically under the control of a [router](guide/glossary#router).", + "translation": "当用户在应用中导航时(比如使用[路由器](guide/glossary#router)),视图树可以动态加载或卸载。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##VIEWHIERARCHY", + "original": "## View hierarchy", + "translation": "## 视图树", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "ATREEOFRELATEDVIEWSTHATCANBEACTEDONASAUNITTHEROOTVIEWISACOMPONENTSHOSTVIEWAHOSTVIEWCANBETHEROOTOFATREEOFEMBEDDEDVIEWSCOLLECTEDINAVIEWCONTAINERVIEWCONTAINERREFATTACHEDTOANANCHORELEMENTINTHEHOSTINGCOMPONENTTHEVIEWHIERARCHYISAKEYPARTOFANGULARCHANGEDETECTION", + "original": "A tree of related views that can be acted on as a unit. The root view is a component's _host view_. A host view can be the root of a tree of _embedded views_, collected in a _view container_ (`ViewContainerRef`) attached to an anchor element in the hosting component. The view hierarchy is a key part of Angular change detection.", + "translation": "一棵相关视图的树,它们可以作为一个整体行动。其根视图就是组件的*宿主视图*。宿主视图可以是*内嵌视图*树的根,它被收集到了宿主组件上的一个*视图容器(`ViewContainerRef`)*中。视图树是 Angular 变更检测的关键部件之一。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "THEVIEWHIERARCHYDOESNOTIMPLYACOMPONENTHIERARCHYVIEWSTHATAREEMBEDDEDINTHECONTEXTOFAPARTICULARHIERARCHYCANBEHOSTVIEWSOFOTHERCOMPONENTSTHOSECOMPONENTSCANBEINTHESAMENGMODULEASTHEHOSTINGCOMPONENTORBELONGTOOTHERNGMODULES", + "original": "The view hierarchy does not imply a component hierarchy. Views that are embedded in the context of a particular hierarchy can be host views of other components. Those components can be in the same NgModule as the hosting component, or belong to other NgModules.", + "translation": "视图树和组件树并不是一一对应的。那些嵌入到指定视图树上下文中的视图也可能是其它组件的宿主视图。那些组件可能和宿主组件位于同一个 NgModule 中,也可能属于其它 NgModule。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "##WEBCOMPONENT", + "original": "## Web component", + "translation": "## Web 组件", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" + }, + { + "key": "SEECUSTOMELEMENTGUIDEGLOSSARY#CUSTOMELEMENT", + "original": "See [Custom element](guide/glossary#custom-element)", + "translation": "参见[自定义元素](guide/glossary#custom-element)", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -14898,33 +15066,27 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "AMECHANISMFORENCAPSULATINGANDINTERCEPTINGAJAVASCRIPTAPPLICATIONSASYNCHRONOUSACTIVITY", - "original": "A mechanism for encapsulating and intercepting\na JavaScript application's asynchronous activity.", - "translation": "区域是一种用来封装和截听 JavaScript 应用程序异步活动的机制。", + "key": "ANEXECUTIONCONTEXTFORASETOFASYNCHRONOUSTASKSUSEFULFORDEBUGGINGPROFILINGANDTESTINGAPPSTHATINCLUDEASYNCHRONOUSOPERATIONSSUCHASEVENTPROCESSINGPROMISESANDCALLSTOREMOTESERVERS", + "original": "An execution context for a set of asynchronous tasks. Useful for debugging, profiling, and testing apps that include asynchronous operations such as event processing, promises, and calls to remote servers.", + "translation": "一组异步任务的执行上下文。它对于调试、性能分析和测试那些包含了异步操作(如事件处理、承诺、远程服务器调用等)的应用是非常有用的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "THEBROWSERDOMANDJAVASCRIPTHAVEALIMITEDNUMBEROFASYNCHRONOUSACTIVITIESSUCHASDOMEVENTSFOREXAMPLECLICKSPROMISESHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBJAVASCRIPTREFERENCEGLOBALOBJECTSPROMISEANDXHRHTTPS:DEVELOPERMOZILLAORGENUSDOCSWEBAPIXMLHTTPREQUESTCALLSTOREMOTESERVERS", - "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) 调用远程服务。", + "key": "ANANGULARAPPRUNSINAZONEWHEREITCANRESPONDTOASYNCHRONOUSEVENTSBYCHECKINGFORDATACHANGESANDUPDATINGTHEINFORMATIONITDISPLAYSBYRESOLVINGDATABINDINGSGUIDEGLOSSARY#DATABINDING", + "original": "An Angular app runs in a zone where it can respond to asynchronous events by checking for data changes and updating the information it displays by resolving [data bindings](guide/glossary#data-binding).", + "translation": "Angular 应用会运行在一个 Zone 区域中,在这里,它可以对异步事件做出反应,可以通过检查数据变更、利用[数据绑定 (data bindings)](guide/glossary#data-binding) 来更新信息显示。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { - "key": "ZONESINTERCEPTALLOFTHESEACTIVITIESANDGIVEAZONECLIENTTHEOPPORTUNITYTOTAKEACTIONBEFOREANDAFTERTHEASYNCACTIVITYFINISHES", - "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/angular-cn/aio/content/guide/glossary.md" - }, - { - "key": "ANGULARRUNSYOURAPPLICATIONINAZONEWHEREITCANRESPONDTOASYNCHRONOUSEVENTSBYCHECKINGFORDATACHANGESANDUPDATINGTHEINFORMATIONITDISPLAYSVIADATABINDINGSGUIDEGLOSSARY#DATABINDING", - "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) 来更新信息显示。", + "key": "AZONECLIENTCANTAKEACTIONBEFOREANDAFTERANASYNCOPERATIONCOMPLETES", + "original": "A zone client can take action before and after an async operation completes.", + "translation": "Zone 的使用方可以在异步操作完成之前或之后采取行动。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { "key": "LEARNMOREABOUTZONESINTHISBRIANFORDVIDEOHTTPS:WWWYOUTUBECOMWATCHV3IQTMUSCEU", "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)。", + "translation": "要了解更多,参见 [Brian Ford 的视频](https://www.youtube.com/watch?v=3IqtmUscE_U)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/glossary.md" }, { @@ -15210,8 +15372,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/hierarchical-dependency-injection.md" }, { - "key": "THENYOUCREATEACHILDCOMPONENTBTHATDEFINESITSOWNSPECIALIZEDPROVIDERSFORCARSERVICEANDENGINESERVICETHATHAVESPECIALCAPABILITESSUITABLEFORWHATEVERISGOINGONINCOMPONENTB", - "original": "Then you create a child component (B) that defines its own, _specialized_ providers for `CarService` and `EngineService`\nthat have special capabilites suitable for whatever is going on in component (B).", + "key": "THENYOUCREATEACHILDCOMPONENTBTHATDEFINESITSOWNSPECIALIZEDPROVIDERSFORCARSERVICEANDENGINESERVICETHATHAVESPECIALCAPABILITIESSUITABLEFORWHATEVERISGOINGONINCOMPONENTB", + "original": "Then you create a child component (B) that defines its own, _specialized_ providers for `CarService` and `EngineService`\nthat have special capabilities suitable for whatever is going on in component (B).", "translation": "然后,你创建一个子组件(B),它为 `CarService` 和 `EngineService` 定义了自己的*特殊的*提供商,它们具有更特殊的能力,适用于组件 B 的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/hierarchical-dependency-injection.md" }, @@ -15636,9 +15798,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "APPSOFTENPOSTDATATOASERVERTHEYPOSTWHENSUBMITTINGAFORMINTHEFOLLOWINGEXAMPLETHEHEROSERVICEPOSTSWHENADDINGAHEROTOTHEDATABASE", - "original": "Apps often POST data to a server. They POST when submitting a form. \nIn the following example, the `HeroService` posts when adding a hero to the database.", - "translation": "应用经常把数据 `POST` 到服务器。它们会在提交表单时进行 `POST`。\n下面这个例子中,`HeroService` 在把英雄添加到数据库中时,就会使用 `POST`。", + "key": "APPSOFTENPOSTDATATOASERVERTHEYPOSTWHENSUBMITTINGAFORMINTHEFOLLOWINGEXAMPLETHEHEROESSERVICEPOSTSWHENADDINGAHEROTOTHEDATABASE", + "original": "Apps often POST data to a server. They POST when submitting a form. \nIn the following example, the `HeroesService` posts when adding a hero to the database.", + "translation": "应用经常把数据 `POST` 到服务器。它们会在提交表单时进行 `POST`。\n下面这个例子中,`HeroesService` 在把英雄添加到数据库中时,就会使用 `POST`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -15666,9 +15828,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "OFCOURSEITCATCHESERRORSINMUCHTHESAMEMANNERDESCRIBEDABOVE#ERRORDETAILSITALSOTAPSTHERETURNEDOBSERVABLEINORDERTOLOGTHESUCCESSFULPOST", - "original": "Of course it catches errors in much the same manner [described above](#error-details).\nIt also _taps_ the returned observable in order to log the successful POST.", - "translation": "当然,它捕获错误的方式很像[前面描述的](#error-details)操作方式。\n它还*窃听*了可观察对象的返回值,以记录成功的 `POST`。", + "key": "OFCOURSEITCATCHESERRORSINMUCHTHESAMEMANNERDESCRIBEDABOVE#ERRORDETAILS", + "original": "Of course it catches errors in much the same manner [described above](#error-details).", + "translation": "当然,它捕获错误的方式很像[前面描述的](#error-details)操作方式。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -15702,27 +15864,21 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "YOUMUSTCALLSUBSCRIBEORNOTHINGHAPPENS", - "original": "You must call _subscribe()_ or nothing happens!", - "translation": "你必须调用 `subscribe()`,否则什么都不会发生。", + "key": "THECOMPONENTISNTEXPECTINGARESULTFROMTHEDELETEOPERATIONSOITSUBSCRIBESWITHOUTACALLBACKEVENTHOUGHYOUARENOTUSINGTHERESULTYOUSTILLHAVETOSUBSCRIBECALLINGTHESUBSCRIBEMETHODEXECUTESTHEOBSERVABLEWHICHISWHATINITIATESTHEDELETEREQUEST", + "original": "The component isn't expecting a result from the delete operation, so it subscribes without a callback. Even though you are not using the result, you still have to subscribe. Calling the `subscribe()` method _executes_ the observable, which is what initiates the DELETE request.", + "translation": "该组件不会等待删除操作的结果,所以它的 subscribe (订阅)中没有回调函数。不过就算你不关心结果,也仍然要订阅它。调用 `subscribe()` 方法会**执行**这个可观察对象,这时才会真的发起 DELETE 请求。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "THECOMPONENTISNTEXPECTINGARESULTFROMTHEDELETEOPERATIONANDSUBSCRIBESWITHOUTACALLBACKTHEBARESUBSCRIBESEEMSPOINTLESS", - "original": "The component isn't expecting a result from the delete operation and\nsubscribes without a callback.\nThe bare `.subscribe()` _seems_ pointless.", - "translation": "该组件不关心删除操作返回的结果,订阅时也没有回调函数。\n单纯的 `.subscribe()` 方法看似毫无意义。", + "key": "YOUMUSTCALLSUBSCRIBEORNOTHINGHAPPENSJUSTCALLINGHEROESSERVICEDELETEHERODOESNOTINITIATETHEDELETEREQUEST", + "original": "You must call _subscribe()_ or nothing happens. Just calling `HeroesService.deleteHero()` **does not initiate the DELETE request.**", + "translation": "你必须调用 `subscribe()`,否则什么都不会发生。仅仅调用 `HeroesService.deleteHero()` 是**不会发起 DELETE 请求的。**", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "INFACTITISESSENTIALMERELYCALLINGHEROSERVICEDELETEHERODOESNOTINITIATETHEDELETEREQUEST", - "original": "In fact, it is essential.\nMerely calling `HeroService.deleteHero()` **does not initiate the DELETE request.**", - "translation": "但实际上,它是必备的。\n否则调用 `HeroService.deleteHero()` 时**不会发起 DELETE 请求**。", - "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" - }, - { - "key": "###ALWAYSSUBSCRIBE", - "original": "### Always _subscribe_!", - "translation": "### 别忘了*订阅*!", + "key": "ALWAYSSUBSCRIBE", + "original": "**Always _subscribe_!**", + "translation": "**别忘了*订阅*!**", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -15739,7 +15895,7 @@ }, { "key": "ALLOBSERVABLESRETURNEDFROMHTTPCLIENTMETHODSARECOLDBYDESIGNEXECUTIONOFTHEHTTPREQUESTISDEFERREDALLOWINGYOUTOEXTENDTHEOBSERVABLEWITHADDITIONALOPERATIONSSUCHASTAPANDCATCHERRORBEFOREANYTHINGACTUALLYHAPPENS", - "original": "All observables returned from `HttpClient` methods are _cold_ by design.\nExecution of the HTTP request is _deferred_, allowing you to extend the\nobservable with additional operations such as `tap` and `catchError`\n before anything actually happens.", + "original": "All observables returned from `HttpClient` methods are _cold_ by design.\nExecution of the HTTP request is _deferred_, allowing you to extend the\nobservable with additional operations such as `tap` and `catchError` before anything actually happens.", "translation": "`HttpClient` 的所有方法返回的可观察对象都设计为*冷的*。\nHTTP 请求的执行都是*延期执行的*,让你可以用 `tap` 和 `catchError` 这样的操作符来在实际执行什么之前,先对这个可观察对象进行扩展。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, @@ -15768,9 +15924,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "ANAPPWILLSENDAPUTREQUESTTOCOMPLETELYREPLACEARESOURCEWITHUPDATEDDATATHEFOLLOWINGHEROSERVICEEXAMPLEISJUSTLIKETHEPOSTEXAMPLE", - "original": "An app will send a PUT request to completely replace a resource with updated data.\nThe following `HeroService` example is just like the POST example.", - "translation": "应用可以发送 PUT 请求,来使用修改后的数据完全替换掉一个资源。\n下面的 `HeroService` 例子和 POST 的例子很像。", + "key": "ANAPPWILLSENDAPUTREQUESTTOCOMPLETELYREPLACEARESOURCEWITHUPDATEDDATATHEFOLLOWINGHEROESSERVICEEXAMPLEISJUSTLIKETHEPOSTEXAMPLE", + "original": "An app will send a PUT request to completely replace a resource with updated data.\nThe following `HeroesService` example is just like the POST example.", + "translation": "应用可以发送 PUT 请求,来使用修改后的数据完全替换掉一个资源。\n下面的 `HeroesService` 例子和 POST 的例子很像。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -15786,9 +15942,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "THEABOVESECTIONSDETAILHOWTOUSETHEBASICHTTPFUNCTIONALITYINANGULARCOMMONHTTPBUTSOMETIMESYOUNEEDTODOMORETHANMAKESIMPLEREQUESTSANDGETDATABACK", - "original": "The above sections detail how to use the basic HTTP functionality in `@angular/common/http`, but sometimes you need to do more than make simple requests and get data back.", - "translation": "上面这个小节中详细讲解了如何使用 `@angular/common/http` 中提供的基本 HTTP 功能,但有时候除了单纯发起请求和取回数据之外,你还要再做点别的。", + "key": "WEHAVEDISCUSSEDTHEBASICHTTPFUNCTIONALITYINANGULARCOMMONHTTPBUTSOMETIMESYOUNEEDTODOMORETHANMAKESIMPLEREQUESTSANDGETDATABACK", + "original": "We have discussed the basic HTTP functionality in `@angular/common/http`, but sometimes you need to do more than make simple requests and get data back.", + "translation": "我们已经讨论了 `@angular/common/http` 的基本 HTTP 功能,但有时候除了单纯发起请求和取回数据之外,你还要再做点别的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -15804,9 +15960,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "YOUSAWEARLIER#ADDINGHEADERSTHATTHEHEROSERVICESETSTHEDEFAULTHEADERSBYPASSINGANOPTIONSOBJECTHTTPOPTIONSTOITSSAVEMETHODSYOUCANDOMORE", - "original": "You [saw earlier](#adding-headers) that the `HeroService` sets the default headers by\npassing an options object (`httpOptions`) to its save methods.\nYou can do more.", - "translation": "[以前你曾在](#adding-headers) `HeroService` 中通过在其保存方法中传入配置对象 `httpOptions` 设置过默认头。\n你还可以做更多。", + "key": "YOUSAWEARLIER#ADDINGHEADERSTHATTHEHEROESSERVICESETSTHEDEFAULTHEADERSBYPASSINGANOPTIONSOBJECTHTTPOPTIONSTOITSSAVEMETHODSYOUCANDOMORE", + "original": "You [saw earlier](#adding-headers) that the `HeroesService` sets the default headers by\npassing an options object (`httpOptions`) to its save methods.\nYou can do more.", + "translation": "[以前你曾在](#adding-headers) `HeroesService` 中通过在其保存方法中传入配置对象 `httpOptions` 设置过默认头。\n你还可以做更多。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -15847,7 +16003,7 @@ }, { "key": "IFTHEREISASEARCHTERMTHECODECONSTRUCTSANOPTIONSOBJECTWITHANHTMLURLENCODEDSEARCHPARAMETERIFTHETERMWEREFOOTHEGETREQUESTURLWOULDBEAPIHEROESNAMEFOO", - "original": "If there is a search term, the code constructs an options object with an HTML URL encoded search parameter. If the term were \"foo\", the GET request URL would be `api/heroes/?name=foo`.", + "original": "If there is a search term, the code constructs an options object with an HTML URL-encoded search parameter. If the term were \"foo\", the GET request URL would be `api/heroes/?name=foo`.", "translation": "如果有搜索词,这段代码就会构造一个包含进行过 URL 编码的搜索词的选项对象。如果这个搜索词是“foo”,这个 GET 请求的 URL 就会是 `api/heroes/?name=foo`。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, @@ -15871,7 +16027,7 @@ }, { "key": "WHENTHEUSERENTERSANAMEINASEARCHBOXTHEPACKAGESEARCHCOMPONENTSENDSASEARCHREQUESTFORAPACKAGEWITHTHATNAMETOTHENPMWEBAPI", - "original": "When the user enters a name in a search-box, the `PackageSearchComponent` sends\na search request for a package with that name to the NPM web api.", + "original": "When the user enters a name in a search-box, the `PackageSearchComponent` sends\na search request for a package with that name to the NPM web API.", "translation": "当用户在搜索框中输入名字时,`PackageSearchComponent` 就会把一个根据名字搜索包的请求发送给 NPM 的 web api。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, @@ -15894,9 +16050,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "THESEARCHTEXTISTHESEQUENCEOFSEARCHBOXVALUESCOMINGFROMTHEUSERITSDEFINEDASANRXJSSUBJECTWHICHMEANSITISANOBSERVABLETHATCANALSOPRODUCEVALUESFORITSELFBYCALLINGNEXTVALUEASHAPPENSINTHESEARCHMETHOD", - "original": "The `searchText$` is the sequence of search-box values coming from the user.\nIt's defined as an RxJS `Subject`, which means it is an `Observable`\nthat can also produce values for itself by calling `next(value)`,\nas happens in the `search()` method.", - "translation": "`searchText$` 是一个序列,包含用户输入到搜索框中的所有值。\n它定义成了 RxJS 的 `Subject` 对象,这表示它是一个 `Observable`,同时还可以自行调用 `next(value)` 来产生值。\n`search()` 方法中就是这么做的。", + "key": "THESEARCHTEXTISTHESEQUENCEOFSEARCHBOXVALUESCOMINGFROMTHEUSERITSDEFINEDASANRXJSSUBJECTWHICHMEANSITISAMULTICASTINGOBSERVABLETHATCANALSOPRODUCEVALUESFORITSELFBYCALLINGNEXTVALUEASHAPPENSINTHESEARCHMETHOD", + "original": "The `searchText$` is the sequence of search-box values coming from the user.\nIt's defined as an RxJS `Subject`, which means it is a multicasting `Observable`\nthat can also produce values for itself by calling `next(value)`,\nas happens in the `search()` method.", + "translation": "`searchText$` 是一个序列,包含用户输入到搜索框中的所有值。\n它定义成了 RxJS 的 `Subject` 对象,这表示它是一个多播 `Observable`,同时还可以自行调用 `next(value)` 来产生值。\n`search()` 方法中就是这么做的。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -16417,8 +16573,8 @@ }, { "key": "AREVISEDVERSIONOFTHECACHINGINTERCEPTOROPTIONALLYRETURNSANOBSERVABLETHATIMMEDIATELYEMITSTHECACHEDRESPONSESENDSTHEREQUESTTOTHENPMWEBAPIANYWAYANDEMITSAGAINLATERWITHTHEUPDATEDSEARCHRESULTS", - "original": "A revised version of the `CachingInterceptor` optionally returns an _observable_ that\nimmediately emits the cached response, sends the request to the npm web api anyway,\nand emits again later with the updated search results.", - "translation": "修改后的 `CachingInterceptor` 版本可以返回一个立即发出缓存的响应,然后仍然把请求发送到 npm 的 Web API,然后再把修改过的搜索结果重新发出一次。", + "original": "A revised version of the `CachingInterceptor` optionally returns an _observable_ that\nimmediately emits the cached response, sends the request to the NPM web API anyway,\nand emits again later with the updated search results.", + "translation": "修改后的 `CachingInterceptor` 版本可以返回一个立即发出缓存的响应,然后仍然把请求发送到 NPM 的 Web API,然后再把修改过的搜索结果重新发出一次。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -16680,9 +16836,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { - "key": "CALLREQUESTERRORWITHANERROREVENTINSTEADOFREQUESTFLUSHASINTHISEXAMPLE", - "original": "Call `request.error()` with an `ErrorEvent` instead of `request.flush()`, as in this example.", - "translation": "那就调用 `request.error()`,并给它传入一个 `ErrorEvent`,而不是 `request.flush()`。例子如下:", + "key": "CALLREQUESTFLUSHWITHANERRORMESSAGEASSEENINTHEFOLLOWINGEXAMPLE", + "original": "Call `request.flush()` with an error message, as seen in the following example.", + "translation": "调用 `request.flush()` 并传入一个错误信息,如下所示:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" + }, + { + "key": "ALTERNATIVELYYOUCANCALLREQUESTERRORWITHANERROREVENT", + "original": "Alternatively, you can call `request.error()` with an `ErrorEvent`.", + "translation": "另外,你还可以使用 `ErrorEvent` 来调用 `request.error()`.", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/http.md" }, { @@ -19152,9 +19314,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/lifecycle-hooks.md" }, { - "key": "NOTICETHATTHEMYCHILDTAGISTUCKEDBETWEENTHEAFTERCONTENTTAGSNEVERPUTCONTENTBETWEENACOMPONENTSELEMENTTAGSUNLESSYOUINTENDTOPROJECTTHATCONTENTINTOTHECOMPONENT", - "original": "Notice that the `` tag is tucked between the `` tags.\nNever put content between a component's element tags *unless you intend to project that content\ninto the component*.", - "translation": "注意,`` 标签被包含在 `` 标签中。\n永远不要在组件标签的内部放任何内容 —— *除非你想把这些内容投影进这个组件中*。", + "key": "NOTICETHATTHEAPPCHILDTAGISTUCKEDBETWEENTHEAFTERCONTENTTAGSNEVERPUTCONTENTBETWEENACOMPONENTSELEMENTTAGSUNLESSYOUINTENDTOPROJECTTHATCONTENTINTOTHECOMPONENT", + "original": "Notice that the `` tag is tucked between the `` tags.\nNever put content between a component's element tags *unless you intend to project that content\ninto the component*.", + "translation": "注意,`` 标签被包含在 `` 标签中。\n永远不要在组件标签的内部放任何内容 —— *除非你想把这些内容投影进这个组件中*。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/lifecycle-hooks.md" }, { @@ -19164,9 +19326,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/lifecycle-hooks.md" }, { - "key": "THENGCONTENTTAGISAPLACEHOLDERFORTHEEXTERNALCONTENTITTELLSANGULARWHERETOINSERTTHATCONTENTINTHISCASETHEPROJECTEDCONTENTISTHEMYCHILDFROMTHEPARENT", - "original": "The `` tag is a *placeholder* for the external content.\nIt tells Angular where to insert that content.\nIn this case, the projected content is the `` from the parent.", - "translation": "`` 标签是外来内容的*占位符*。\n它告诉 Angular 在哪里插入这些外来内容。\n在这里,被投影进去的内容就是来自父组件的 `` 标签。", + "key": "THENGCONTENTTAGISAPLACEHOLDERFORTHEEXTERNALCONTENTITTELLSANGULARWHERETOINSERTTHATCONTENTINTHISCASETHEPROJECTEDCONTENTISTHEAPPCHILDFROMTHEPARENT", + "original": "The `` tag is a *placeholder* for the external content.\nIt tells Angular where to insert that content.\nIn this case, the projected content is the `` from the parent.", + "translation": "`` 标签是外来内容的*占位符*。\n它告诉 Angular 在哪里插入这些外来内容。\n在这里,被投影进去的内容就是来自父组件的 `` 标签。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/lifecycle-hooks.md" }, { @@ -20412,15 +20574,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { - "key": "THEFORROOTSTATICMETHODISACONVENTIONTHATMAKESITEASYFORDEVELOPERSTOCONFIGURETHEMODULESPROVIDERS", - "original": "The `forRoot()` static method is a convention that makes it easy for developers to configure the module's providers.", - "translation": "静态方法 `forRoot()` 是一个约定,它可以让开发人员更轻松的配置模块的提供商。", + "key": "THEFORROOTSTATICMETHODISACONVENTIONTHATMAKESITEASYFORDEVELOPERSTOCONFIGURESERVICESANDPROVIDERSTHATAREINTENDEDTOBESINGLETONSAGOODEXAMPLEOFFORROOTISTHEROUTERMODULEFORROOTMETHOD", + "original": "The `forRoot()` static method is a convention that makes it easy for developers to configure services and providers that are intended to be singletons. A good example of `forRoot()` is the `RouterModule.forRoot()` method.", + "translation": "静态方法 `forRoot()` 是一个约定,它可以让开发人员更轻松的配置模块的想要单例使用的服务及其提供商。`RouterModule.forRoot()` 就是一个很好的例子。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { - "key": "THEROUTERMODULEFORROOTMETHODISAGOODEXAMPLEAPPSPASSAROUTESOBJECTTOROUTERMODULEFORROOTINORDERTOCONFIGURETHEAPPWIDEROUTERSERVICEWITHROUTESROUTERMODULEFORROOTRETURNSAMODULEWITHPROVIDERSAPICOREMODULEWITHPROVIDERSYOUADDTHATRESULTTOTHEIMPORTSLISTOFTHEROOTAPPMODULE", - "original": "The `RouterModule.forRoot()` method is a good example.\nApps pass a `Routes` object to `RouterModule.forRoot()` in order to configure the app-wide `Router` service with routes.\n`RouterModule.forRoot()` returns a [ModuleWithProviders](api/core/ModuleWithProviders).\nYou add that result to the `imports` list of the root `AppModule`.", - "translation": "`RouterModule.forRoot()` 就是一个很好的例子。\n应用把一个 `Routes` 对象传给 `RouterModule.forRoot()`,为的就是使用路由配置全应用级的 `Router` 服务。\n`RouterModule.forRoot()` 返回一个[ModuleWithProviders](api/core/ModuleWithProviders)对象。\n你把这个结果添加到根模块 `AppModule` 的 `imports` 列表中。", + "key": "APPSPASSAROUTESOBJECTTOROUTERMODULEFORROOTINORDERTOCONFIGURETHEAPPWIDEROUTERSERVICEWITHROUTESROUTERMODULEFORROOTRETURNSAMODULEWITHPROVIDERSAPICOREMODULEWITHPROVIDERSYOUADDTHATRESULTTOTHEIMPORTSLISTOFTHEROOTAPPMODULE", + "original": "Apps pass a `Routes` object to `RouterModule.forRoot()` in order to configure the app-wide `Router` service with routes.\n`RouterModule.forRoot()` returns a [ModuleWithProviders](api/core/ModuleWithProviders).\nYou add that result to the `imports` list of the root `AppModule`.", + "translation": "应用把一个 `Routes` 对象传给 `RouterModule.forRoot()`,为的就是使用路由配置全应用级的 `Router` 服务。\n`RouterModule.forRoot()` 返回一个[ModuleWithProviders](api/core/ModuleWithProviders)对象。\n你把这个结果添加到根模块 `AppModule` 的 `imports` 列表中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { @@ -20429,6 +20591,12 @@ "translation": "只能在应用的根模块 `AppModule` 中调用并导入 `.forRoot()` 的结果。\n在其它模块中导入它,特别是惰性加载模块中,是违反设计目标的并会导致一个运行时错误。\n要了解更多,参见[单例服务](guide/singleton-services)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, + { + "key": "FORASERVICEINSTEADOFUSINGFORROOTSPECIFYPROVIDEDIN:ROOTONTHESERVICESINJECTABLEDECORATORWHICHMAKESTHESERVICEAUTOMATICALLYAVAILABLETOTHEWHOLEAPPLICATIONANDTHUSSINGLETONBYDEFAULT", + "original": "For a service, instead of using `forRoot()`, specify `providedIn: 'root'` on the service's `@Injectable()` decorator, which \nmakes the service automatically available to the whole application and thus singleton by default.", + "translation": "对于服务来说,除了可以使用 `forRoot()`外,更好的方式是在该服务的 `@Injectable()` 装饰器中指定 `providedIn: 'root'`,它让该服务自动在全应用级可用,这样它也就默认是单例的。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" + }, { "key": "ROUTERMODULEALSOOFFERSAFORCHILDSTATICMETHODFORCONFIGURINGTHEROUTESOFLAZYLOADEDMODULES", "original": "`RouterModule` also offers a `forChild` static method for configuring the routes of lazy-loaded modules.", @@ -20640,9 +20808,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { - "key": "REGISTERAPPLICATIONWIDEPROVIDERSINTHEROOTAPPMODULENOTINTHEAPPCOMPONENT", - "original": "Register application-wide providers in the root `AppModule`, not in the `AppComponent`.", - "translation": "在根模块 `AppModule` 中注册全应用级提供商,而不是 `AppComponent` 中。", + "key": "DEFINEAPPLICATIONWIDEPROVIDERSBYSPECIFYINGPROVIDEDIN:ROOTONITSINJECTABLEDECORATORINTHECASEOFSERVICESORATINJECTIONTOKENCONSTRUCTIONINTHECASEWHERETOKENSAREPROVIDEDPROVIDERSTHATARECREATEDTHISWAYAUTOMATICALLYAREMADEAVAILABLETOTHEENTIREAPPLICATIONANDDONTNEEDTOBELISTEDINANYMODULE", + "original": "Define application-wide providers by specifying `providedIn: 'root'` on its `@Injectable()` decorator (in the case of services) or at `InjectionToken` construction (in the case where tokens are provided). Providers that are created this way automatically are made available to the entire application and don't need to be listed in any module.", + "translation": "通过在服务的 `@Injectable()` 装饰器中(例如服务)指定 `providedIn: 'root'` 来定义全应用级提供商,或者 `InjectionToken` 的构造器(例如提供令牌的地方),都可以定义全应用级提供商。\n通过这种方式创建的服务提供商会自动在整个应用中可用,而不用把它列在任何模块中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" + }, + { + "key": "IFAPROVIDERCANNOTBECONFIGUREDINTHISWAYPERHAPSBECAUSEITHASNOSENSIBLEDEFAULTVALUETHENREGISTERAPPLICATIONWIDEPROVIDERSINTHEROOTAPPMODULENOTINTHEAPPCOMPONENT", + "original": "If a provider cannot be configured in this way (perhaps because it has no sensible default value), then register application-wide providers in the root `AppModule`, not in the `AppComponent`.", + "translation": "如果某个提供商不能用这种方式配置(可能因为它没有有意义的默认值),那就在根模块 `AppModule` 中注册这些全应用级服务,而不是在 `AppComponent` 中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { @@ -20700,9 +20874,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { - "key": "INGENERALPREFERREGISTERINGFEATURESPECIFICPROVIDERSINMODULESNGMODULEPROVIDERSTOREGISTERINGINCOMPONENTSCOMPONENTPROVIDERS", - "original": "In general, prefer registering feature-specific providers in modules (`@NgModule.providers`)\nto registering in components (`@Component.providers`).", - "translation": "通常,优先把模块中具体特性的提供商注册到模块中(`@NgModule.providers`),而不是组件中(`@Component.providers`)。", + "key": "PROVIDERSSHOULDBECONFIGUREDUSINGINJECTABLESYNTAXIFPOSSIBLETHEYSHOULDBEPROVIDEDINTHEAPPLICATIONROOTPROVIDEDIN:ROOTSERVICESTHATARECONFIGUREDTHISWAYARELAZILYLOADEDIFTHEYAREONLYUSEDFROMALAZILYLOADEDCONTEXT", + "original": "Providers should be configured using `@Injectable` syntax. If possible, they should be provided in the application root (`providedIn: 'root'`). Services that are configured this way are lazily loaded if they are only used from a lazily loaded context.", + "translation": "提供商应该使用 `@Injectable` 语法进行配置。只要可能,就应该把它们在应用的根注入器中提供(`providedIn: 'root'`)。\n如果它们只被惰性加载的上下文中使用,那么这种方式配置的服务就是惰性加载的。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" + }, + { + "key": "IFITSTHECONSUMERSDECISIONWHETHERAPROVIDERISAVAILABLEAPPLICATIONWIDEORNOTTHENREGISTERPROVIDERSINMODULESNGMODULEPROVIDERSINSTEADOFREGISTERINGINCOMPONENTSCOMPONENTPROVIDERS", + "original": "If it's the consumer's decision whether a provider is available application-wide or not, \nthen register providers in modules (`@NgModule.providers`) instead of registering in components (`@Component.providers`).", + "translation": "如果要由消费方来决定是否把它作为全应用级提供商,那么就要在模块中(`@NgModule.providers`)注册提供商,而不是组件中(`@Component.providers`)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/ngmodule-faq.md" }, { @@ -21493,8 +21673,8 @@ }, { "key": "YOUCANDOWNLOADANDINSTALLTHESENPMPACKAGESWITHTHENPMCLIENTHTTPS:DOCSNPMJSCOMCLIINSTALLWHICHRUNSASANODEJSAPPLICATION", - "original": "You can download and install these npm packages with the [**npm client**](https://docs.npmjs.com/cli/install), which runs as a node.js application.", - "translation": "你可以使用 [**npm**](https://docs.npmjs.com/cli/install) 来安装这些 npm 包,npm 命令也是一个 node.js 应用。", + "original": "You can download and install these npm packages with the [**npm client**](https://docs.npmjs.com/cli/install), which runs as a Node.js® application.", + "translation": "你可以使用 [**npm**](https://docs.npmjs.com/cli/install) 来安装这些 npm 包,npm 命令也是一个 Node.js® 应用。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { @@ -21516,20 +21696,20 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { - "key": "VERIFYTHATYOUARERUNNINGNODEV4XXORHIGHERANDNPM3XXORHIGHERBYRUNNINGTHECOMMANDSNODEVANDNPMVINATERMINALCONSOLEWINDOWOLDERVERSIONSPRODUCEERRORS", - "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老版本会产生错误。", + "key": "VERIFYTHATYOUARERUNNINGNODEJSV8XORHIGHERANDNPM5XORHIGHERBYRUNNINGTHECOMMANDSNODEVANDNPMVINATERMINALCONSOLEWINDOWOLDERVERSIONSPRODUCEERRORS", + "original": "**Verify that you are running Node.js `v8.x` or higher and npm `5.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 是 `v8.x` 或更高,npm 为 `5.x` 或更高。**\n老版本会产生错误。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { - "key": "CONSIDERUSINGNVMHTTPS:GITHUBCOMCREATIONIXNVMFORMANAGINGMULTIPLEVERSIONSOFNODEANDNPMYOUMAYNEEDNVMHTTPS:GITHUBCOMCREATIONIXNVMIFYOUALREADYHAVEPROJECTSRUNNINGONYOURMACHINETHATUSEOTHERVERSIONSOFNODEANDNPM", - "original": "Consider using [nvm](https://github.com/creationix/nvm) for managing multiple\nversions of node and npm. You may need [nvm](https://github.com/creationix/nvm) if\nyou already have projects running on your machine that use other versions of node and npm.", - "translation": "建议使用[nvm](https://github.com/creationix/nvm)来管理 node 和 npm 的多个版本。如果你机器上已经有某些项目运行了 node 和 npm 的其它版本,你就会需要[nvm](https://github.com/creationix/nvm)了。", + "key": "CONSIDERUSINGNVMHTTPS:GITHUBCOMCREATIONIXNVMFORMANAGINGMULTIPLEVERSIONSOFNODEJSANDNPMYOUMAYNEEDNVMHTTPS:GITHUBCOMCREATIONIXNVMIFYOUALREADYHAVEPROJECTSRUNNINGONYOURMACHINETHATUSEOTHERVERSIONSOFNODEJSANDNPM", + "original": "Consider using [nvm](https://github.com/creationix/nvm) for managing multiple\nversions of Node.js and npm. You may need [nvm](https://github.com/creationix/nvm) if\nyou already have projects running on your machine that use other versions of Node.js and npm.", + "translation": "建议使用[nvm](https://github.com/creationix/nvm)来管理 node 和 npm 的多个版本。如果你机器上已经有某些项目运行了 Node.js 和 npm 的其它版本,你就会需要[nvm](https://github.com/creationix/nvm)了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { - "key": "BOTHNPMANDYARNINSTALLPACKAGESIDENTIFIEDINAPACKAGEJSONHTTPS:DOCSNPMJSCOMFILESPACKAGEJSONFILE", - "original": "Both `npm` and `yarn` install packages identified in a [**package.json**](https://docs.npmjs.com/files/package.json) file.", + "key": "BOTHNPMANDYARNINSTALLPACKAGESTHATAREIDENTIFIEDINAPACKAGEJSONHTTPS:DOCSNPMJSCOMFILESPACKAGEJSONFILE", + "original": "Both `npm` and `yarn` install packages that are identified in a [**package.json**](https://docs.npmjs.com/files/package.json) file.", "translation": "无论是 `npm` 还是 `yarn`,所安装的包都记录在 [**package.json**](https://docs.npmjs.com/files/package.json) 文件中。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, @@ -21726,9 +21906,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { - "key": "TYPES:TYPESCRIPTDEFINITIONFILESFOR3RDPARTYLIBRARIESSUCHASJASMINEANDNODE", - "original": "**@types/... **: TypeScript definition files for 3rd party libraries such as Jasmine and node.", - "translation": "**@types/... **:第三方库(比如 Jasmine 和 node)的 TypeScript 类型定义文件。", + "key": "TYPES:TYPESCRIPTDEFINITIONFILESFOR3RDPARTYLIBRARIESSUCHASJASMINEANDNODEJS", + "original": "**@types/... **: TypeScript definition files for 3rd party libraries such as Jasmine and Node.js.", + "translation": "**@types/... **:第三方库(比如 Jasmine 和 Node.js)的 TypeScript 类型定义文件。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { @@ -21756,9 +21936,9 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { - "key": "TSNODEHTTPS:WWWNPMJSCOMPACKAGETSNODE:TYPESCRIPTEXECUTIONENVIRONMENTANDREPLFORNODE", - "original": "**[ts-node](https://www.npmjs.com/package/ts-node)**: TypeScript execution environment and REPL for node.", - "translation": "**[ts-node](https://www.npmjs.com/package/ts-node)**:TypeScript 的运行环境以及在 node 环境下用的 REPL。", + "key": "TSNODEHTTPS:WWWNPMJSCOMPACKAGETSNODE:TYPESCRIPTEXECUTIONENVIRONMENTANDREPLFORNODEJS", + "original": "**[ts-node](https://www.npmjs.com/package/ts-node)**: TypeScript execution environment and REPL for Node.js.", + "translation": "**[ts-node](https://www.npmjs.com/package/ts-node)**:TypeScript 的运行环境以及在 Node.js 环境下用的 REPL。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/npm-packages.md" }, { @@ -22068,8 +22248,8 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/observables.md" }, { - "key": "NOTETHATANEXTFUNCTIONCOULDRECEIVEFORINSTANCEMESSAGESTRINGSOREVENTOBJECTSNUMERICVALUESORSTUCTURESDEPENDINGONCONTEXTASAGENERALTERMWEREFERTODATAPUBLISHEDBYANOBSERVABLEASASTREAMANYTYPEOFVALUECANBEREPRESENTEDWITHANOBSERVABLEANDTHEVALUESAREPUBLISHEDASASTREAM", - "original": "Note that a `next()` function could receive, for instance, message strings, or event objects, numeric values, or stuctures, depending on context. As a general term, we refer to data published by an observable as a *stream*. Any type of value can be represented with an observable, and the values are published as a stream.", + "key": "NOTETHATANEXTFUNCTIONCOULDRECEIVEFORINSTANCEMESSAGESTRINGSOREVENTOBJECTSNUMERICVALUESORSTRUCTURESDEPENDINGONCONTEXTASAGENERALTERMWEREFERTODATAPUBLISHEDBYANOBSERVABLEASASTREAMANYTYPEOFVALUECANBEREPRESENTEDWITHANOBSERVABLEANDTHEVALUESAREPUBLISHEDASASTREAM", + "original": "Note that a `next()` function could receive, for instance, message strings, or event objects, numeric values, or structures, depending on context. As a general term, we refer to data published by an observable as a *stream*. Any type of value can be represented with an observable, and the values are published as a stream.", "translation": "注意,`next()` 函数可以接受消息字符串、事件对象、数字值或各种结构,具体类型取决于上下文。\n为了更通用一点,我们把由可观察对象发布出来的数据统称为*流*。任何类型的值都可以表示为可观察对象,而这些值会被发布为一个流。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/observables.md" }, @@ -22968,21 +23148,39 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, { - "key": "##CREATEASERVICE", - "original": "## Create a service", - "translation": "## 创建服务", + "key": "APROVIDERISANINSTRUCTIONTOTHEDISYSTEMONHOWTOOBTAINAVALUEFORADEPENDENCYMOSTOFTHETIMETHESEDEPENDENCIESARESERVICESTHATYOUCREATEANDPROVIDE", + "original": "A provider is an instruction to the DI system on how to obtain a value for a dependency. Most of the time, these dependencies are services that you create and provide.", + "translation": "提供商就相当于说明书,用来指导 DI 系统该如何获取某个依赖的值。\n大多数情况下,这些依赖就是你要创建和提供的那些服务。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, { - "key": "YOUCANPROVIDESERVICESTOYOURAPPBYUSINGTHEPROVIDERSARRAYINANNGMODULECONSIDERTHEDEFAULTAPPGENERATEDBYTHECLIINORDERTOADDAUSERSERVICETOITYOUCANGENERATEONEBYENTERINGTHEFOLLOWINGCOMMANDINTHETERMINALWINDOW:", - "original": "You can provide services to your app by using the `providers` array in an NgModule.\nConsider the default app generated by the CLI. In order to add a user service to it,\nyou can generate one by entering the following command in the terminal window:", - "translation": "你可以使用 NgModule 中的 `providers` 数组来为你的应用提供服务。\n对于用 CLI 生成的默认应用,要想为它添加一个 `user` 服务,你可以在终端窗口中输入如下命令来生成一个:", + "key": "##PROVIDINGASERVICE", + "original": "## Providing a service", + "translation": "## 提供服务", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, { - "key": "THISCREATESASERVICECALLEDUSERSERVICEYOUNOWNEEDTOMAKETHESERVICEAVAILABLEINYOURAPPSINJECTORUPDATEAPPMODULETSBYIMPORTINGITWITHYOUROTHERIMPORTSTATEMENTSATTHETOPOFTHEFILEANDADDINGITTOTHEPROVIDERSARRAY:", - "original": "This creates a service called `UserService`. You now need to make the service available in your\napp's injector. Update `app.module.ts` by importing it with your other import statements at the top\nof the file and adding it to the `providers` array:", - "translation": "这将会创建一个名叫 `UserService` 的服务。你现在要让该服务在你的应用注入器中可用,就要修改 `app.module.ts` 文件。先在文件的顶部导入它,然后把它加入 `providers` 数组中:", + "key": "IFYOUALREADYHAVEACLIGENERATEDAPPCREATEASERVICEUSINGTHEFOLLOWINGCLICOMMANDINTHEROOTPROJECTDIRECTORYREPLACEUSERWITHTHENAMEOFYOURSERVICE", + "original": "If you already have a CLI generated app, create a service using the following CLI command in the root project directory. Replace _User_ with the name of your service.", + "translation": "如果你是用 CLI 创建的应用,那么可以使用下列 CLI 命令在项目根目录下创建一个服务。把其中的 `User` 替换成你的服务名。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "THISCOMMANDCREATESTHEFOLLOWINGUSERSERVICESKELETON:", + "original": "This command creates the following `UserService` skeleton:", + "translation": "该命令会创建下列 `UserService` 骨架:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "YOUCANNOWINJECTUSERSERVICEANYWHEREINYOURAPPLICATION", + "original": "You can now inject `UserService` anywhere in your application.", + "translation": "现在,你就可以在应用中到处注入 `UserService` 了。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "THESERVICEITSELFISACLASSTHATTHECLIGENERATEDANDTHATSDECORATEDWITHINJECTABLEBYDEFAULTTHISDECORATORISCONFIGUREDWITHAPROVIDEDINPROPERTYWHICHCREATESAPROVIDERFORTHESERVICEINTHISCASEPROVIDEDIN:ROOTSPECIFIESTHATTHESERVICESHOULDBEPROVIDEDINTHEROOTINJECTOR", + "original": "The service itself is a class that the CLI generated and that's decorated with `@Injectable`. By default, this decorator is configured with a `providedIn` property, which creates a provider for the service. In this case, `providedIn: 'root'` specifies that the service should be provided in the root injector.", + "translation": "该服务本身是 CLI 创建的一个类,并且加上了 `@Injectable` 装饰器。默认情况下,该装饰器是用 `providedIn` 属性进行配置的,它会为该服务创建一个提供商。在这个例子中,`providedIn: 'root'` 指定该服务应该在根注入器中提供。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, { @@ -22992,9 +23190,33 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, { - "key": "WHENYOUADDASERVICEPROVIDERTOTHEPROVIDERSARRAYOFTHEROOTMODULEITSAVAILABLETHROUGHOUTTHEAPPADDITIONALLYWHENYOUIMPORTAMODULETHATHASPROVIDERSTHOSEPROVIDERSAREALSOAVAILABLETOALLTHECLASSESINTHEAPPASLONGTHEYHAVETHELOOKUPTOKENFOREXAMPLEIFYOUIMPORTTHEHTTPCLIENTMODULEINTOYOURAPPMODULEITSPROVIDERSARETHENAVAILABLETOTHEENTIREAPPANDYOUCANMAKEHTTPREQUESTSFROMANYWHEREINYOURAPP", - "original": "When you add a service provider to the `providers` array of the root module, it’s available throughout the app. Additionally, when you import a module that has providers, those providers are also available to all the classes in the app as long they have the lookup token. For example, if you import the `HttpClientModule` into your `AppModule`, its providers are then available to the entire app and you can make HTTP requests from anywhere in your app.", - "translation": "当你把服务提供商添加到根模块的 `providers` 数组中时,它就在整个应用程序中可用了。\n另外,当你导入一个带有服务提供商的模块时,其中的服务提供商也同样对整个应用中的类是可用的 —— 只要它们有供查找用的服务令牌。\n比如,如果你把 `HttpClientModule` 导入了 `AppModule`,它里面的提供商就是对整个应用可用的,你可以在应用的任何地方发起 HTTP 请求。", + "key": "WHENYOUADDASERVICEPROVIDERTOTHEROOTAPPLICATIONINJECTORITSAVAILABLETHROUGHOUTTHEAPPADDITIONALLYTHESEPROVIDERSAREALSOAVAILABLETOALLTHECLASSESINTHEAPPASLONGTHEYHAVETHELOOKUPTOKEN", + "original": "When you add a service provider to the root application injector, it’s available throughout the app. Additionally, these providers are also available to all the classes in the app as long they have the lookup token.", + "translation": "当你把服务提供商添加到应用的根注入器中时,它就在整个应用程序中可用了。\n另外,这些服务提供商也同样对整个应用中的类是可用的 —— 只要它们有供查找用的服务令牌。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "YOUSHOULDALWAYSPROVIDEYOURSERVICEINTHEROOTINJECTORUNLESSTHEREISACASEWHEREYOUWANTTHESERVICETOBEAVAILABLEONLYIFTHECONSUMERIMPORTSAPARTICULARNGMODULE", + "original": "You should always provide your service in the root injector unless there is a case where you want the service to be available only if the consumer imports a particular `@NgModule)`.", + "translation": "你应该始终在根注入器中提供这些服务 —— 除非你希望该服务只有在消费方要导入特定的 `@NgModule` 时才生效。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "##PROVIDEDINANDNGMODULES", + "original": "## providedIn and NgModules", + "translation": "## `providedIn` 与 NgModule", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "ITSALSOPOSSIBLETOSPECIFYTHATASERVICESHOULDBEPROVIDEDINAPARTICULARNGMODULEFOREXAMPLEIFYOUDONTWANTUSERSERVICETOBEAVAILABLETOAPPLICATIONSUNLESSTHEYIMPORTAUSERMODULEYOUVECREATEDYOUCANSPECIFYTHATTHESERVICESHOULDBEPROVIDEDINTHEMODULE:", + "original": "It's also possible to specify that a service should be provided in a particular `@NgModule`. For example, if you don't want `UserService` to be available to applications unless they import a `UserModule` you've created, you can specify that the service should be provided in the module:", + "translation": "也可以规定某个服务只有在特定的 `@NgModule` 中提供。比如,如果你你希望只有当消费方导入了你创建的 `UserModule` 时才让 `UserService` 在应用中生效,那就可以指定该服务要在该模块中提供:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, + { + "key": "THEEXAMPLEABOVESHOWSTHEPREFERREDWAYTOPROVIDEASERVICEINAMODULETHISMETHODISPREFERREDBECAUSEITENABLESTREESHAKINGOFTHESERVICEIFNOTHINGINJECTSITIFITSNOTPOSSIBLETOSPECIFYINTHESERVICEWHICHMODULESHOULDPROVIDEITYOUCANALSODECLAREAPROVIDERFORTHESERVICEWITHINTHEMODULE:", + "original": "The example above shows the preferred way to provide a service in a module. This method is preferred because it enables tree-shaking of the service if nothing injects it. If it's not possible to specify in the service which module should provide it, you can also declare a provider for the service within the module:", + "translation": "上面的例子展示的就是在模块中提供服务的首选方式。之所以推荐该方式,是因为当没有人注入它时,该服务就可以被摇树优化掉。如果没办法指定哪个模块该提供这个服务,你也可以在那个模块中为该服务声明一个提供商:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, { @@ -23093,6 +23315,12 @@ "translation": "[惰性加载模块](guide/lazy-loading-ngmodules)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" }, + { + "key": "TREESHAKABLEPROVIDERSGUIDEDEPENDENCYINJECTION#TREESHAKABLEPROVIDERS", + "original": "* [Tree-shakable Providers](guide/dependency-injection#tree-shakable-providers).", + "translation": "[可摇树优化的服务提供商](guide/dependency-injection#tree-shakable-providers)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/providers.md" + }, { "key": "NGMODULEFAQGUIDENGMODULEFAQ", "original": "* [NgModule FAQ](guide/ngmodule-faq).", @@ -23154,15 +23382,15 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, { - "key": "VERIFYTHATYOUARERUNNINGATLEASTNODE69XANDNPM3XXBYRUNNINGNODEVANDNPMVINATERMINALCONSOLEWINDOWOLDERVERSIONSPRODUCEERRORSBUTNEWERVERSIONSAREFINE", - "original": "**Verify that you are running at least node `6.9.x` and npm `3.x.x`**\nby running `node -v` and `npm -v` in a terminal/console window.\nOlder versions produce errors, but newer versions are fine.", - "translation": "请先在终端/控制台窗口中运行命令 `node -v` 和 `npm -v`,\n**来验证一下你正在运行 node `6.9.x` 和 npm `3.x.x` 以上的版本。**\n更老的版本可能会出现错误,更新的版本则没问题。", + "key": "VERIFYTHATYOUARERUNNINGATLEASTNODEJSVERSION8XORGREATERANDNPMVERSION5XORGREATERBYRUNNINGNODEVANDNPMVINATERMINALCONSOLEWINDOWOLDERVERSIONSPRODUCEERRORSBUTNEWERVERSIONSAREFINE", + "original": "**Verify that you are running at least Node.js version `8.x` or greater and npm version `5.x` or greater**\nby running `node -v` and `npm -v` in a terminal/console window.\nOlder versions produce errors, but newer versions are fine.", + "translation": "请先在终端/控制台窗口中运行命令 `node -v` 和 `npm -v`,\n**来验证一下你正在运行 node `8.x` 和 npm `5.x` 以上的版本。**\n更老的版本可能会出现错误,更新的版本则没问题。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, { "key": "THENINSTALLTHEANGULARCLIHTTPS:GITHUBCOMANGULARANGULARCLIGLOBALLY", - "original": "Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globally.", - "translation": "然后全局安装 **[Angular CLI](https://github.com/angular/angular-cli)** 。", + "original": "Then install the [Angular CLI](https://github.com/angular/angular-cli) globally.", + "translation": "然后全局安装 [Angular CLI](https://github.com/angular/angular-cli)。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, { @@ -23178,15 +23406,27 @@ "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, { - "key": "GENERATEANEWPROJECTANDSKELETONAPPLICATIONBYRUNNINGTHEFOLLOWINGCOMMANDS:", - "original": "Generate a new project and skeleton application by running the following commands:", - "translation": "运行下列命令来生成一个新项目以及应用的骨架代码:", + "key": "GENERATEANEWPROJECTANDDEFAULTAPPBYRUNNINGTHEFOLLOWINGCOMMAND:", + "original": "Generate a new project and default app by running the following command:", + "translation": "运行下列命令来生成一个新项目以及默认的应用代码:", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, { - "key": "PATIENCEPLEASEITTAKESTIMETOSETUPANEWPROJECTMOSTOFITISSPENTINSTALLINGNPMPACKAGES", - "original": "Patience, please.\nIt takes time to set up a new project; most of it is spent installing npm packages.", - "translation": "请耐心等待。\n创建新项目需要花费很多时间,大多数时候都是在安装那些 npm 包。", + "key": "THEANGULARCLIINSTALLSTHENECESSARYNPMPACKAGESCREATESTHEPROJECTFILESANDPOPULATESTHEPROJECTWITHASIMPLEDEFAULTAPPTHISCANTAKESOMETIME", + "original": "The Angular CLI installs the necessary npm packages, creates the project files, and populates the project with a simple default app. This can take some time.", + "translation": "Angular CLI 会安装必要的 NPM 包、创建项目文件,并在该项目中生成一个简单的默认应用。这可能要花一点时间。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" + }, + { + "key": "YOUCANADDPREPACKAGEDFUNCTIONALITYTOANEWPROJECTBYUSINGTHENGADDCOMMANDTHENGADDCOMMANDTRANSFORMSAPROJECTBYAPPLYINGTHESCHEMATICSINTHESPECIFIEDPACKAGEFORMOREINFORMATIONSEETHEANGULARCLIDOCUMENTATIONHTTPS:GITHUBCOMANGULARANGULARCLIWIKIADDANGULARCLIDOCUMENTATION", + "original": "You can add pre-packaged functionality to a new project by using the `ng add` command. The `ng add` command transforms a project by applying the schematics in the specified package. \nFor more information, see the [Angular CLI documentation.](https://github.com/angular/angular-cli/wiki/add \"Angular CLI documentation\")", + "translation": "你可以使用 `ng add` 命令往新项目中添加一些预先打包好的功能。\n`ng add` 命令会通过应用来自特定 NPM 包中的图纸(schematic)来转换此项目。\n要了解更多,参见 [Angular CLI 文档](https://github.com/angular/angular-cli/wiki/add \"Angular CLI documentation\")。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" + }, + { + "key": "ANGULARMATERIALPROVIDESSCHEMATICSFORTYPICALAPPLAYOUTSSEETHEANGULARMATERIALDOCUMENTATIONHTTPS:MATERIALANGULARIOGUIDESANGULARMATERIALDOCUMENTATIONFORDETAILS", + "original": "Angular Material provides schematics for typical app layouts. \nSee the [Angular Material documentation](https://material.angular.io/guides \"Angular Material documentation\") for details.", + "translation": "比如 Angular Material 就为一些典型布局提供了图纸。参见 [Angular Material 文档](https://material.angular.io/guides \"Angular Material documentation\")。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, { @@ -23351,6 +23591,12 @@ "translation": "这个文件夹中包括为各个目标环境准备的文件,它们导出了一些应用中要用到的配置变量。\n 这些文件会在构建应用时被替换。\n 比如你可能在生产环境中使用不同的 API 端点地址,或使用不同的统计 Token 参数。\n 甚至使用一些模拟服务。\n 所有这些,CLI 都替你考虑到了。", "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" }, + { + "key": "ACONFIGURATIONFILETOSHARETARGETBROWSERSHTTPS:GITHUBCOMBROWSERSLISTBROWSERSLISTBETWEENDIFFERENTFRONTENDTOOLS", + "original": "A configuration file to share [target browsers](https://github.com/browserslist/browserslist) between different front-end tools.", + "translation": "一个配置文件,用来在不同的前端工具之间共享[目标浏览器](https://github.com/browserslist/browserslist)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/guide/quickstart.md" + }, { "key": "EVERYSITEWANTSTOLOOKGOODONTHEBOOKMARKBARGETSTARTEDWITHYOURVERYOWNANGULARICON", "original": "Every site wants to look good on the bookmark bar.\n Get started with your very own Angular icon.", @@ -23363,6 +23609,12 @@ "translation": "这是别人访问你的网站是看到的主页面的 HTML 文件。\n 大多数情况下你都不用编辑它。\n 在构建应用时,CLI 会自动把所有 `js` 和 `css` 文件添加进去,所以你不必在这里手动添加任何 `