-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
50 lines (34 loc) · 1.37 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
title: "Notification: lang property"
short-title: lang
slug: Web/API/Notification/lang
page-type: web-api-instance-property
browser-compat: api.Notification.lang
---
{{APIRef("Web Notifications")}}{{securecontext_header}} {{AvailableInWorkers}}
The **`lang`** read-only property of the
{{domxref("Notification")}} interface indicates the language used in the notification,
as specified in the `lang` option of the
{{domxref("Notification.Notification","Notification()")}} constructor.
The language itself is specified using a string representing a language tag according to {{RFC(5646, "Tags for Identifying Languages (also known as BCP 47)")}}.
See the Sitepoint [ISO 2 letter language codes](https://www.sitepoint.com/iso-2-letter-language-codes/) page for a simple reference.
## Value
A string specifying the language tag.
## Examples
The following snippet fires a notification; a simple `options` object is
created, then the notification is fired using the `Notification()`
constructor.
```js
const options = {
body: "Your code submission has received 3 new review comments.",
lang: "en-US",
};
const n = new Notification("New review activity", options);
console.log(n.lang); // "en-US"
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Using the Notifications API](/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API)