Intl.ListFormat.prototype.resolvedOptions()

Baseline Widely available

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

Intl.ListFormat.prototype.resolvedOptions() メソッドは、現在の Intl.ListFormat オブジェクトの構築時に計算されたロケールとスタイル整形オプションを反映したプロパティを持つ新しいオブジェクトを返します。

試してみましょう

const deListFormatter1 = new Intl.ListFormat("de-DE", { type: "disjunction" });
const options1 = deListFormatter1.resolvedOptions();

console.log(options1.locale);
// Expected output (Firefox / Safari): "de-DE"
// Expected output (Chrome): "de"

console.log(options1.style);
// Expected output: "long"

console.log(options1.type);
// Expected output: "disjunction"

構文

js
listFormat.resolvedOptions();

返値

指定された Intl.ListFormat オブジェクトの構築時に計算されたロケールと整形オプションを反映したプロパティを持つオブジェクトです。

解説

resolvedOptions() から返されるオブジェクトには、以下のプロパティがあります。

locale

実際に使用したロケールの BCP 47 言語タグ。このロケールにつながる入力 BCP 47 言語タグに Unicode 拡張値が要求された場合、要求されたキーと値のペアのうち、このロケールで対応しているものが locale に含まれます。

style

コンストラクターの options 引数の中でこのプロパティに指定された値、または既定値 ("long") がです。この値は、"long"、"short"、"narrow" のいずれかです。

type

コンストラクターの options 引数の中でこのプロパティに指定された値、または既定値 ("conjunction") がです。この値は、"conjunction"、"disjunction"、"unit" のいずれかです。

resolvedOptions の使用

js
const deListFormatter = new Intl.ListFormat("de-DE", { style: "short" });

const usedOptions = de.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.style); // "short"
console.log(usedOptions.type); // "conjunction" (the default value)

仕様書

Specification
ECMAScript® 2025 Internationalization API Specification
# sec-Intl.ListFormat.prototype.resolvedoptions

ブラウザーの互換性

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
resolvedOptions

Legend

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

Full support
Full support
See implementation notes.

関連情報