--- title: Notification.lang slug: Web/API/Notification/lang tags: - API - DOM - Notification - Notifications - Notifications API - Property - Reference - プロパティ - 通知 translation_of: Web/API/Notification/lang ---
{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}
lang は {{domxref("Notification")}} インターフェイスの読取専用プロパティで、 {{domxref("Notification.Notification","Notification()")}} コンストラクターの lang オプションで指定された通知の言語を示します。
言語自体は {{domxref("DOMString")}} で BCP 47 言語タグを表します。簡単なリファレンスとしては. Sitepoint の ISO 2 letter language codes ページを見てください。
var language = Notification.lang;
言語タグを指定する {{domxref("DOMString")}} です。
次のスニペットは通知を発行するためのものです。単純な options オブジェクトが生成され、通知が Notification() コンストラクターを使用して発行されます。
var options = {
body: 'Do you like my body?',
lang: 'en-US'
}
var n = new Notification('Test notification',options);
console.log(n.lang) // should return 'en-US'
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('Web Notifications','#dom-notification-lang','lang')}} | {{Spec2('Web Notifications')}} | Living standard |
{{Compat("api.Notification.lang")}}