Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zh-CN]: add translation for Keyboard API #24286

Merged
merged 2 commits into from
Nov 2, 2024
Merged

Conversation

skyclouds2001
Copy link
Contributor

@skyclouds2001 skyclouds2001 commented Oct 30, 2024

Description

Keyboard API

Motivation

Additional details

Related issues and pull requests

part of the #23779

@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Oct 30, 2024
@skyclouds2001 skyclouds2001 marked this pull request as ready for review October 30, 2024 17:10
@skyclouds2001 skyclouds2001 requested a review from a team as a code owner October 30, 2024 17:10
@skyclouds2001 skyclouds2001 requested review from irvin and removed request for a team October 30, 2024 17:10
Copy link
Contributor

github-actions bot commented Oct 30, 2024

Preview URLs

External URLs (1)

URL: /zh-CN/docs/Web/API/Keyboard_API
Title: 键盘 API

(comment last updated: 2024-11-01 09:57:22)

@skyclouds2001 skyclouds2001 changed the title Add translation for Keyboard API [zh-CN]: add translation for Keyboard API Oct 31, 2024
files/zh-cn/web/api/keyboard_api/index.md Outdated Show resolved Hide resolved
files/zh-cn/web/api/keyboard_api/index.md Outdated Show resolved Hide resolved

在物理键盘上,`code` 属性包含所按下按键的物理位置,`key` 属性包含按下键盘上该物理位置的按键所生成的字符串。`key` 值考虑了键盘的语言环境(例如“en-US”)、布局(例如“QWERTY”)和修饰键状态(<kbd>Shift</kbd>、<kbd>Control</kbd>等)。过去没有办法检索这些信息。

键盘映射 API 提供了一种通过 {{domxref('Keyboard')}} 接口和 {{domxref('KeyboardLayoutMap')}} 接口检索特定按键所生成的字符串的方法。通过 {{domxref('navigator.keyboard')}} 访问 {{domxref('Keyboard')}} 接口。{{domxref('Keyboard')}} 提供 {{domxref('Keyboard.getLayoutMap')}} 方法,该方法返回一个 promise,其兑现一个 {{domxref('KeyboardLayoutMap')}} 对象,该对象包含用于将代码转换为键的成员。有效代码值列表可在 [UI 事件 KeyboardEvent 代码值](https://w3c.github.io/uievents-code/)规范的[写入系统键](https://w3c.github.io/uievents-code/#key-alphanumeric-writing-system)部分中找到。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过 {{domxref('navigator.keyboard')}} 访问 {{domxref('Keyboard')}} 接口。,考虑一下,将其翻译为

{{domxref('Keyboard')}} 接口可以通过 {{domxref('navigator.keyboard')}} 来访问。

是否会更好些。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉和后一句就不太通顺了

@skyclouds2001 skyclouds2001 requested a review from yin1999 November 1, 2024 09:56
Copy link
Member

@yin1999 yin1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@yin1999 yin1999 merged commit 3360850 into mdn:main Nov 2, 2024
7 checks passed
@skyclouds2001 skyclouds2001 deleted the keyboard-api branch November 2, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n-zh Issues related to Chinese content.
Projects
Development

Successfully merging this pull request may close these issues.

2 participants