fix: 把语言环境和区域设置批量替换为本地环境

This commit is contained in:
Zhicheng WANG 2020-06-28 14:22:19 +08:00
parent c0fb977d9c
commit 82e5471721
9 changed files with 13 additions and 13 deletions

View File

@ -1452,7 +1452,7 @@ Use the [non-null type assertion operator](guide/template-syntax#non-null-assert
In the following example, the `person` and `address` properties are always set together, implying that `address` is always non-null if `person` is non-null. In the following example, the `person` and `address` properties are always set together, implying that `address` is always non-null if `person` is non-null.
There is no convenient way to describe this constraint to TypeScript and the template compiler, but the error is suppressed in the example by using `address!.street`. There is no convenient way to describe this constraint to TypeScript and the template compiler, but the error is suppressed in the example by using `address!.street`.
在下例子中,`person``address` 属性总是一起出现的,如果 `person` 非空,则 `address` 也一定非空。没有一种简便的写法可以向 TypeScript 和模板编译器描述这种约束。但是这个例子中使用 `address!.street` 避免了报错。 在下面的例子中,`person``address` 属性总是一起出现的,如果 `person` 非空,则 `address` 也一定非空。没有一种简便的写法可以向 TypeScript 和模板编译器描述这种约束。但是这个例子中使用 `address!.street` 避免了报错。
```typescript ```typescript

View File

@ -128,7 +128,7 @@ The **Development Workflow** section describes the tools and processes you use t
* [Internationalization](guide/i18n): Make your app available in multiple languages with Angular's internationalization (i18n) tools. * [Internationalization](guide/i18n): Make your app available in multiple languages with Angular's internationalization (i18n) tools.
[国际化](guide/i18n) :借助 Angular 的国际化i18n工具可以让你的应用支持多语言环境。 [国际化](guide/i18n) :借助 Angular 的国际化i18n工具可以让你的应用支持多本地环境。
* [Accessibility](guide/accessibility): Make your app accessible to all users. * [Accessibility](guide/accessibility): Make your app accessible to all users.

View File

@ -148,7 +148,7 @@ Your templates can use *pipes* to improve the user experience by transforming va
For example, use pipes to display dates and currency values that are appropriate for a user's locale. For example, use pipes to display dates and currency values that are appropriate for a user's locale.
Angular provides predefined pipes for common transformations, and you can also define your own pipes. Angular provides predefined pipes for common transformations, and you can also define your own pipes.
你的模板也可以用*管道*转换要显示的值以增强用户体验。比如,可以使用管道来显示适合用户所在语言环境的日期和货币格式。 你的模板也可以用*管道*转换要显示的值以增强用户体验。比如,可以使用管道来显示适合用户所在本地环境的日期和货币格式。
Angular 为一些通用的转换提供了预定义管道,你还可以定义自己的管道。 Angular 为一些通用的转换提供了预定义管道,你还可以定义自己的管道。
<div class="alert is-helpful"> <div class="alert is-helpful">

View File

@ -413,7 +413,7 @@ button.removeEventListener(click, handler);
An observable produces values over time. An array is created as a static set of values. In a sense, observables are asynchronous where arrays are synchronous. In the following examples, ➞ implies asynchronous value delivery. An observable produces values over time. An array is created as a static set of values. In a sense, observables are asynchronous where arrays are synchronous. In the following examples, ➞ implies asynchronous value delivery.
可观察对象会随时间生成值。数组是用一组静态的值创建的。某种意义上,可观察对象是异步的,而数组是同步的。 可观察对象会随时间生成值。数组是用一组静态的值创建的。某种意义上,可观察对象是异步的,而数组是同步的。
在下例子中,➞ 符号表示异步传递值。 在下面的例子中,➞ 符号表示异步传递值。
<table> <table>
<tr> <tr>

View File

@ -111,7 +111,7 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
| --------------------------------------------------------------------------------------------- | --------------------------------------------------- | --------------------- | ----- | | --------------------------------------------------------------------------------------------- | --------------------------------------------------- | --------------------- | ----- |
| API | 替代品 | 宣布弃用 | 备注 | | API | 替代品 | 宣布弃用 | 备注 |
| [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | v9 | From v11 the default code will be extracted from the locale data given by `LOCAL_ID`, rather than `USD`. | | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | v9 | From v11 the default code will be extracted from the locale data given by `LOCAL_ID`, rather than `USD`. |
| [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | v9 | 从 v11 开始,默认代码将从由 `LOCAL_ID` 提供的语言环境数据中提取,而不再是固定值 `USD`。| | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | v9 | 从 v11 开始,默认代码将从由 `LOCAL_ID` 提供的本地环境数据中提取,而不再是固定值 `USD`。|
{@a core} {@a core}
### @angular/core ### @angular/core
@ -712,13 +712,13 @@ This section contains a complete list all of the currently deprecated CLI flags.
| `i18nFormat` | <!--v9--> v11 | Renamed to `format` to simplify the user experience. | | `i18nFormat` | <!--v9--> v11 | Renamed to `format` to simplify the user experience. |
| `i18nFormat` | <!--v9--> v11 | 已改名为 `format`,以简化用户体验。 | | `i18nFormat` | <!--v9--> v11 | 已改名为 `format`,以简化用户体验。 |
| `i18nLocale` | <!--v9--> v11 | Redundant with projects source locale. | | `i18nLocale` | <!--v9--> v11 | Redundant with projects source locale. |
| `i18nLocale` | <!--v9--> v11 | 是项目的源语言环境的冗余项。 | | `i18nLocale` | <!--v9--> v11 | 是项目的源本地环境的冗余项。 |
| `scripts[].lazy` | <!--v8--> v11 | Renamed to `scripts[].inject`. | | `scripts[].lazy` | <!--v8--> v11 | Renamed to `scripts[].inject`. |
| `scripts[].lazy` | <!--v8--> v11 | 已改名为 `scripts[].inject`. | | `scripts[].lazy` | <!--v8--> v11 | 已改名为 `scripts[].inject`. |
| `styles[].lazy` | <!--v8--> v11 | Renamed to `styles[].inject`. | | `styles[].lazy` | <!--v8--> v11 | Renamed to `styles[].inject`. |
| `styles[].lazy` | <!--v8--> v11 | 已改名为 `styles[].inject` 。 | | `styles[].lazy` | <!--v8--> v11 | 已改名为 `styles[].inject` 。 |
| `i18nFile` | <!--v9--> v11 | Specified in the project locale configuration in version 9 and later. | | `i18nFile` | <!--v9--> v11 | Specified in the project locale configuration in version 9 and later. |
| `i18nFile` | <!--v9--> v11 | 在版本 9 及更高版本的项目区域设置配置中指定。 | | `i18nFile` | <!--v9--> v11 | 在版本 9 及更高版本的项目本地环境配置中指定。 |
| `i18nFormat` | <!--v9--> v11 | Format is now automatically detected. | | `i18nFormat` | <!--v9--> v11 | Format is now automatically detected. |
| `i18nFormat` | <!--v9--> v11 | 格式现在是自动检测的。 | | `i18nFormat` | <!--v9--> v11 | 格式现在是自动检测的。 |
| `i18nLocale` | <!--v9--> v11 | New [localization option](/guide/i18n#localize-config) in version 9 and later. | | `i18nLocale` | <!--v9--> v11 | New [localization option](/guide/i18n#localize-config) in version 9 and later. |

View File

@ -1223,7 +1223,7 @@ To link to a Stackblitz in a folder whose name is not the same as the current gu
To link to a Stackblitz defined by a named `stackblitz.json` file, set the `stackblitz` attribute. The following example links to the Stackblitz defined by `second.stackblitz.json` in the current guide's directory. To link to a Stackblitz defined by a named `stackblitz.json` file, set the `stackblitz` attribute. The following example links to the Stackblitz defined by `second.stackblitz.json` in the current guide's directory.
要链接到一个名叫 `stackblitz.json` 文件,请设置 `stackblitz` 属性。下例子链接到当前指南目录下的 second.stackblitz.json 定义的 `second.stackblitz.json` 要链接到一个名叫 `stackblitz.json` 文件,请设置 `stackblitz` 属性。下面的例子链接到当前指南目录下的 second.stackblitz.json 定义的 `second.stackblitz.json`
<live-example stackblitz="second"></live-example> <live-example stackblitz="second"></live-example>

View File

@ -837,7 +837,7 @@ A form of property [data binding](#data-binding) in which a [template expression
That text can be concatenated with neighboring text before it is assigned to an element property That text can be concatenated with neighboring text before it is assigned to an element property
or displayed between element tags, as in this example. or displayed between element tags, as in this example.
[属性数据绑定 (property data binding)](#data-binding) 的一种形式,位于双括号中的[模板表达式 (template expression)](#template-expression)会被渲染成文本。 [属性数据绑定 (property data binding)](#data-binding) 的一种形式,位于双括号中的[模板表达式 (template expression)](#template-expression)会被渲染成文本。
在被赋值给元素属性或者显示在元素标签中之前,这些文本可能会先与周边的文本合并,参见下面的例子。 在被赋值给元素属性或者显示在元素标签中之前,这些文本可能会先与周边的文本合并,参见下面的例子。
```html ```html

View File

@ -44,13 +44,13 @@ The symbol is loaded by importing the `@angular/localize/init` module, which has
Prior to Angular version 9, Angular's internationalization (i18n) system inlined translated messages into the compiled output as part of this template compilation. Prior to Angular version 9, Angular's internationalization (i18n) system inlined translated messages into the compiled output as part of this template compilation.
This approach required running the template compiler once per target locale, often leading to slow production build times. This approach required running the template compiler once per target locale, often leading to slow production build times.
在 Angular 第 9 版之前Angular 的国际化i18n系统会把已翻译的消息内联到编译输出中作为模板编译的一部分。这种方法要求为每个目标语言环境运行一次模板编译器,这通常会导致生产构建时间变慢。 在 Angular 第 9 版之前Angular 的国际化i18n系统会把已翻译的消息内联到编译输出中作为模板编译的一部分。这种方法要求为每个目标本地环境运行一次模板编译器,这通常会导致生产构建时间变慢。
In the new i18n system, the Angular compiler tags i18n messages in the compiled code with a global `$localize` handler. In the new i18n system, the Angular compiler tags i18n messages in the compiled code with a global `$localize` handler.
The inlining of translations then occurs as a post-compilation step for each locale. The inlining of translations then occurs as a post-compilation step for each locale.
Because the application does not need to be built again for each locale, this makes the process much faster. Because the application does not need to be built again for each locale, this makes the process much faster.
在新的 i18n 系统中Angular 编译器使用全局 `$localize` 处理函数在已编译的代码中标记 i18n 消息。然后这些翻译的内联工作会作为每种语言环境的后编译步骤。由于不需要为每个语言环境重复构建应用,所以这会让这个过程更快。 在新的 i18n 系统中Angular 编译器使用全局 `$localize` 处理函数在已编译的代码中标记 i18n 消息。然后这些翻译的内联工作会作为每种本地环境的后编译步骤。由于不需要为每个本地环境重复构建应用,所以这会让这个过程更快。
The post-compilation inlining step is optional&mdash;for example during development or if the translations will be inlined at runtime. The post-compilation inlining step is optional&mdash;for example during development or if the translations will be inlined at runtime.
Therefore this global `$localize` must be available on the global scope at runtime. Therefore this global `$localize` must be available on the global scope at runtime.

View File

@ -82,7 +82,7 @@ You can then display the form by adding the component to the template.
The following examples show how to add a single form control. In the example, the user enters their name into an input field, captures that input value, and displays the current value of the form control element. The following examples show how to add a single form control. In the example, the user enters their name into an input field, captures that input value, and displays the current value of the form control element.
例子展示了如何添加一个表单控件。在这个例子中,用户在输入字段中输入自己的名字,捕获其输入值,并显示表单控件的当前值。 面的例子展示了如何添加一个表单控件。在这个例子中,用户在输入字段中输入自己的名字,捕获其输入值,并显示表单控件的当前值。
**Register the reactive forms module** **Register the reactive forms module**
@ -252,7 +252,7 @@ Forms typically contain several related controls. Reactive forms provide two way
Just as a form control instance gives you control over a single input field, a form group instance tracks the form state of a group of form control instances (for example, a form). Each control in a form group instance is tracked by name when creating the form group. The following example shows how to manage multiple form control instances in a single group. Just as a form control instance gives you control over a single input field, a form group instance tracks the form state of a group of form control instances (for example, a form). Each control in a form group instance is tracked by name when creating the form group. The following example shows how to manage multiple form control instances in a single group.
就像 `FormControl` 的实例能让你控制单个输入框所对应的控件一样,`FormGroup` 的实例也能跟踪一组 `FormControl` 实例(比如一个表单)的表单状态。当创建 `FormGroup` 时,其中的每个控件都会根据其名字进行跟踪。下例子展示了如何管理单个控件组中的多个 `FormControl` 实例。 就像 `FormControl` 的实例能让你控制单个输入框所对应的控件一样,`FormGroup` 的实例也能跟踪一组 `FormControl` 实例(比如一个表单)的表单状态。当创建 `FormGroup` 时,其中的每个控件都会根据其名字进行跟踪。下面的例子展示了如何管理单个控件组中的多个 `FormControl` 实例。
Generate a `ProfileEditor` component and import the `FormGroup` and `FormControl` classes from the `@angular/forms` package. Generate a `ProfileEditor` component and import the `FormGroup` and `FormControl` classes from the `@angular/forms` package.