diff --git a/aio/content/guide/ajs-quick-reference.md b/aio/content/guide/ajs-quick-reference.md index 21fa16a44d..9f1b0f19ee 100644 --- a/aio/content/guide/ajs-quick-reference.md +++ b/aio/content/guide/ajs-quick-reference.md @@ -2,6 +2,8 @@ # 从 AngularJS 到 Angular 快速参考 +// TODO: bugfix + {@a top} diff --git a/aio/content/guide/animations.md b/aio/content/guide/animations.md index 39cff53297..6996a55105 100644 --- a/aio/content/guide/animations.md +++ b/aio/content/guide/animations.md @@ -215,7 +215,6 @@ transitions that apply regardless of which state the animation is in. For exampl * The `* => *` transition applies when *any* change between two states takes place. - 当在*任意*两个状态之间切换时,`* => *`转场都会生效。
diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index 3671268474..783ae09a85 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -5,6 +5,8 @@ This cookbook describes how to radically improve performance by compiling _ahead-of-time_ (AOT) during a build process. +本章描述了如何通过在构建期间使用预编译(AOT编译)技术来根本性的提高性能。 + {@a overview} ## Overview @@ -390,8 +392,8 @@ Rollup只能对`ES2015`模块摇树,因为那里有`import`和`export`语句 It's not important that the code itself be written with `ES2015` syntax such as `class` and `const`. What matters is that the code uses ES `import` and `export` statements rather than `require` statements. -回忆一下,`tsconfig-aot.json`中曾配置为生成`ES2015`的模块。 -代码本身是否用到了`ES2015`语法(例如`class`和`const`)并不重要,重要的是这些代码使用的应该是`import`和`export`语句,而不是`require`语句。 + 回忆一下,`tsconfig-aot.json`中曾配置为生成`ES2015`的模块。 + 代码本身是否用到了`ES2015`语法(例如`class`和`const`)并不重要,重要的是这些代码使用的应该是`import`和`export`语句,而不是`require`语句。 @@ -441,6 +443,8 @@ Optional plugins filter and transform the Rollup inputs and output. *RxJS* +*RxJS* 库 + Rollup expects application source code to use `ES2015` modules. Not all external dependencies are published as `ES2015` modules. In fact, most are not. Many of them are published as _CommonJS_ modules. diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md index dc73eb0993..259a8b3fd0 100644 --- a/aio/content/guide/architecture.md +++ b/aio/content/guide/architecture.md @@ -634,13 +634,9 @@ Angular 还有少量指令,它们或者修改结构布局(例如 [ngSwitch]( Of course, you can also write your own directives. Components such as `HeroListComponent` are one kind of custom directive. - - 当然,我们也能编写自己的指令。像`HeroListComponent`这样的组件就是一种自定义指令。 -
- ## Services ## 服务 diff --git a/aio/content/guide/attribute-directives.md b/aio/content/guide/attribute-directives.md index 58051753bd..a37c4973f4 100644 --- a/aio/content/guide/attribute-directives.md +++ b/aio/content/guide/attribute-directives.md @@ -8,6 +8,8 @@ An **Attribute** directive changes the appearance or behavior of a DOM element. Try the . +你可以到这里试试:。 + {@a directive-overview} ## Directives overview diff --git a/aio/content/guide/bootstrapping.md b/aio/content/guide/bootstrapping.md index 843e265695..e2a93ffc31 100644 --- a/aio/content/guide/bootstrapping.md +++ b/aio/content/guide/bootstrapping.md @@ -283,4 +283,8 @@ to visit those features. 你最初的应用只有一个单一的模块 —— *根*模块。 当这个应用不断成长时,你就要考虑把它们拆分到多个 "特性" 模块中了。 -这些特性模块中的一部分可以稍后加载(即惰性加载),它们只会在用户访问到这些特性时才会加载。When you're ready to explore these possibilities, visit the [NgModules](guide/ngmodule) guide.如果你要了解这些知识,请访问[Angular 模块 (NgModule)](guide/ngmodule)页 \ No newline at end of file +这些特性模块中的一部分可以稍后加载(即惰性加载),它们只会在用户访问到这些特性时才会加载。 + +When you're ready to explore these possibilities, visit the [NgModules](guide/ngmodule) guide. + +如果你要了解这些知识,请访问[Angular 模块 (NgModule)](guide/ngmodule)页 \ No newline at end of file diff --git a/aio/content/guide/browser-support.md b/aio/content/guide/browser-support.md index a9915b650a..c99fa8db32 100644 --- a/aio/content/guide/browser-support.md +++ b/aio/content/guide/browser-support.md @@ -226,7 +226,9 @@ Angular 在持续集成过程中,对每一个提交都会使用 closure compiler.\* 这些指标测量的是最小化 (minify) 并且 gzip 过的代码,使用 closure compiler +computed with the closure compiler. + +\* 这些指标测量的是最小化 (minify) 并且 gzip 过的代码,使用 closure compiler 计算出的结果。 \ No newline at end of file diff --git a/aio/content/guide/component-styles.md b/aio/content/guide/component-styles.md index 46f0ac40af..f4f2988d64 100644 --- a/aio/content/guide/component-styles.md +++ b/aio/content/guide/component-styles.md @@ -250,6 +250,10 @@ The shadow-piercing descendant combinator is deprecated and [support is being re As such we plan to drop support in Angular (for all 3 of `/deep/`, `>>>` and `::ng-deep`). Until then `::ng-deep` should be preferred for a broader compatibility with the tools. +CSS标准中用于 "刺穿Shadow DOM" 的组合器已经被废弃,并将[这个特性从主流浏览器和工具中移除](https://www.chromestatus.com/features/6750456638341120)。 +因此,我们也将在 Angular 中移除对它们的支持(包括`/deep/`、`>>>` 和 `::ng-deep`)。 +目前,建议先统一使用`::ng-deep`,以便兼容将来的工具。 + {@a loading-styles} diff --git a/aio/content/guide/deployment.md b/aio/content/guide/deployment.md index aa2aa9c49f..858c2a4262 100644 --- a/aio/content/guide/deployment.md +++ b/aio/content/guide/deployment.md @@ -913,5 +913,10 @@ Read about how to enable CORS for specific servers at ## Next steps - ## 下一步If you want to go beyond the [simple _copy-deploy_](guide/deployment#dev-deploy "Simplest deployment possible") approach, - read the [AOT Cookbook](guide/aot-compiler "AOT Cookbook") next.如果我们准备超越[简单*复制*部署](guide/deployment#dev-deploy "Simplest deployment possible")的方式,请参阅[烹饪宝典中的AOT部分](guide/aot-compiler "AOT Cookbook")。 \ No newline at end of file + +## 下一步 + +If you want to go beyond the [simple _copy-deploy_](guide/deployment#dev-deploy "Simplest deployment possible") approach, +read the [AOT Cookbook](guide/aot-compiler "AOT Cookbook") next. + +如果我们准备超越[简单*复制*部署](guide/deployment#dev-deploy "Simplest deployment possible")的方式,请参阅[烹饪宝典中的AOT部分](guide/aot-compiler "AOT Cookbook")。 \ No newline at end of file diff --git a/aio/content/guide/dynamic-component-loader.md b/aio/content/guide/dynamic-component-loader.md index e40ca47086..549e2fbb9d 100644 --- a/aio/content/guide/dynamic-component-loader.md +++ b/aio/content/guide/dynamic-component-loader.md @@ -117,7 +117,7 @@ because it doesn't render any additional output. ## Resolving components -### 解析组件 +## 解析组件 Take a closer look at the methods in `ad-banner.component.ts`. @@ -245,7 +245,7 @@ add dynamically loaded components to the `NgModule`'s `entryComponents` array: ## The _AdComponent_ interface -### 公共的`AdComponent`接口 +## 公共的`AdComponent`接口 In the ad banner, all components implement a common `AdComponent` interface to standardize the API for passing data to the components. @@ -280,7 +280,7 @@ Here are two sample components and the `AdComponent` interface for reference: ## Final ad banner -### 最终的广告栏 +## 最终的广告栏 The final ad banner looks like this: @@ -293,4 +293,6 @@ The final ad banner looks like this: -See the .参见。 \ No newline at end of file +See the . + +参见。 \ No newline at end of file diff --git a/aio/content/guide/dynamic-form.md b/aio/content/guide/dynamic-form.md index 3e86086b6e..f966e1afeb 100644 --- a/aio/content/guide/dynamic-form.md +++ b/aio/content/guide/dynamic-form.md @@ -250,7 +250,10 @@ Finally, display an instance of the form in the `AppComponent` shell. {@a dynamic-template} ## Dynamic Template -## 动态模板Although in this example you're modelling a job application for heroes, there are + +## 动态模板 + +Although in this example you're modelling a job application for heroes, there are no references to any specific hero question outside the objects returned by `QuestionService`. diff --git a/aio/content/guide/form-validation.md b/aio/content/guide/form-validation.md index 48642fc9b9..140fed61f5 100644 --- a/aio/content/guide/form-validation.md +++ b/aio/content/guide/form-validation.md @@ -248,8 +248,11 @@ on custom validation directives. * The `#name` template variable is gone because the app no longer refers to the Angular control for this element. -模板变量`#name`消失了,因为我们不再需要为这个元素引用Angular控制器。* Binding to the new `formErrors.name` property is sufficient to display all name validation error messages. -绑定到新的`formErrors.name`属性,就可以处理所有名字验证错误信息了。 +模板变量`#name`消失了,因为我们不再需要为这个元素引用Angular控制器。 + +* Binding to the new `formErrors.name` property is sufficient to display all name validation error messages. + + 绑定到新的`formErrors.name`属性,就可以处理所有名字验证错误信息了。 {@a component-class} @@ -871,7 +874,7 @@ and whose value is an arbitrary dictionary of values that you could insert into ### Custom validation directive -#### 自定义验证指令 +### 自定义验证指令 In the Reactive Forms component, the `'name'` control's validator function list has a `forbiddenNameValidator` at the bottom. @@ -932,10 +935,15 @@ its `forbiddenName` property bound to “bob". If you were to replace `useExisting` with `useClass`, then you’d be registering a new class instance, one that doesn’t have a `forbiddenName`. +如果你熟悉 Angular 的验证机制,可能会注意到自定义验证指令是使用`useExisting`而不是`useClass`来实例化的。这是因为注册的验证器必须是这个 `ForbiddenValidatorDirective` 实例本身,也就是表单中 `forbiddenName` 属性被绑定到了"bob"的那个。如果用`useClass`来代替`useExisting`,就会注册一个新的类实例,而它是没有`forbiddenName`的。 + To see this in action, run the example and then type “bob” in the name of Hero Form 2. Notice that you get a validation error. Now change from `useExisting` to `useClass` and try again. This time, when you type “bob”, there's no "bob" error message. +要查看它的运行效果,请打开范例,并在英雄表单2的 name 字段输入 "bob"。 +注意,我们会看到一个验证错误。现在,把 `useExisting` 改成 `useClass` 再试一下。这次,当你敲 "bob" 时,就不会再出现错误信息了。 + diff --git a/aio/content/guide/i18n.md b/aio/content/guide/i18n.md index 43f8e3c137..476a8244a6 100644 --- a/aio/content/guide/i18n.md +++ b/aio/content/guide/i18n.md @@ -606,10 +606,14 @@ This guide follows that suggestion. It has a `locale` folder under `src/`. Assets within the folder carry a filename extension that matches a language-culture code from a well-known codeset. +本指南遵循了那个建议。在`src/`目录下,有一个专门的`locale`目录,该目录中的文件都带有一个代号作为扩展名,它们来自这个众所周知的代号表。 + Make a copy of the `messages.xlf` file, put it in the `locale` folder and rename it `messages.es.xlf`for the Spanish language translation. Do the same for each target language. +复制一下`messages.xlf`文件,把它放进`locale`目录,并改名为`messages.es.xlf`以用于西班牙语的翻译。对其它目标语言也同样要这么做。 + {@a translate-text-nodes} ### Translate text nodes @@ -793,9 +797,7 @@ time to incorporate that translation into the application. 整个模板的翻译就完成了。现在就该把翻译结果放回到应用程序中了。 - - -### The app before translation +### The app before translation ### 翻译前的应用程序 diff --git a/aio/content/guide/ngmodule-faq.md b/aio/content/guide/ngmodule-faq.md index 18b0cd173d..81c4791671 100644 --- a/aio/content/guide/ngmodule-faq.md +++ b/aio/content/guide/ngmodule-faq.md @@ -806,7 +806,7 @@ The application would fail the moment a user navigated to "Heroes". {@a q-component-or-module} - +// TODO: bugfix ## Should I add other providers to a module or a component? ## 我应该把其它提供商注册到模块中还是组件中? @@ -1129,7 +1129,7 @@ although doing so is harmless. ## When do I add components to _entryComponents_? -### 什么时候我应该把组件加到`entryComponents`中? +## 什么时候我应该把组件加到`entryComponents`中? Most application developers won't need to add components to the `entryComponents`. @@ -1169,7 +1169,7 @@ in the templates of other components. ## Why does Angular need _entryComponents_? -### 为什么Angular需要*入口组件*? +## 为什么Angular需要*入口组件*? _Entry components_ are also declared. Why doesn't the Angular compiler generate code for every component in `@NgModule.declarations`? @@ -1226,7 +1226,7 @@ the compiler omits it. ## What kinds of modules should I have and how should I use them? -#### 有哪些类型的模块?我应该如何使用它们? +## 有哪些类型的模块?我应该如何使用它们? Every app is different. Developers have various levels of experience and comfort with the available choices. Some suggestions and guidelines appear to have wide appeal. @@ -2206,7 +2206,7 @@ Real-world modules are often hybrids that knowingly deviate from these guideline ## What's the difference between Angular and JavaScript Modules? -### Angular模块和JavaScript模块有什么区别? +## Angular模块和JavaScript模块有什么区别? Angular and JavaScript are different yet complementary module systems. @@ -2364,7 +2364,7 @@ Angular只查询两种组件、指令或管道:1)那些在当前模块中声 ## What is the Angular compiler? -### 什么是Angular编译器? +## 什么是Angular编译器? The Angular compiler converts the application code you write into highly performant JavaScript code. The `@NgModule` metadata play an important role in guiding the compilation process. diff --git a/aio/content/guide/ngmodule.md b/aio/content/guide/ngmodule.md index c41099700f..45218f7c5e 100644 --- a/aio/content/guide/ngmodule.md +++ b/aio/content/guide/ngmodule.md @@ -2420,18 +2420,17 @@ Angular 创建一个惰性加载模块,它具有自己的注入器,它是根 ## Conclusion -### 总结 +## 总结 You made it! You can examine and download the complete source for this final version from the live example. 完工!你可以到下面的在线例子中试验它,并下载最终版本的全部源码。 - +
- ## Frequently asked questions -### 常见问题 (FAQ) +## 常见问题 (FAQ) Now that you understand NgModules, you may be interested in the companion [NgModule FAQs](guide/ngmodule-faq "NgModule FAQs") page diff --git a/aio/content/guide/npm-packages.md b/aio/content/guide/npm-packages.md index c249a005ff..808a7182f0 100644 --- a/aio/content/guide/npm-packages.md +++ b/aio/content/guide/npm-packages.md @@ -17,8 +17,8 @@ Node.js and npm are essential to Angular development. Node.js和npm是做Angular开发的基础。 - -Get them now if they're not already installed on your machine. +

+Get them now if they're not already installed on your machine.

如果你的电脑上还没有装过,请立即获取它! diff --git a/aio/content/guide/router.md b/aio/content/guide/router.md index d241243aee..c36fbdb9e3 100644 --- a/aio/content/guide/router.md +++ b/aio/content/guide/router.md @@ -219,6 +219,9 @@ The wildcard route comes last because it matches _every URL_ and should be selec If you need to see what events are happening during the navigation lifecycle, there is the **enableTracing** option as part of the router's default configuration. This outputs each router event that took place during each navigation lifecycle to the browser console. This should only be used for _debugging_ purposes. You set the `enableTracing: true` option in the object passed as the second argument to the `RouterModule.forRoot()` method. +如果我们想要看到在导航的生命周期中发生过哪些事件,可以使用路由器默认配置中的**enableTracing**选项。它会把每个导航生命周期中的事件输出到浏览器的控制台。 +这应该只用于*调试*。我们只需要把`enableTracing: true`选项作为第二个参数传给`RouterModule.forRoot()`方法就可以了。 + {@a basics-router-outlet} @@ -5982,7 +5985,7 @@ The appendix material isn't essential. Continued reading is for the curious. ### Appendix: link parameters array -## 附录:链接参数数组 +### 附录:链接参数数组 A link parameters array holds the following ingredients for router navigation: @@ -6134,7 +6137,7 @@ any legal sequence of route paths, (required) router parameters, and (optional) ### Appendix: *LocationStrategy* and browser URL styles -## 附录:*LocationStrategy*以及浏览器URL样式 +### 附录:*LocationStrategy*以及浏览器URL样式 When the router navigates to a new component view, it updates the browser's location and history with a URL for that view. @@ -6217,7 +6220,7 @@ Learn about providers and the bootstrap process in the #### Which strategy is best? -### 哪种策略更好? +#### 哪种策略更好? You must choose a strategy and you need to make the right call early in the project. It won't be easy to change later once the application is in production @@ -6251,7 +6254,7 @@ resort to hash routes. #### HTML5 URLs and the *<base href>* -### HTML 5 URL与*<base href>*While the router uses the +#### HTML 5 URL与*<base href>*While the router uses the HTML5 pushState style by default, you *must* configure that strategy with a **base href**. diff --git a/aio/content/guide/security.md b/aio/content/guide/security.md index a53d1e5ad2..16bae4b268 100644 --- a/aio/content/guide/security.md +++ b/aio/content/guide/security.md @@ -20,17 +20,12 @@ You can run the in Plunker and download the code f

- -

- Reporting vulnerabilities -

- -

- 举报漏洞 -

- +Reporting vulnerabilities

+

+举报漏洞 +

To report vulnerabilities in Angular itself, email us at [security@angular.io](mailto:security@angular.io). @@ -45,17 +40,12 @@ philosophy](https://www.google.com/about/appsecurity/).

- -

- Best practices -

- -

- 最佳实践 -

- +Best practices

+

+最佳实践 +

* **Keep current with the latest Angular library releases.** @@ -80,21 +70,9 @@ For more information, see the [Trusting safe values](guide/security#bypass-secur **避免使用本文档中带“[_安全风险_](guide/security#bypass-security-apis)”标记的Angular API。** 要了解更多信息,请参阅本章的[信任那些安全的值](guide/security#bypass-security-apis)部分。 +## Preventing cross-site scripting (XSS) - -

- -

- Preventing cross-site scripting (XSS) -

- -

- 防范跨站脚本(XSS)攻击 -

- -

- - +## 防范跨站脚本(XSS)攻击 [Cross-site scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) enables attackers to inject malicious code into web pages. Such code can then, for example, steal user data (in diff --git a/aio/content/guide/structural-directives.md b/aio/content/guide/structural-directives.md index cb49815163..49f8cba1d7 100644 --- a/aio/content/guide/structural-directives.md +++ b/aio/content/guide/structural-directives.md @@ -490,6 +490,8 @@ All are preceded by the keyword `let`. 这个例子中有好几个模板输入变量:`hero`、`i`和`odd`。 它们都是用`let`作为前导关键字。 +// TODO: Translate + A _template input variable_ is **_not_** the same as a [template _reference_ variable](guide/template-syntax#ref-vars), neither _semantically_ nor _syntactically_. diff --git a/aio/content/guide/visual-studio-2015.md b/aio/content/guide/visual-studio-2015.md index b368813339..ec62f48ea2 100644 --- a/aio/content/guide/visual-studio-2015.md +++ b/aio/content/guide/visual-studio-2015.md @@ -58,15 +58,11 @@ Note that the resulting code does not map to the docs. Adjust accordingly.

- -

- Prerequisite: Node.js -

- -

- 前提条件: Node.js -

+Prerequisite: Node.js +

+

+前提条件: Node.js

@@ -93,15 +89,11 @@ Older versions produce errors.

+Prerequisite: Visual Studio 2015 Update 3 +

-

- Prerequisite: Visual Studio 2015 Update 3 -

- -

- 前提条件: Visual Studio 2015 Update 3 -

- +

+前提条件: Visual Studio 2015 Update 3

@@ -122,15 +114,11 @@ Or use `Tools | Extensions and Updates` to update to Update 3 directly from Visu

+Prerequisite: Configure External Web tools +

-

- Prerequisite: Configure External Web tools -

- -

- 前提条件: 配置External Web tools -

- +

+前提条件: 配置External Web tools

@@ -173,15 +161,11 @@ Visual Studio将优先在当前的工作区查找外部工具,如果没有找

+Prerequisite: Install TypeScript 2.2 for Visual Studio 2015 +

-

- Prerequisite: Install TypeScript 2.2 for Visual Studio 2015 -

- -

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

- +

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

@@ -215,15 +199,11 @@ restart it to make sure everything is clean.

+Step 1: Download the QuickStart files +

-

- Step 1: Download the QuickStart files -

- -

- 第一步: 现在“快速起步”文件 -

- +

+第一步: 现在“快速起步”文件

@@ -236,15 +216,11 @@ from GitHub. If you downloaded as a zip file, extract the files.

+Step 2: Create the Visual Studio ASP.NET project +

-

- Step 2: Create the Visual Studio ASP.NET project -

- -

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

- +

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

@@ -321,35 +297,23 @@ Include the files in the Visual Studio project as follows: src/app目录(如果询问是否要搜索TypeScript类型,回答*No*) - * src/styles.css - * src/index.html - * package.json - * src/tsconfig.json * typings.json +

Step 4: Restore the required packages

-

- -

- Step 4: Restore the required packages -

- -

- 第四步: 恢复需要的包 -

- -

+

第四步: 恢复需要的包

+// TODO: bugfix Restore the packages required for an Angular application as follows: