Notification.lang

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

メモ: この機能はウェブワーカー内で利用可能です。

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

langNotification インターフェイスの読み取り専用プロパティで、 Notification() コンストラクターの lang オプションで指定された通知の言語を示します。

言語自体は文字列でRFC 5646: 言語識別タグ (BCP 47) を表します。簡単なリファレンスとしては、 Sitepoint の ISO 2 letter language codes ページを見てください。

文字列で、言語タグを指定します。

次のスニペットは通知を発行するためのものです。単純な options オブジェクトが生成され、通知が Notification() コンストラクターを使用して発行されます。

js
const options = {
  body: "Do you like my body?",
  lang: "en-US",
};

const n = new Notification("Test notification", options);

console.log(n.lang); // should return 'en-US'

仕様書

Specification
Notifications API
# dom-notification-lang

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
lang

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

関連情報