Intl.Locale.prototype.region

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2020.

Intl.Locale.prototype.region プロパティは、ロケールに関連付けられた世界の地域(ふつうは国)を返すアクセサープロパティです。

解説

地域は、ロケールを世界の特定の地域に位置づけるための、ロケール識別子の重要な要素となります。ロケールの地域を知ることは、ロケール間の違いを識別する上で非常に重要です。たとえば、イギリスとアメリカ合衆国では英語が使われていますが、両国間では綴りやその他の言語の慣習に違いがあります。ロケールの地域を知ることで、 JavaScript プログラマーがサイトやアプリケーションのコンテンツを世界の様々な地域から見たときに正しく表示されるようにするのに役立ちます。

ロケール識別子の文字列引数で地域を設定

地域は、有効な Unicode 言語識別子文字列の 3 番目の部分であり、これを Locale コンストラクターに渡すロケール識別子文字列に追加することで設定することができます。なお、地域はロケール識別子の必須項目ではありません。

js
let locale = new Intl.Locale("en-Latn-US");
console.log(locale.region); // "US" と表示

構成オブジェクトから地域を設定

Locale コンストラクターは構成オブジェクトを取り、これを用いて地域のサブタグとプロパティを設定することができます。

js
let locale = new Intl.Locale("ja-Jpan", { region: "JP" });
console.log(locale.region); // "JP" と表示

仕様書

Specification
ECMAScript® 2025 Internationalization API Specification
# sec-Intl.Locale.prototype.region

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
region

Legend

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

Full support
Full support

関連情報