-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Conversation
Preview URLs External URLs (1)URL:
(comment last updated: 2024-11-01 09:57:22) |
|
||
在物理键盘上,`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)部分中找到。 |
There was a problem hiding this comment.
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')}} 来访问。
是否会更好些。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉和后一句就不太通顺了
Co-authored-by: A1lo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
Keyboard API
Motivation
Additional details
Related issues and pull requests
part of the #23779