Skip to content

Commit 5da737e

Browse files
author
Zhicheng WANG
committed
fix: 翻译 API 文档
1 parent 177b597 commit 5da737e

File tree

295 files changed

+7729
-1123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+7729
-1123
lines changed

src/cdk-experimental/menu/menu.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ You must wrap pop-up menus with an `ng-template` with the `cdkMenuPanel` directi
8989
variable which must be of type `cdkMenuPanel`. Further, the `cdkMenu` must also reference the
9090
`cdkMenuPanel`.
9191

92-
你必须使用带有 `cdkMenuPanel` 指令的 `ng-template` 来包装弹出菜单,并且其引用变量必须是 `cdkMenuPanel` 类型的。此外, `cdkMenu` 也必须引用这个 `cdkMenuPanel`
92+
你必须使用带有 `cdkMenuPanel` 指令的 `ng-template` 来包装弹出菜单,并且其引用变量必须是 `cdkMenuPanel` 类型的。此外,`cdkMenu` 也必须引用这个 `cdkMenuPanel`
9393

9494
```html
9595
<ng-template cdkMenuPanel #panel="cdkMenuPanel">
@@ -129,7 +129,7 @@ container element with the `cdkContextMenuTriggerFor`, which behaves like `cdkMe
129129
that it responds to the browser's native `contextmenu` event. Custom context menus appear next to
130130
the cursor, similarly to native context menus.
131131

132-
当用户右键单击某个容器元素时,就会打开一个上下文菜单。`cdkContextMenuTriggerFor` 标记一个容器元素,它的行为类似于 `cdkMenuTriggerFor` ,不过它会响应浏览器的原生事件 `contextmenu`。自定义上下文菜单会出现在光标旁边,类似于原生的上下文菜单。
132+
当用户右键单击某个容器元素时,就会打开一个上下文菜单。`cdkContextMenuTriggerFor` 标记一个容器元素,它的行为类似于 `cdkMenuTriggerFor`,不过它会响应浏览器的原生事件 `contextmenu`。自定义上下文菜单会出现在光标旁边,类似于原生的上下文菜单。
133133

134134
<!-- example({
135135
"example": "cdk-menu-context",

src/cdk/a11y/a11y.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ details.
171171
See [the W3C's WAI-ARIA](https://www.w3.org/WAI/PF/aria-1.1/states_and_properties#aria-live)
172172
for more information on aria-live regions.
173173

174-
`LiveAnnouncer` 用于通过 `aria-live` 区域为屏幕阅读器用户播报信息。关于 `aria-live` 区域的详细信息,请参见 [W3C 的 WAI-ARIA](https://www.w3.org/TR/wai-aria/states_and_properties#aria-live)
174+
`LiveAnnouncer` 用于通过 `aria-live` 区域为屏幕阅读器用户播报信息。关于 `aria-live` 区域的详细信息,请参见 [W3C 的 WAI-ARIA](https://www.w3.org/TR/wai-aria/states_and_properties#aria-live)
175175

176176
#### Example
177177

@@ -204,7 +204,7 @@ monitor and an optional boolean flag `checkChildren`. Passing true for `checkChi
204204
defaults to `false` if not specified. The `monitor` method will return an Observable that emits the
205205
`FocusOrigin` whenever the focus state changes. The `FocusOrigin` will be one of the following:
206206

207-
要监听某个元素的焦点变化,可以用 `monitor` 方法传入要监控的元素和一个可选的逻辑标志 `checkChildren`。给 `checkChildren` 传入 `true` 会告诉 `FocusMonitor` :如果该元素的任何各级子元素有焦点,就认为该元素有焦点。如果没有指定,该选项默认为 `false` `monitor` 方法会返回一个可观察对象,当焦点状态改变时,该对象会发送一个 `FocusOrigin` `FocusOrigin` 是下列值之一:
207+
要监听某个元素的焦点变化,可以用 `monitor` 方法传入要监控的元素和一个可选的逻辑标志 `checkChildren`。给 `checkChildren` 传入 `true` 会告诉 `FocusMonitor` :如果该元素的任何各级子元素有焦点,就认为该元素有焦点。如果没有指定,该选项默认为 `false``monitor` 方法会返回一个可观察对象,当焦点状态改变时,该对象会发送一个 `FocusOrigin``FocusOrigin` 是下列值之一:
208208

209209
* `'mouse'` indicates the element was focused with the mouse
210210

@@ -269,7 +269,7 @@ For convenience, the CDK also provides two directives that allow for easily moni
269269
the host element with `checkChildren` set to `true`. Each of these directives has an `@Output()`
270270
`cdkFocusChange` that will emit the new `FocusOrigin` whenever it changes.
271271

272-
为了方便使用,CDK 还提供了两个指令,可以简单地监控某个元素。`cdkMonitorElementFocus` 相当于在 `checkChildren``false` 的宿主元素上调用 `monitor` `cdkMonitorSubtreeFocus` 相当于在 `checkChildren``true` 的宿主元素上调用 `monitor`。这两个指令都有一个 `@Output()` `cdkFocusChange`,每当它发生变化时都会通过该事件发出新的 `FocusOrigin`
272+
为了方便使用,CDK 还提供了两个指令,可以简单地监控某个元素。`cdkMonitorElementFocus` 相当于在 `checkChildren``false` 的宿主元素上调用 `monitor``cdkMonitorSubtreeFocus` 相当于在 `checkChildren``true` 的宿主元素上调用 `monitor`。这两个指令都有一个 `@Output()` `cdkFocusChange`,每当它发生变化时都会通过该事件发出新的 `FocusOrigin`
273273

274274
<!-- example(focus-monitor-directives) -->
275275

@@ -344,7 +344,7 @@ targets. The accepted values are `active` (default), `black-on-white`, and `whit
344344
values correspond to the supported values for the
345345
[`-ms-high-contrast` media query][ms-high-contrast].
346346

347-
`$target` 参数允许你指定这些样式要用高对比度模式的哪个变体。接受的值是 `active` (默认),`black-on-white``white-on-black` 。这些值对应于 [`-ms-high-contrast` 媒体查询][ms-high-contrast] 所支持的值。
347+
`$target` 参数允许你指定这些样式要用高对比度模式的哪个变体。接受的值是 `active` (默认),`black-on-white``white-on-black`。这些值对应于 [`-ms-high-contrast` 媒体查询][ms-high-contrast] 所支持的值。
348348

349349
The `$encapsulation` parameter affects how the emitted styles interact with style encapsulation.
350350
The supported values are `on`, `off`, and `any`. The default value is `any`, which works for any
@@ -353,7 +353,7 @@ the amount of CSS emitted by limiting the styles to components with encapsulatio
353353
disabled, respectively. The styles emitted for encapsulated components work for both Angular's
354354
emulated style encapsulation and for native Shadow DOM encapsulation.
355355

356-
`$encapsulation` 参数会影响所生成的样式与样式封装的互动。支持的值是 `on``off``any` 。默认值为 `any`,它生成的两个选择器,可用于任何封装方案。指定为 `on``off`,可以将样式分别限制为启用或禁用样式封装,可以轻微减小生成的 CSS 的大小。这些为带封装的组件生成的样式,会作用于 Angular 的模拟(emulated)样式封装和原生(native) Shadow DOM 封装方式。
356+
`$encapsulation` 参数会影响所生成的样式与样式封装的互动。支持的值是 `on``off``any`。默认值为 `any`,它生成的两个选择器,可用于任何封装方案。指定为 `on``off`,可以将样式分别限制为启用或禁用样式封装,可以轻微减小生成的 CSS 的大小。这些为带封装的组件生成的样式,会作用于 Angular 的模拟(emulated)样式封装和原生(native) Shadow DOM 封装方式。
357357

358358
[Windows 高对比度模式]: https://support.microsoft.com/en-us/windows/use-high-contrast-mode-in-windows-10-fedc744c-90ac-69df-aed5-c8a90125e696
359359

src/cdk/a11y/fake-event-detection.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
/** Gets whether an event could be a faked `mousedown` event dispatched by a screen reader. */
9+
/**
10+
* Gets whether an event could be a faked `mousedown` event dispatched by a screen reader.
11+
*
12+
* 获取某个事件是否可能是屏幕阅读器派发的伪 `mousedown` 事件。
13+
*
14+
*/
1015
export function isFakeMousedownFromScreenReader(event: MouseEvent): boolean {
1116
// We can typically distinguish between these faked mousedown events and real mousedown events
1217
// using the "buttons" property. While real mousedowns will indicate the mouse button that was
@@ -15,7 +20,12 @@ export function isFakeMousedownFromScreenReader(event: MouseEvent): boolean {
1520
return event.buttons === 0;
1621
}
1722

18-
/** Gets whether an event could be a faked `touchstart` event dispatched by a screen reader. */
23+
/**
24+
* Gets whether an event could be a faked `touchstart` event dispatched by a screen reader.
25+
*
26+
* 获取某个事件是否可能是屏幕阅读器派发的伪 `touchstart` 事件。
27+
*
28+
*/
1929
export function isFakeTouchstartFromScreenReader(event: TouchEvent): boolean {
2030
const touch: Touch | undefined = (event.touches && event.touches[0]) ||
2131
(event.changedTouches && event.changedTouches[0]);

src/cdk/a11y/focus-monitor/focus-monitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ export class FocusMonitor implements OnDestroy {
673673
*
674674
* @param event The blur event.
675675
*
676-
* 模糊事件
676+
* 失焦事件
677677
*
678678
* @param element The monitored element.
679679
*

src/cdk/a11y/focus-trap/focus-trap.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ import {InteractivityChecker} from '../interactivity-checker/interactivity-check
3636
* 此类当前使用相对简单的方法进行焦点捕获。它假定 tab 顺序与 DOM 顺序相同,但这不一定正确。和 `tabIndex > 0` 一样,flex `order` 和 Shadow DOM 之类的都可能导致两者未对齐。
3737
*
3838
* @deprecated Use `ConfigurableFocusTrap` instead.
39+
*
40+
* 请改用 `ConfigurableFocusTrap`。
41+
*
3942
* @breaking-change 11.0.0
4043
*/
4144
export class FocusTrap {
@@ -457,6 +460,9 @@ export class FocusTrap {
457460
* 允许轻松实例化焦点陷阱的工厂。
458461
*
459462
* @deprecated Use `ConfigurableFocusTrapFactory` instead.
463+
*
464+
* 请改用 `ConfigurableFocusTrapFactory`。
465+
*
460466
* @breaking-change 11.0.0
461467
*/
462468
@Injectable({providedIn: 'root'})
@@ -474,7 +480,7 @@ export class FocusTrapFactory {
474480
/**
475481
* Creates a focus-trapped region around the given element.
476482
*
477-
* 在指定元素周围创建一个焦点捕获 zone
483+
* 在指定元素周围创建一个焦点捕获 zone。
478484
*
479485
* @param element The element around which focus will be trapped.
480486
*

src/cdk/a11y/high-contrast-mode/high-contrast-mode-detector.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,17 @@ export const HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS = 'cdk-high-contrast-active';
6161
* Mode. This service does not detect high-contrast mode as added by the Chrome "High Contrast"
6262
* browser extension.
6363
*
64-
* 目前,IE、Edge 和 Firefox 支持此模式。 Chrome 浏览器不支持 Windows 高对比度模式。此服务无法检测到由 Chrome 的“高对比度” 扩展程序添加的高对比度模式。
64+
* 目前,IE、Edge 和 Firefox 支持此模式。Chrome 浏览器不支持 Windows 高对比度模式。此服务无法检测到由 Chrome 的“高对比度” 扩展程序添加的高对比度模式。
6565
*
6666
*/
6767
@Injectable({providedIn: 'root'})
6868
export class HighContrastModeDetector {
6969
/**
7070
* Figuring out the high contrast mode and adding the body classes can cause
7171
* some expensive layouts. This flag is used to ensure that we only do it once.
72+
*
73+
* 检测高对比度模式并添加 body 上的类可能会导致某些昂贵的布局工作。此标志用于确保我们仅执行一次。
74+
*
7275
*/
7376
private _hasCheckedHighContrastMode: boolean;
7477
private _document: Document;

src/cdk/a11y/interactivity-checker/interactivity-checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export class InteractivityChecker {
4444
/**
4545
* Gets whether an element is disabled.
4646
*
47-
* 获取元素是否被禁用
47+
* 获取元素是否已禁用
4848
*
4949
* @param element Element to be checked.
5050
*
5151
* 要检查的元素。
5252
*
5353
* @returns Whether the element is disabled.
5454
*
55-
* 元素是否被禁用
55+
* 元素是否已禁用
5656
*
5757
*/
5858
isDisabled(element: HTMLElement): boolean {
@@ -240,7 +240,7 @@ function isNativeFormElement(element: Node) {
240240
/**
241241
* Gets whether an element is an `<input type="hidden">`.
242242
*
243-
* 获取元素是否为 `&lt;input type="hidden">`
243+
* 获取元素是否为 `&lt;input type="hidden">`。
244244
*
245245
*/
246246
function isHiddenInput(element: HTMLElement): boolean {

src/cdk/a11y/key-manager/focus-key-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {FocusOrigin} from '../focus-monitor/focus-monitor';
1414
* Each item must know how to focus itself, whether or not it is currently disabled
1515
* and be able to supply its label.
1616
*
17-
* 这是可获取焦点条目的接口(由 FocusKeyManager 使用)。每个条目都必须知道如何获取焦点,无论当前是否被禁用并能提供其标签
17+
* 这是可获取焦点条目的接口(由 FocusKeyManager 使用)。每个条目都必须知道如何获取焦点,无论当前是否已禁用并能提供其标签
1818
*
1919
*/
2020
export interface FocusableOption extends ListKeyManagerOption {

src/cdk/a11y/key-manager/list-key-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface ListKeyManagerOption {
3434
/**
3535
* Whether the option is disabled.
3636
*
37-
* 该选项是否被禁用
37+
* 该选项是否已禁用
3838
*
3939
*/
4040
disabled?: boolean;

src/cdk/a11y/live-announcer/live-announcer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
See [the W3C's WAI-ARIA](https://www.w3.org/TR/wai-aria/states_and_properties#aria-live)
55
for more information on aria-live regions.
66

7-
`LiveAnnouncer` 用于通过 `aria-live` 区域为屏幕阅读器用户播报信息。关于 `aria-live` 区域的详细信息,请参见 [W3C 的 WAI-ARIA](https://www.w3.org/TR/wai-aria/states_and_properties#aria-live)
7+
`LiveAnnouncer` 用于通过 `aria-live` 区域为屏幕阅读器用户播报信息。关于 `aria-live` 区域的详细信息,请参见 [W3C 的 WAI-ARIA](https://www.w3.org/TR/wai-aria/states_and_properties#aria-live)
88

99
#### Methods
1010

0 commit comments

Comments
 (0)