The lang read-only property of the Notification interface indicates the text direction of the notification, as specified in the lang option of the Notification() constructor.
The language itself is specified using a DOMString representing a BCP 47 language tag. See the Sitepoint ISO 2 letter language codes page for a simple reference.
var language = Notification.lang;
A DOMString specifying the language tag.
The following snippet fires a notification; a simple options object is created, then the notification is fired using the Notification() constructor.
var options = {
body: 'Do you like my body?',
lang: 'en-US'
}
var n = new Notification('Test notification',options);
n.lang // should return 'en-US' | Specification | Status | Comment |
|---|---|---|
| Notifications API The definition of 'lang' in that specification. | Living Standard | Living standard |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | ? | Yes | No | ? | ? |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | No | Yes | ? | Yes | ? | No | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Notification/lang