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]: sync translation for Notifications API & Battery Status API #23615

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
skyclouds2001 committed Sep 18, 2024
commit af9727e99358a22b5665675a450d93e93f80376a
50 changes: 25 additions & 25 deletions files/zh-cn/web/api/notification/notification/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Notification:Notification() 构造函数
slug: Web/API/Notification/Notification
l10n:
sourceCommit: e011d5695b264ced5a3f4bb822ca7904e23b7e83
sourceCommit: 09ad551d5fecae5872328ece2871fdf02b115b6e
---

{{APIRef("Web Notifications")}}{{securecontext_header}} {{AvailableInWorkers}}
Expand All @@ -27,30 +27,6 @@ new Notification(title, options)

- : 一个包含要应用于通知的任何自定义设置的选项对象。可能的选项有:

- `dir` {{optional_inline}}
- : 显示通知的方向。它默认为 `auto`,即只采用浏览器的语言设置行为,但你可以通过设置 `ltr` 和 `rtl` 的值来覆盖该行为(尽管大多数浏览器似乎忽略这些设置)。
- `lang` {{optional_inline}}
- : 指定通知的语言,根据 {{RFC(5646, "识别语言的标签(也被称为 BCP47)")}}使用表示语言标签的字符串指定。请参阅 Sitepoint [ISO 2 字母语言代码](https://www.sitepoint.com/iso-2-letter-language-codes/)页面以获取简单参考。
- `badge` {{optional_inline}}
- : 一个包含图像 URL 的字符串,用于在没有足够空间显示通知本身时表示通知。
- `body` {{optional_inline}}
- : 一个表示通知正���的字符串,显示在标题下方,默认值是一个空字符串。
- `tag` {{optional_inline}}
- : 一个表示通知的识别标签的字符串,默认值是一个空字符串。
- `icon` {{optional_inline}}
- : 一个包含要在通知中显示的图标的 URL 的字符串。
- `image` {{optional_inline}}
- : 一个包含要在通知中显示的图像的 URL 的字符串。
- `data` {{optional_inline}}
- : 任意你想要与通知关联的数据。它可以是任何数据类型。默认值为 `null`。
- `vibrate` {{optional_inline}}
- : 设备振动硬件随通知一起发出的[振动模式](/zh-CN/docs/Web/API/Vibration_API#振动模式)。当该值被指定时,`silent` 参数不得设置为 `true`。
- `timestamp` {{optional_inline}}
- : 一个表示通知创建或适用的时间(过去、现在或将来)的数字。
- `renotify` {{optional_inline}}
- : 一个布尔值,指定在新通知替换旧通知后是否应通知用户。默认值为 `false`,这意味着他们不会收到通知。如果该值被指定为 `true`,那么必须同时设置 `tag` 参数。
- `requireInteraction` {{optional_inline}}
- : 指示通知应保持活动状态,直到用户单击或关闭它,而不是自动关闭。默认值为 `false`。
- `actions` {{optional_inline}}

- : 要在通知中显示的一系列操作的数组,默认为一个空数组。数组中的每个元素都是一个具有以下成员的对象:
Expand All @@ -64,8 +40,32 @@ new Notification(title, options)

使用 {{domxref("ServiceWorkerGlobalScope.notificationclick_event", "notificationclick")}} 事件中的 `event.action` 构建适当的响应。

- `badge` {{optional_inline}}
- : 一个包含图像 URL 的字符串,用于在没有足够空间显示通知本身时表示通知。
- `body` {{optional_inline}}
- : 一个表示通知正文的字符串,显示在标题下方,默认值是一个空字符串。
- `data` {{optional_inline}}
- : 任意你想���与通知关联的数据。它可以是任何数据类型。默认值为 `null`。
- `dir` {{optional_inline}}
- : 显示通知的方向。它默认为 `auto`,即只采用浏览器的语言设置行为,但你可以通过设置 `ltr` 和 `rtl` 的值来覆盖该行为(尽管大多数浏览器似乎忽略这些设置)。
- `icon` {{optional_inline}}
- : 一个包含要在通知中显示的图标的 URL 的字符串。
- `image` {{optional_inline}}
- : 一个包含要在通知中显示的图像的 URL 的字符串。
- `lang` {{optional_inline}}
- : 指定通知的语言,根据 {{RFC(5646, "识别语言的标签(也被称为 BCP47)")}}使用表示语言标签的字符串指定。请参阅 Sitepoint [ISO 2 字母语言代码](https://www.sitepoint.com/iso-2-letter-language-codes/)页面以获取简单参考。
- `renotify` {{optional_inline}}
- : 一个布尔值,指定在新通知替换旧通知后是否应通知用户。默认值为 `false`,这意味着他们不会收到通知。如果该值被指定为 `true`,那么必须同时设置 `tag` 参数。
- `requireInteraction` {{optional_inline}}
- : 指示通知应保持活动状态,直到用户单击或关闭它,而不是自动关闭。默认值为 `false`。
- `silent` {{optional_inline}}
- : 一个布尔值,指定通知是否静音(不发出声音或振动),无论设备设置如何。默认值 `null` 表示使用设备默认值。如果被设置为 `true`,那么不能同时存在 `vibrate` 参数。
- `tag` {{optional_inline}}
- : 一个表示通知的识别标签的字符串,默认值是一个空字符串。
- `timestamp` {{optional_inline}}
- : 一个表示通知创建或适用的时间(过去、现在或将来)的数字。
- `vibrate` {{optional_inline}}
- : 设备振动硬件随通知一起发出的[振动模式](/zh-CN/docs/Web/API/Vibration_API#振动模式)。当该值被指定时,`silent` 参数不得设置为 `true`。

### 返回值

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Notification:requestPermission() 静态方法
slug: Web/API/Notification/requestPermission_static
l10n:
sourceCommit: 1d32183ba01cac6355135962686935e092f0251b
sourceCommit: 09ad551d5fecae5872328ece2871fdf02b115b6e
---

{{APIRef("Web Notifications")}}{{securecontext_header}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 使用 Notifications API
slug: Web/API/Notifications_API/Using_the_Notifications_API
l10n:
sourceCommit: aa8fa82a902746b0bd97839180fc2b5397088140
sourceCommit: 83ec73ac6fec9cae23c54b729e6481f50a0a45e7
---

{{DefaultAPISidebar("Web Notifications")}}{{securecontext_header}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ServiceWorkerRegistration:showNotification() 方法
slug: Web/API/ServiceWorkerRegistration/showNotification
l10n:
sourceCommit: 4de6f76bbfd76229db78ffb7d52cf6b4cb9f31f8
sourceCommit: 09ad551d5fecae5872328ece2871fdf02b115b6e
---

{{APIRef("Web Notifications")}}{{SecureContext_Header}} {{AvailableInWorkers}}
Expand Down