fix: 修复一些翻译错误
This commit is contained in:
parent
1d6c1396fd
commit
c63a778e26
|
@ -83,7 +83,7 @@ The next step is to define an object model that can describe all scenarios neede
|
|||
The hero application process involves a form with a lot of questions.
|
||||
The _question_ is the most fundamental object in the model.
|
||||
|
||||
第一步是定义一个对象模型,用来描述所有表单功能需要的场景。英雄的申请流程涉及到一个包含很多问卷问题的表单。问卷问题是最基础的对象模型。
|
||||
下一步是定义一个对象模型,用来描述所有表单功能需要的场景。英雄的申请流程涉及到一个包含很多问卷问题的表单。问卷问题是最基础的对象模型。
|
||||
|
||||
The following `QuestionBase` is a fundamental question class.
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ In template-driven forms, each form element is linked to a directive that manage
|
|||
|
||||
The steps below outline the data flow from view to model when the input value changes from *Red* to *Blue*.
|
||||
|
||||
下面这些步骤列出了 "从视图到模型" 数据流的梗概。
|
||||
下面这些步骤列出了当输入框的值从 *Red* 变成 *Blue* 时 "从视图到模型" 的数据流梗概。
|
||||
|
||||
1. The user types *Blue* into the input element.
|
||||
|
||||
|
@ -274,7 +274,7 @@ is updated to the value emitted by the `ngModelChange` event (*Blue*).
|
|||
|
||||
The steps below outline the data flow from model to view when the `favoriteColor` changes from *Blue* to *Red*.
|
||||
|
||||
下面这些步骤列出了从模型到视图的数据流的梗概。
|
||||
下面这些步骤列出了当 `favoriteColor` 从 *Blue* 变为 *Red* 时,"从模型到视图" 的数据流梗概。
|
||||
|
||||
1. The `favoriteColor` value is updated in the component.
|
||||
|
||||
|
@ -362,7 +362,7 @@ The following test verifies the data flow from view to model.
|
|||
|
||||
Here are the steps performed in the view to model test.
|
||||
|
||||
这个测试中执行的步骤如下。
|
||||
这个 "视图到模型" 测试中执行的步骤如下。
|
||||
|
||||
1. Query the view for the form input element, and create a custom "input" event for the test.
|
||||
|
||||
|
@ -385,7 +385,7 @@ The following test verifies the data flow from model to view.
|
|||
|
||||
Here are the steps performed in the model to view test.
|
||||
|
||||
这个测试中执行的步骤如下。
|
||||
这个 "从模型到视图" 测试的执行步骤如下。
|
||||
|
||||
1. Use the `favoriteColorControl`, a `FormControl` instance, to set the new value.
|
||||
|
||||
|
@ -419,7 +419,7 @@ The following test verifies the data flow from view to model.
|
|||
|
||||
Here are the steps performed in the view to model test.
|
||||
|
||||
执行的测试步骤如下:
|
||||
这个 "视图到模型" 测试的执行步骤如下:
|
||||
|
||||
1. Query the view for the form input element, and create a custom "input" event for the test.
|
||||
|
||||
|
@ -445,7 +445,7 @@ The following test verifies the data flow from model to view.
|
|||
|
||||
Here are the steps performed in the model to view test.
|
||||
|
||||
执行的测试步骤如下:
|
||||
这个 "模型到视图" 测试的执行步骤如下:
|
||||
|
||||
1. Use the component instance to set the value of the `favoriteColor` property.
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ and runs that code.
|
|||
This is the best compilation mode for production environments, with decreased load time and increased performance compared to [just-in-time (JIT) compilation](guide/glossary#jit).
|
||||
|
||||
Angular 的预先(AOT)编译器可以在编译期间把你的 HTML 代码和 TypeScript 代码转换成高效的 JavaScript 代码,这样浏览器就可以直接下载和运行它们。
|
||||
对于产品环境,这是最好的编译模式,相对于[即时 (JIT) 编译](guide/glossary#jit)而言,它能减小加载时间,并提高性能。
|
||||
|
||||
By compiling your application using the `ngc` command-line tool, you can bootstrap directly to a module factory, so you don't need to include the Angular compiler in your JavaScript bundle.
|
||||
|
||||
|
@ -1087,7 +1088,7 @@ To learn more, see [Routing and Navigation](guide/router).
|
|||
|
||||
## router outlet
|
||||
|
||||
## 路由器模块 (router module)
|
||||
## 路由出口(router outlet)
|
||||
|
||||
A [directive](guide/glossary#directive) that acts as a placeholder in a routing component's template. Angular dynamically renders the template based on the current router state.
|
||||
|
||||
|
|
|
@ -72,8 +72,6 @@ Angular 语言服务目前在[Visual Studio Code](https://code.visualstudio.com/
|
|||
|
||||
### Visual Studio Code
|
||||
|
||||
### Visual Studio Code 中
|
||||
|
||||
In Visual Studio Code, install Angular Language Service from the store,
|
||||
which is accessible from the bottom icon on the left menu pane.
|
||||
You can also use the VS Quick Open (⌘+P) to search for the extension. When you've opened it,
|
||||
|
@ -94,8 +92,6 @@ Then click the install button to install the Angular Language Service.
|
|||
|
||||
### WebStorm
|
||||
|
||||
### WebStorm 中
|
||||
|
||||
In webstorm, you have to install the language service as a dev dependency.
|
||||
When Angular sees this dev dependency, it provides the
|
||||
language service inside of WebStorm. Webstorm then gives you
|
||||
|
@ -147,8 +143,6 @@ yarn install
|
|||
|
||||
### Sublime Text
|
||||
|
||||
### Sublime Text 编辑器
|
||||
|
||||
In [Sublime Text](https://www.sublimetext.com/), you first need an extension to allow Typescript.
|
||||
Install the latest version of typescript in a local `node_modules` directory:
|
||||
|
||||
|
|
|
@ -633,8 +633,6 @@ The `ngOnInit()` and `ngOnDestroy()` methods have more vital roles to play in re
|
|||
|
||||
### _OnInit()_
|
||||
|
||||
### _OnInit()钩子_
|
||||
|
||||
Use `ngOnInit()` for two main reasons:
|
||||
|
||||
使用 `ngOnInit()` 有两个原因:
|
||||
|
@ -704,8 +702,6 @@ That's where the heavy initialization logic belongs.
|
|||
|
||||
### _OnDestroy()_
|
||||
|
||||
### _OnDestroy()钩子_
|
||||
|
||||
Put cleanup logic in `ngOnDestroy()`, the logic that *must* run before Angular destroys the directive.
|
||||
|
||||
一些清理逻辑*必须*在 Angular 销毁指令之前运行,把它们放在 `ngOnDestroy()` 中。
|
||||
|
@ -727,8 +723,6 @@ You risk memory leaks if you neglect to do so.
|
|||
|
||||
## _OnChanges()_
|
||||
|
||||
## _OnChanges()_ 钩子
|
||||
|
||||
Angular calls its `ngOnChanges()` method whenever it detects changes to ***input properties*** of the component (or directive).
|
||||
This example monitors the `OnChanges` hook.
|
||||
|
||||
|
@ -786,8 +780,6 @@ Angular 不会关注这个英雄对象的 `name` 属性的变化。
|
|||
|
||||
## _DoCheck()_
|
||||
|
||||
## _DoCheck()_ 钩子
|
||||
|
||||
Use the `DoCheck` hook to detect and act upon changes that Angular doesn't catch on its own.
|
||||
|
||||
使用 `DoCheck` 钩子来检测那些 Angular 自身无法捕获的变更并采取行动。
|
||||
|
@ -841,8 +833,6 @@ Clearly our implementation must be very lightweight or the user experience suffe
|
|||
|
||||
## AfterView
|
||||
|
||||
## AfterView 钩子
|
||||
|
||||
The *AfterView* sample explores the `AfterViewInit()` and `AfterViewChecked()` hooks that Angular calls
|
||||
*after* it creates a component's child views.
|
||||
|
||||
|
@ -915,8 +905,6 @@ Write lean hook methods to avoid performance problems.
|
|||
|
||||
## AfterContent
|
||||
|
||||
## AfterContent 钩子
|
||||
|
||||
The *AfterContent* sample explores the `AfterContentInit()` and `AfterContentChecked()` hooks that Angular calls
|
||||
*after* Angular projects external content into the component.
|
||||
|
||||
|
|
|
@ -141,9 +141,9 @@ typical characteristics, in real world apps, you may see hybrids.
|
|||
|
||||
A lazy-loaded routed feature module should not be imported by any module. Doing so would trigger an eager load, defeating the purpose of lazy loading.That means you won’t see them mentioned among the `AppModule` imports. An eager loaded routed feature module must be imported by another module so that the compiler learns about its components.
|
||||
|
||||
惰性加载的路由特性模块不应该被任何模块导入。如果那样做就会导致它被立即加载,破坏了惰性加载的设计用途。
|
||||
惰性加载的路由特性模块不应该被任何模块导入。如果那样做就会导致它被急性加载,破坏了惰性加载的设计用途。
|
||||
也就是说你应该永远不会看到它们在 `AppModule` 的 `imports` 中被引用。
|
||||
立即加载的路由特性模块必须被其它模块导入,以便编译器能了解它所包含的组件。
|
||||
急性加载的路由特性模块必须被其它模块导入,以便编译器能了解它所包含的组件。
|
||||
|
||||
Routed feature modules rarely have providers for reasons explained in [Lazy Loading Feature Modules](/guide/lazy-loading-ngmodules). When they do, the lifetime of the provided services should be the same as the lifetime of the module. Don't provide application-wide singleton services in a routed feature module or in a module that the routed module imports.
|
||||
|
||||
|
|
|
@ -699,13 +699,13 @@ not the root `AppComponent`.
|
|||
|
||||
### The eagerly loaded scenario
|
||||
|
||||
### 立即加载的场景
|
||||
### 急性加载的场景
|
||||
|
||||
When an eagerly loaded module provides a service, for example a `UserService`, that service is available application-wide. If the root module provides `UserService` and
|
||||
imports another module that provides the same `UserService`, Angular registers one of
|
||||
them in the root app injector (see [What if I import the same module twice?](guide/ngmodule-faq#q-reimport)).
|
||||
|
||||
当立即加载的模块提供了服务时,比如 `UserService`,该服务是在全应用级可用的。如果根模块提供了 `UserService`,并导入了另一个也提供了同一个 `UserService` 的模块,Angular 就会把它们中的一个注册进应用的根注入器中(参见[如果两次导入了同一个模块会怎样?](guide/ngmodule-faq#q-reimport))。
|
||||
当急性加载的模块提供了服务时,比如 `UserService`,该服务是在全应用级可用的。如果根模块提供了 `UserService`,并导入了另一个也提供了同一个 `UserService` 的模块,Angular 就会把它们中的一个注册进应用的根注入器中(参见[如果两次导入了同一个模块会怎样?](guide/ngmodule-faq#q-reimport))。
|
||||
|
||||
Then, when some component injects `UserService`, Angular finds it in the app root injector,
|
||||
and delivers the app-wide singleton service. No problem.
|
||||
|
|
|
@ -75,7 +75,7 @@ Such services might be internally developed, like something you'd develop yourse
|
|||
|
||||
Modules can be loaded eagerly when the application starts or lazy loaded asynchronously by the router.
|
||||
|
||||
模块可以在应用启动时立即加载,也可以由路由器进行异步的惰性加载。
|
||||
模块可以在应用启动时急性加载,也可以由路由器进行异步的惰性加载。
|
||||
|
||||
NgModule metadata does the following:
|
||||
|
||||
|
|
|
@ -89,11 +89,11 @@ The example above shows the preferred way to provide a service in a module. This
|
|||
|
||||
In the basic CLI-generated app, modules are eagerly loaded which means that they are all loaded when the app launches. Angular uses an injector system to make things available between modules. In an eagerly loaded app, the root application injector makes all of the providers in all of the modules available throughout the app.
|
||||
|
||||
在 CLI 生成的基本应用中,模块是立即加载的,这意味着它们都是由本应用启动的,Angular 会使用一个依赖注入体系来让一切服务都在模块间有效。对于立即加载式应用,应用中的根注入器会让所有服务提供商都对整个应用有效。
|
||||
在 CLI 生成的基本应用中,模块是急性加载的,这意味着它们都是由本应用启动的,Angular 会使用一个依赖注入体系来让一切服务都在模块间有效。对于急性加载式应用,应用中的根注入器会让所有服务提供商都对整个应用有效。
|
||||
|
||||
This behavior necessarily changes when you use lazy loading. Lazy loading is when you load modules only when you need them; for example, when routing. They aren’t loaded right away like with eagerly loaded modules. This means that any services listed in their provider arrays aren’t available because the root injector doesn’t know about these modules.
|
||||
|
||||
当使用惰性加载时,这种行为需要进行改变。惰性加载就是只有当需要时才加载模块,比如路由中。它们没办法像立即加载模块那样进行加载。这意味着,在它们的 `providers` 数组中列出的服务都是不可用的,因为根注入器并不知道这些模块。
|
||||
当使用惰性加载时,这种行为需要进行改变。惰性加载就是只有当需要时才加载模块,比如路由中。它们没办法像急性加载模块那样进行加载。这意味着,在它们的 `providers` 数组中列出的服务都是不可用的,因为根注入器并不知道这些模块。
|
||||
|
||||
<!-- KW--Make diagram here -->
|
||||
|
||||
|
@ -122,7 +122,7 @@ Providing a service in the component limits the service only to that component (
|
|||
the same module can’t access it.)
|
||||
|
||||
另一种限定提供商作用域的方式是把要限定的服务添加到组件的 `providers` 数组中。组件中的提供商和 NgModule 中的提供商是彼此独立的。
|
||||
当你要立即加载一个自带了全部所需服务的模块时,这种方式是有帮助的。
|
||||
当你要急性加载一个自带了全部所需服务的模块时,这种方式是有帮助的。
|
||||
在组件中提供服务,会限定该服务只能在该组件中有效(同一模块中的其它组件不能访问它)。
|
||||
|
||||
<code-example path="providers/src/app/app.component.ts" region="component-providers" header="src/app/app.component.ts" linenums="false">
|
||||
|
|
|
@ -5513,7 +5513,7 @@ you should eagerly load the `AppModule` and the `HeroesModule`.
|
|||
来看看*危机中心*。
|
||||
用户第一眼不会看到它。
|
||||
默认情况下,*英雄管理*才是第一视图。
|
||||
为了获得尽可能小的初始加载体积和最快的加载速度,你应该对 `AppModule` 和 `HeroesModule` 进行立即加载。
|
||||
为了获得尽可能小的初始加载体积和最快的加载速度,你应该对 `AppModule` 和 `HeroesModule` 进行急性加载。
|
||||
|
||||
You could lazy load the _Crisis Center_.
|
||||
But you're almost certain that the user will visit the _Crisis Center_ within minutes of launching the app.
|
||||
|
|
Loading…
Reference in New Issue