diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md index ce3d7ed772..75639f8fdc 100644 --- a/aio/content/guide/architecture.md +++ b/aio/content/guide/architecture.md @@ -24,7 +24,7 @@ Angular takes over, presenting your application content in a browser and responding to user interactions according to the instructions you've provided. 然后,你通过*引导**根模块*来启动该应用。 -Angular 在浏览器中接管、展现应用的内容,并根据我们提供的操作指令响应用户的交互。 +Angular 在浏览器中接管、展现应用的内容,并根据你提供的操作指令响应用户的交互。 Of course, there is more to it than this. You'll learn the details in the pages that follow. For now, focus on the big picture. @@ -176,7 +176,7 @@ JavaScript 中,每个*文件*是一个模块,文件中定义的所有对象 These are two different and _complementary_ module systems. Use them both to write your apps. -这两个模块化系统是不同但*互补*的,我们在写程序时都会用到。 +这两个模块化系统是不同但*互补*的,你在写程序时都会用到。 ### Angular libraries @@ -688,7 +688,7 @@ Angular 不会*强行保障*这些原则。 Angular does help you *follow* these principles by making it easy to factor your application logic into services and make those services available to components through *dependency injection*. -Angular 帮助你*遵循*这些原则 —— 它让我们能轻易地把应用逻辑拆分到服务,并通过*依赖注入*来在组件中使用这些服务。 +Angular 帮助你*遵循*这些原则 —— 它让你能轻易地把应用逻辑拆分到服务,并通过*依赖注入*来在组件中使用这些服务。
diff --git a/aio/content/guide/component-styles.md b/aio/content/guide/component-styles.md index b08a7089e3..113e6fb696 100644 --- a/aio/content/guide/component-styles.md +++ b/aio/content/guide/component-styles.md @@ -30,7 +30,7 @@ For every Angular component you write, you may define not only an HTML template, but also the CSS styles that go with that template, specifying any selectors, rules, and media queries that you need. -对你编写的每个 Angular 组件来说,除了定义 HTML 模板之外,我们还要定义用于模板的 CSS 样式、 +对你编写的每个 Angular 组件来说,除了定义 HTML 模板之外,还要定义用于模板的 CSS 样式、 指定任意的选择器、规则和媒体查询。 One way to do this is to set the `styles` property in the component metadata. diff --git a/aio/content/guide/dependency-injection-pattern.md b/aio/content/guide/dependency-injection-pattern.md index 45cb6bec5a..ddbbdf36c3 100644 --- a/aio/content/guide/dependency-injection-pattern.md +++ b/aio/content/guide/dependency-injection-pattern.md @@ -90,7 +90,7 @@ What does `Engine` depend upon? What does that dependency depend on? Will a new instance of `Engine` make an asynchronous call to the server? You certainly don't want that going on during tests. -当给 `Car` 类写测试的时候,我们就会受制于它背后的那些依赖。 +当给 `Car` 类写测试的时候,你就会受制于它背后的那些依赖。 能在测试环境中成功创建新的 `Engine` 吗? `Engine` 自己又依赖什么?那些依赖本身又依赖什么? `Engine` 的新实例会发起到服务器的异步调用吗? diff --git a/aio/content/guide/deployment.md b/aio/content/guide/deployment.md index 5c7f36a3d4..501867a9c3 100644 --- a/aio/content/guide/deployment.md +++ b/aio/content/guide/deployment.md @@ -334,7 +334,7 @@ See also the [*APP_BASE_HREF*](api/common/APP_BASE_HREF "API: APP_BASE_HREF") al In development, you typically start the server in the folder that holds `index.html`. That's the root folder and you'd add `` near the top of `index.html` because `/` is the root of the app. -在开发期间,你通常会在 `index.html` 所在的目录中启动服务器。这个目录就是根目录,因为 `/` 就是本应用的根,所以我们要在 `index.html` 的顶部添加 ``。 +在开发期间,你通常会在 `index.html` 所在的目录中启动服务器。这个目录就是根目录,因为 `/` 就是本应用的根,所以你要在 `index.html` 的顶部添加 ``。 But on the shared or production server, you might serve the app from a subfolder. For example, when the URL to load the app is something like `http://www.mysite.com/my/app/`, diff --git a/aio/content/guide/displaying-data.md b/aio/content/guide/displaying-data.md index 33fd006ec3..837e0220f0 100644 --- a/aio/content/guide/displaying-data.md +++ b/aio/content/guide/displaying-data.md @@ -109,7 +109,7 @@ the view, such as a keystroke, a timer completion, or a response to an HTTP requ Notice that you don't call **new** to create an instance of the `AppComponent` class. Angular is creating an instance for you. How? -注意,你没有调用 **new** 来创建 `AppComponent` 类的实例,是 Angular 替我们创建了它。那么它是如何创建的呢? +注意,你没有调用 **new** 来创建 `AppComponent` 类的实例,是 Angular 替你创建了它。那么它是如何创建的呢? The CSS `selector` in the `@Component` decorator specifies an element named ``. That element is a placeholder in the body of your `index.html` file: @@ -382,7 +382,7 @@ Sometimes an app needs to display a view or a portion of a view only under speci Let's change the example to display a message if there are more than three heroes. -让我们来修改这个例子,如果多于三位英雄,显示一条消息。 +来改一下这个例子,如果多于三位英雄,显示一条消息。 The Angular `ngIf` directive inserts or removes an element based on a _truthy/falsy_ condition. To see it in action, add the following paragraph at the bottom of the template: diff --git a/aio/content/guide/dynamic-component-loader.md b/aio/content/guide/dynamic-component-loader.md index 13370034af..093416e963 100644 --- a/aio/content/guide/dynamic-component-loader.md +++ b/aio/content/guide/dynamic-component-loader.md @@ -175,7 +175,7 @@ exists on this specific instance of the component. How do you know it's this specific instance? Because it's referring to `adHost` and `adHost` is the directive you set up earlier to tell Angular where to insert dynamic components. -接下来,你要把 `viewContainerRef` 指向这个组件的现有实例。但我们怎么才能找到这个实例呢? +接下来,你要把 `viewContainerRef` 指向这个组件的现有实例。但你怎么才能找到这个实例呢? 很简单,因为它指向了 `adHost`,而这个 `adHost` 就是你以前设置过的指令,用来告诉 Angular 该把动态组件插入到什么位置。 As you may recall, `AdDirective` injects `ViewContainerRef` into its constructor. diff --git a/aio/content/guide/form-validation.md b/aio/content/guide/form-validation.md index 446c06794c..3a376aa849 100644 --- a/aio/content/guide/form-validation.md +++ b/aio/content/guide/form-validation.md @@ -251,7 +251,7 @@ to the `FormControl`. In template-driven forms, you don't have direct access to the `FormControl` instance, so you can't pass the validator in like you can for reactive forms. Instead, you need to add a directive to the template. -在模板驱动表单中,你不用直接访问 `FormControl` 实例。所以我们不能像响应式表单中那样把验证器传进去,而应该在模板中添加一个指令。 +在模板驱动表单中,你不用直接访问 `FormControl` 实例。所以不能像响应式表单中那样把验证器传进去,而应该在模板中添加一个指令。 The corresponding `ForbiddenValidatorDirective` serves as a wrapper around the `forbiddenNameValidator`. diff --git a/aio/content/guide/forms.md b/aio/content/guide/forms.md index 5489599043..cac106ee8c 100644 --- a/aio/content/guide/forms.md +++ b/aio/content/guide/forms.md @@ -846,7 +846,7 @@ The `ng-valid`/`ng-invalid` pair is the most interesting, because you want to se strong visual signal when the values are invalid. You also want to mark required fields. To create such visual feedback, add definitions for the `ng-*` CSS classes. -(`ng-valid` | `ng-invalid`)这一对是你最感兴趣的。当数据变得无效时,我们希望发出强力的视觉信号, +(`ng-valid` | `ng-invalid`)这一对是最有趣的部分,因为当数据变得无效时,你希望发出强力的视觉信号, 还想要标记出必填字段。可以通过加入自定义 CSS 来提供视觉反馈。 *Delete* the `#spy` template reference variable and the `TODO` as they have served their purpose. @@ -891,7 +891,7 @@ You can improve the form. The _Name_ input box is required and clearing it turns That says something is wrong but the user doesn't know *what* is wrong or what to do about it. Leverage the control's state to reveal a helpful message. -你还能做的更好。“Name” 输入框是必填的,清空它会让左侧的条变红。这表示*某些东西*是错的,但我们不知道错在哪里,或者如何纠正。 +你还能做的更好。“Name” 输入框是必填的,清空它会让左侧的条变红。这表示*某些东西*是错的,但用户不知道错在哪里,或者如何纠正。 可以借助 `ng-invalid` 类来给出有用的提示。 When the user deletes the name, the form should look like this: diff --git a/aio/content/guide/http.md b/aio/content/guide/http.md index 77220c29d6..fd950e4a57 100644 --- a/aio/content/guide/http.md +++ b/aio/content/guide/http.md @@ -1459,7 +1459,7 @@ by returning an observable of simulated events. [Cross-Site Request Forgery (XSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by which the attacker can trick an authenticated user into unknowingly executing actions on your website. `HttpClient` supports a [common mechanism](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Cookie-to-Header_Token) used to prevent XSRF attacks. When performing HTTP requests, an interceptor reads a token from a cookie, by default `XSRF-TOKEN`, and sets it as an HTTP header, `X-XSRF-TOKEN`. Since only code that runs on your domain could read the cookie, the backend can be certain that the HTTP request came from your client application and not an attacker. -[跨站请求伪造 (XSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery)是一个攻击技术,它能让攻击者假冒一个已认证的用户在你的网站上执行未知的操作。`HttpClient` 支持一种[通用的机制](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Cookie-to-Header_Token)来防范 XSRF 攻击。当执行 HTTP 请求时,一个拦截器会从 cookie 中读取 XSRF 令牌(默认名字为 `XSRF-TOKEN`),并且把它设置为一个 HTTP 头 `X-XSRF-TOKEN`,由于只有运行在你自己的域名下的代码才能读取这个 cookie,因此后端可以确认这个 HTTP 请求真的来自我们的客户端应用,而不是攻击者。 +[跨站请求伪造 (XSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery)是一个攻击技术,它能让攻击者假冒一个已认证的用户在你的网站上执行未知的操作。`HttpClient` 支持一种[通用的机制](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Cookie-to-Header_Token)来防范 XSRF 攻击。当执行 HTTP 请求时,一个拦截器会从 cookie 中读取 XSRF 令牌(默认名字为 `XSRF-TOKEN`),并且把它设置为一个 HTTP 头 `X-XSRF-TOKEN`,由于只有运行在你自己的域名下的代码才能读取这个 cookie,因此后端可以确认这个 HTTP 请求真的来自你的客户端应用,而不是攻击者。 By default, an interceptor sends this cookie on all mutating requests (POST, etc.) to relative URLs but not on GET/HEAD requests or @@ -1646,7 +1646,7 @@ It takes the same arguments but returns an array of matching requests. Once returned, these requests are removed from future matching and you are responsible for flushing and verifying them. -如果你需要在测试中对重复的请求进行响应,可以使用 `match()` API 来代替 `expectOne()`,它的参数不变,但会返回一个与这些请求相匹配的数组。一旦返回,这些请求就会从将来要匹配的列表中移除,我们要自己验证和刷新(flush)它。 +如果你需要在测试中对重复的请求进行响应,可以使用 `match()` API 来代替 `expectOne()`,它的参数不变,但会返回一个与这些请求相匹配的数组。一旦返回,这些请求就会从将来要匹配的列表中移除,你要自己验证和刷新(flush)它。 diff --git a/aio/content/guide/pipes.md b/aio/content/guide/pipes.md index b70bb85aa4..7385c1fbd5 100644 --- a/aio/content/guide/pipes.md +++ b/aio/content/guide/pipes.md @@ -677,7 +677,7 @@ In the previous code sample, the second `fetch` pipe binding demonstrates more p It displays the same hero data in JSON format by chaining through to the built-in `JsonPipe`. 第二个绑定除了用到 `FetchPipe` 之外还链接了更多管道。 -它把获取数据的结果同时显示在第一个绑定和第二个绑定中。第二个绑定中,我们通过链接到一个内置管道 `JsonPipe` 把它转成了 JSON 格式。 +它通过串联上内置管道 `JsonPipe` 来把英雄数据显示成了 JSON 格式。
diff --git a/aio/content/guide/reactive-forms.md b/aio/content/guide/reactive-forms.md index dfee75583b..c66f60a07f 100644 --- a/aio/content/guide/reactive-forms.md +++ b/aio/content/guide/reactive-forms.md @@ -1355,7 +1355,7 @@ Then return here to learn about _form array_ properties. So far, you've seen `FormControls` and `FormGroups`. A `FormGroup` is a named object whose property values are `FormControls` and other `FormGroups`. -以前,我们见过了 `FormControl` 和 `FormGroup`。 +以前,你已见过 `FormControl` 和 `FormGroup`。 `FormGroup` 是一个命名对象,它的属性值是 `FormControl` 和其它的 `FormGroup`。 Sometimes you need to present an arbitrary number of controls or groups. diff --git a/aio/content/guide/router.md b/aio/content/guide/router.md index 5328f11baa..96f28650a3 100644 --- a/aio/content/guide/router.md +++ b/aio/content/guide/router.md @@ -1165,7 +1165,7 @@ for navigation. Thanks to `pushState`, you can make in-app URL paths look the wa look, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs. 路由器使用浏览器的history.pushState进行导航。 -感谢 `pushState`!有了它,你就能按所期望的样子来显示应用内部的 URL 路径,比如:`localhost:3000/crisis-center`。虽然我们使用的全部是客户端合成的视图,但应用内部的这些 URL 看起来和来自服务器的没有什么不同。 +感谢 `pushState`!有了它,你就能按所期望的样子来显示应用内部的 URL 路径,比如:`localhost:3000/crisis-center`。虽然你使用的全部是客户端合成的视图,但应用内部的这些 URL 看起来和来自服务器的没有什么不同。 Modern HTML5 browsers were the first to support `pushState` which is why many people refer to these URLs as "HTML5 style" URLs. @@ -1981,7 +1981,7 @@ While you could continue to add files to the `src/app/` folder, that is unrealistic and ultimately not maintainable. Most developers prefer to put each feature area in its own folder. -虽然我们也可以把文件都放在 `src/app/` 目录下,但那样是不现实的,而且很难维护。 +虽然你也可以把文件都放在 `src/app/` 目录下,但那样是不现实的,而且很难维护。 大部分开发人员更喜欢把每个特性区都放在它自己的目录下。 You are about to break up the app into different *feature modules*, each with its own concerns. @@ -2166,7 +2166,7 @@ In the `AppRoutingModule`, you used the static **`RouterModule.forRoot`** method In a feature module you use the static **`forChild`** method. 这里有少量但是关键的不同点。 -在 `AppRoutingModule` 中,你使用了静态的 `RouterModule.`**`forRoot`**方法来注册我们的路由和全应用级服务提供商。 +在 `AppRoutingModule` 中,你使用了静态的 `RouterModule.`**`forRoot`**方法来注册路由和全应用级服务提供商。 在特性模块中,你要改用**`forChild`**静态方法。
@@ -4108,7 +4108,7 @@ You could permit access only to authenticated users or to users with a specific You might block or limit access until the user's account is activated. 应用程序通常会根据访问者来决定是否授予某个特性区的访问权。 -我们可以只对已认证过的用户或具有特定角色的用户授予访问权,还可以阻止或限制用户访问权,直到用户账户激活为止。 +你可以只对已认证过的用户或具有特定角色的用户授予访问权,还可以阻止或限制用户访问权,直到用户账户激活为止。 The `CanActivate` guard is the tool to manage these navigation business rules. @@ -4247,7 +4247,7 @@ property but it's not using a `component`. You haven't made a mistake in the configuration. You've defined a _component-less_ route. -来看 `AdminComponent` 下的子路由,我们有一个带 **path** 和 **children** 的子路由, +来看 `AdminComponent` 下的子路由,这里有一个带 **path** 和 **children** 的子路由, 但它没有使用 **component**。这并不是配置中的失误,而是在使用**无组件**路由。 The goal is to group the `Crisis Center` management routes under the `admin` path. @@ -4511,7 +4511,7 @@ If the user cancels, you'll stay put and allow more changes. If the user approves, the app can save. 最好能暂停,并让用户决定该怎么做。 -如果用户选择了取消,我们就留下来,并允许更多改动。 +如果用户选择了取消,你就留下来,并允许更多改动。 如果用户选择了确认,那就进行保存。 You still might delay navigation until the save succeeds. @@ -5501,7 +5501,7 @@ So instead, you'll update the empty path route in `app-routing.module.ts` to red Since `RouterLink`s aren't tied to route configuration, you'll need to update the associated router links so they remain active when the new route is active. You'll update the `app.component.ts` template for the `/heroes` routerLink. -由于 `RouterLink` 指令没有关联到路由配置,所以你需要修改相关的路由链接,以便在新的路由激活时,它们也能保持激活状态。我们要修改 `app.component.ts` 模板中的 `/heroes` 路由链接。 +由于 `RouterLink` 指令没有关联到路由配置,所以你需要修改相关的路由链接,以便在新的路由激活时,它们也能保持激活状态。你要修改 `app.component.ts` 模板中的 `/heroes` 路由链接。 diff --git a/aio/content/guide/structural-directives.md b/aio/content/guide/structural-directives.md index 09d9cac587..ff8883668b 100644 --- a/aio/content/guide/structural-directives.md +++ b/aio/content/guide/structural-directives.md @@ -227,7 +227,7 @@ Before applying a structural directive, you might want to pause for a moment to consider the consequences of adding and removing elements and of creating and destroying components. **同样的考量也适用于每一个结构型指令,无论是内置的还是自定义的。** - 你应该提醒自己以及我们指令的使用者,来仔细考虑添加元素、移除元素以及创建和销毁组件的后果。 + 你应该提醒自己慎重考虑添加元素、移除元素以及创建和销毁组件的后果。 {@a asterisk} diff --git a/aio/content/guide/upgrade.md b/aio/content/guide/upgrade.md index e9e6f0384c..ad4cb74323 100644 --- a/aio/content/guide/upgrade.md +++ b/aio/content/guide/upgrade.md @@ -1379,7 +1379,7 @@ bring that application to the brave new world of Angular. 在本节和下节中,你将看一个完整的例子,它使用 `upgrade` 模块准备和升级了一个应用程序。 该应用就是来自[原 AngularJS 教程](https://docs.angularjs.org/tutorial)中的[Angular PhoneCat](https://github.com/angular/angular-phonecat)。 -那是我们当初开始 Angular 探险之旅的起点。 +那是我们很多人当初开始 Angular 探险之旅的地方。 现在,你会看到如何把该应用带入 Angular 的美丽新世界。 During the process you'll learn how to apply the steps outlined in the diff --git a/aio/content/guide/webpack.md b/aio/content/guide/webpack.md index bf6e3e7b6c..1cdbed67aa 100644 --- a/aio/content/guide/webpack.md +++ b/aio/content/guide/webpack.md @@ -852,7 +852,7 @@ Reconfigure [Karma](https://karma-runner.github.io/1.0/index.html) to use Webpac You don't precompile the TypeScript; Webpack transpiles the Typescript files on the fly, in memory, and feeds the emitted JS directly to Karma. There are no temporary files on disk. -你不用预编译 TypeScript,Webpack 随时在内存中转译我们的 TypeScript 文件,并且把产出的 JS 直接反馈给 Karma。 +你不用预编译 TypeScript,Webpack 会随时在内存中转译这些 TypeScript 文件,并且把产出的 JS 直接反馈给 Karma。 硬盘上没有任何临时文件。 The `karma-test-shim` tells Karma what files to pre-load and