Skip to content

Commit 6135310

Browse files
committed
fix: 修正 guides 中内容的格式
1 parent d922cb7 commit 6135310

9 files changed

+104
-104
lines changed

guides/creating-a-custom-form-field-control.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ guide:
2121

2222
In order to learn how to build custom form field controls, let's start with a simple input component
2323
that we want to work inside the form field. For example, a phone number input that segments the
24-
parts of the number into their own inputs. \(Note: this is not intended to be a robust component,
25-
just a starting point for us to learn.\)
24+
parts of the number into their own inputs. (Note: this is not intended to be a robust component,
25+
just a starting point for us to learn.)
2626

2727
要学习如何构建自定义表单字段控件,我们先从一个简单的输入框组件开始,我们要让它能用于表单字段中。 比如,一个电话号码输入框应该能把号码拆分后放进它的各个输入属性中。(注意,我们并不打算把它做成一个健壮的组件,只想把它作成学习的起点。)
2828

@@ -217,8 +217,8 @@ constructor(
217217
```
218218

219219
Note that if your component implements `ControlValueAccessor`, it may already be set up to provide
220-
`NG_VALUE_ACCESSOR` \(in the `providers` part of the component's decorator, or possibly in a module
221-
declaration\). If so, you may get a *cannot instantiate cyclic dependency* error.
220+
`NG_VALUE_ACCESSOR` (in the `providers` part of the component's decorator, or possibly in a module
221+
declaration). If so, you may get a *cannot instantiate cyclic dependency* error.
222222

223223
注意,如果你的组件实现了 `ControlValueAccessor`,那么它可能已经作为 `NG_VALUE_ACCESSOR` 提供出去了(在组件装饰器的 `providers` 部分,或模块声明中)。如果是这样,可能会导致*cannot instantiate cyclic dependency(不能实例化循环依赖)*错误。
224224

@@ -388,7 +388,7 @@ get errorState(): boolean {
388388
}
389389
```
390390

391-
However, there are some error triggers that we can't subscribe to \(e.g. parent form submissions\),
391+
However, there are some error triggers that we can't subscribe to (e.g. parent form submissions),
392392
to handle such cases we should re-evaluate `errorState` on every change detection cycle.
393393

394394
但是,有一些错误触发器我们无法订阅(例如父表单提交),为了处理此类情况,我们应该在每个变更检测周期重新对 `errorState` 进行求值。
@@ -516,7 +516,7 @@ element using either `aria-label` or `aria-labelledby`.
516516
屏幕阅读器用户却缺少一条很重要的信息。他们无法分辨这个输入组所代表的含义。为了改善这一点,我们应该使用 `aria-label` 或者 `aria-labelledby` 为这个分组元素添加一个标签。
517517

518518
It's recommended to link the group to the label that is displayed as part of the parent
519-
`<mat-form-field>`. This ensures that explicitly specified labels \(using `<mat-label>`\) are
519+
`<mat-form-field>`. This ensures that explicitly specified labels (using `<mat-label>`) are
520520
actually used for labelling the control.
521521

522522
我们建议把该标签链接到这个组,将其作为父元素 `<mat-form-field>` 的一部分。这可以确保显式指定的标签(使用 `<mat-label>` )确实被用作了该控件的标签。
@@ -559,8 +559,8 @@ do is place it inside a `<mat-form-field>`
559559
```
560560

561561
We also get all the features that come with `<mat-form-field>` such as floating placeholder,
562-
prefix, suffix, hints, and errors \(if we've given the form field an `NgControl` and correctly report
563-
the error state\).
562+
prefix, suffix, hints, and errors (if we've given the form field an `NgControl` and correctly report
563+
the error state).
564564

565565
我们还获得了 `<mat-form-field>` 的所有特性,比如上浮占位符、前缀、后缀、提示和错误(前提是我们给了表单字段一个 `NgControl`,并正确的报告了错误状态)。
566566

guides/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ng add @angular/material
3636
```
3737

3838
The `ng add` command will install Angular Material, the
39-
[Component Dev Kit \(CDK\)](https://material.angular.io/cdk/categories),
39+
[Component Dev Kit (CDK)](https://material.angular.io/cdk/categories),
4040
[Angular Animations](https://angular.io/guide/animations) and ask you the following questions to
4141
determine which features to include:
4242

@@ -151,7 +151,7 @@ You should see the Material slide toggle component on the page.
151151
你会在页面上看到这个 Material 滑块开关组件。
152152

153153
In addition to the installation schematic, Angular Material comes with
154-
[several other schematics](https://material.angular.io/guide/schematics) \(like nav, table,
155-
address-form, etc.\) that can be used to easily generate pre-built components in your application.
154+
[several other schematics](https://material.angular.io/guide/schematics) (like nav, table,
155+
address-form, etc.) that can be used to easily generate pre-built components in your application.
156156

157157
除了安装原理图之外,Angular Material 还带有[另外一些原理图](https://material.angular.cn/guide/schematics)(如导航、表格、地址表单等),可用于方便地在应用中生成预置的组件。

guides/schematics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ packages, they will be available through the Angular CLI.
1616

1717
Angular Material 附带了一些原理图,一旦你安装了这个 npm 包,就可以通过 Angular CLI 来使用这些原理图了。
1818

19-
Using the command below will install Angular Material, the [Component Dev Kit](https://material.angular.io/cdk) \(CDK\),
19+
Using the command below will install Angular Material, the [Component Dev Kit](https://material.angular.io/cdk) (CDK),
2020
and [Angular Animations](https://angular.io/guide/animations) in your project. Then it will run the
2121
installation schematic.
2222

23-
运行下列命令可以自动为你的项目安装 Angular Material、[组件开发工具](/cdk) \(CDK\)[Angular 动画库](https://angular.cn/guide/animations),并运行代码原理图。
23+
运行下列命令可以自动为你的项目安装 Angular Material、[组件开发工具](/cdk) (CDK) 和 [Angular 动画库](https://angular.cn/guide/animations),并运行代码原理图。
2424

2525
```
2626
ng add @angular/material

guides/theming-your-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ structural, color, and typography styles. This file is included in the `styleUrl
118118

119119
To change this file to participate in Angular Material's theming system, we split the styles into
120120
two files, with the color and typography styles moved into mixins. By convention, the new file
121-
name ends with `-theme`. Additionally, the file starts with an underscore \(`_`\), indicating that
121+
name ends with `-theme`. Additionally, the file starts with an underscore (`_`), indicating that
122122
this is a Sass partial file. See the [Sass documentation][sass-partials] for more information about
123123
partial files.
124124

125-
为了更改此文件以融入 Angular Material 的主题体系,我们将这些样式拆分为两个文件,把颜色和排版样式移动到 mixin 中。按照惯例,新文件名以 `-theme` 结尾。此外,该文件以下划线 \(`_`\) 开头,以表明这是一个 Sass “部分(partial)文件”。关于“部分文件”的更多信息,请参阅 [Sass 文档][sass-partials]
125+
为了更改此文件以融入 Angular Material 的主题体系,我们将这些样式拆分为两个文件,把颜色和排版样式移动到 mixin 中。按照惯例,新文件名以 `-theme` 结尾。此外,该文件以下划线 (`_`) 开头,以表明这是一个 Sass “部分(partial)文件”。关于“部分文件”的更多信息,请参阅 [Sass 文档][sass-partials]
126126

127127
[sass-partials]: https://sass-lang.com/guide#topic-4
128128

guides/theming.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ determine component colors:
128128

129129
* A **primary** palette for the color that appears most frequently throughout your application
130130

131-
在整个应用程序中最常出现的颜色的 **primary\(主要\)** 调色板
131+
在整个应用程序中最常出现的颜色的 **primary(主要)** 调色板
132132

133133
* An **accent**, or _secondary_, palette used to selectively highlight key parts of your UI
134134

135-
用于有选择地突出显示 UI 中某些关键部位的 **accent\(强调\)***secondary\(辅助\)* 调色板
135+
用于有选择地突出显示 UI 中某些关键部位的 **accent(强调)***secondary(辅助)* 调色板
136136

137137
* A **warn**, or _error_, palette used for warnings and error states
138138

139-
用于警告和错误状态的 **warn\(警告\)***error\(错误\)* 调色板
139+
用于警告和错误状态的 **warn(警告)***error(错误)* 调色板
140140

141141
You can include the CSS styles for a theme in your application in one of two ways: by defining a
142142
custom theme with Sass, or by importing a pre-built theme CSS file.
@@ -186,7 +186,7 @@ represent, in order: the "default" hue, a "lighter" hue, a "darker" hue, and a "
186186
Components use these hues to choose the most appropriate color for different parts of
187187
themselves.
188188

189-
构建主题首先需要定义你的 `primary`\(主要\)`accent`\(重音\)调色板,以及可选的 `warn`\(警告\)调色板。Sass 函数 `define-palette` 接受一个调色板(这在上面的[调色板](#palettes)部分中讲过)以及四个可选的色调数值。这四种色调依次表示:“default\(默认\)”色调、“lighter\(较浅\)”色调、“darker\(较暗\)”色调和“text\(文本\)”色调。各个组件会使用这些色调为自身的不同部位选择最合适的颜色。
189+
构建主题首先需要定义你的 `primary`(主要)和 `accent`(重音)调色板,以及可选的 `warn`(警告)调色板。Sass 函数 `define-palette` 接受一个调色板(这在上面的[调色板](#palettes)部分中讲过)以及四个可选的色调数值。这四种色调依次表示:“default(默认)”色调、“lighter(较浅)”色调、“darker(较暗)”色调和“text(文本)”色调。各个组件会使用这些色调为自身的不同部位选择最合适的颜色。
190190

191191
```scss
192192
@use '@angular/material' as mat;
@@ -248,7 +248,7 @@ configuration to `define-light-theme` or `define-dark-theme`.
248248
Apply the styles for each of the components used in your application by including each of their
249249
theme Sass mixins.
250250

251-
通过包含 \(`include`\) 每个主题 Sass mixins,可以为应用程序中使用的每个组件应用样式。
251+
通过包含 (`include`) 每个主题 Sass mixins,可以为应用程序中使用的每个组件应用样式。
252252

253253
```scss
254254
@use '@angular/material' as mat;
@@ -321,17 +321,17 @@ You can use one of these pre-built themes if you don't want to define a custom t
321321

322322
Angular Material 包括四个预构建的主题 CSS 文件,每个文件都选择了不同的调色板。如果你不想使用 Sass 来自定义主题,则可以使用这些预构建的主题之一。
323323

324-
| Theme | Light or dark? | Palettes (primary, accent, warn) |
325-
| ----- | -------------- | -------------------------------- |
326-
| 主题 | 亮还是暗? | 调色板(primary, accent, warn) |
327-
| `deeppurple-amber.css` | Light | deep-purple, amber, red |
328-
| `deeppurple-amber.css` || deep-purple, amber, red |
329-
| `indigo-pink.css` | Light | indigo, pink, red |
330-
| `indigo-pink.css` || indigo, pink, red |
331-
| `pink-bluegrey.css` | Dark | pink, blue-grey, red |
332-
| `pink-bluegrey.css` || pink, bluegrey, red |
333-
| `purple-green.css` | Dark | purple, green, red |
334-
| `purple-green.css` || purple, green, red |
324+
| Theme | Light or dark? | Palettes (primary, accent, warn) |
325+
| ---------------------- | -------------- | -------------------------------- |
326+
| 主题 | 亮还是暗? | 调色板(primary, accent, warn) |
327+
| `deeppurple-amber.css` | Light | deep-purple, amber, red |
328+
| `deeppurple-amber.css` | | deep-purple, amber, red |
329+
| `indigo-pink.css` | Light | indigo, pink, red |
330+
| `indigo-pink.css` | | indigo, pink, red |
331+
| `pink-bluegrey.css` | Dark | pink, blue-grey, red |
332+
| `pink-bluegrey.css` | | pink, bluegrey, red |
333+
| `purple-green.css` | Dark | purple, green, red |
334+
| `purple-green.css` | | purple, green, red |
335335

336336
These files include the CSS for every component in the library. To include only the CSS for a subset
337337
of components, you must use the Sass API detailed in [Defining a theme](#defining-a-theme) above.
@@ -341,11 +341,11 @@ theme definitions.
341341
这些文件包括库中每个组件的 CSS。如果要单独包含这些组件的某个子集的 CSS,你必须使用上面[定义主题](#defining-a-theme)中详述的 Sass API。你可以[参考这些预建主题的源代码][prebuilt]查看完整主题定义的示例。
342342

343343
You can find the pre-built theme files in the "prebuilt-themes" directory of Angular Material's
344-
npm package \(`@angular/material/prebuilt-themes`\). To include the pre-built theme in your
344+
npm package (`@angular/material/prebuilt-themes`). To include the pre-built theme in your
345345
application, [add your chosen CSS file to the `styles` array of your project's `angular.json`
346346
file][adding-styles].
347347

348-
你可以在 Angular Material 的 npm 包 \( `@angular/material/prebuilt-themes` \)`prebuilt-themes` 目录中找到预构建的主题文件。要在你的应用程序中包含预先构建的主题,[请将你选择的 CSS 文件添加到你项目的 `angular.json` 文件的 `styles` 数组中][adding-styles]
348+
你可以在 Angular Material 的 npm 包 ( `@angular/material/prebuilt-themes` ) 的 `prebuilt-themes` 目录中找到预构建的主题文件。要在你的应用程序中包含预先构建的主题,[请将你选择的 CSS 文件添加到你项目的 `angular.json` 文件的 `styles` 数组中][adding-styles]
349349

350350
[prebuilt]: https://github.com/angular/components/blob/main/src/material/core/theming/prebuilt
351351

@@ -440,7 +440,7 @@ to match the components' theme, you can either:
440440

441441
假设你正在使用 `MatSidenav` ,请将应用程序的主要内容放入 `mat-sidenav-container` ,或者
442442

443-
2. Apply the `mat-app-background` CSS class to your main content root element \(typically `body`\).
443+
2. Apply the `mat-app-background` CSS class to your main content root element (typically `body`).
444444

445445
`mat-app-background` CSS 类应用到你主要内容的根元素(通常是 `body` )。
446446

@@ -518,7 +518,7 @@ the number for _less density_.
518518
Angular Material 的密集度定制是基于 [Material Design 密集度指南](https://m2.material.io/design/layout/applying-density.html)的。该系统定义了一个等级,其中零表示默认密集度。你可以减少该数字以*增加密集度*,增加该数字以*减少密集度*
519519

520520
The density system is based on a *density scale*. The scale starts with the
521-
default density of `0`. Each whole number step down \(`-1`, `-2`, etc.\) reduces
521+
default density of `0`. Each whole number step down (`-1`, `-2`, etc.) reduces
522522
the affected sizes by `4px`, down to the minimum size necessary for a component to render coherently.
523523

524524
密集度系统基于某个*密集度等级*。此等级以默认密集度 `0` 开始。每个整数递减(`-1``-2` 等)都会将受影响的尺寸减小 `4px` ,直至组件连续渲染所需的最小尺寸。

0 commit comments

Comments
 (0)