Intl.NumberFormat.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 September 2017.

Intl.NumberFormat.prototype.resolvedOptions() メソッドは、この NumberFormat オブジェクトの初期化時に計算されたロケールと数値整形オプションを反映したプロパティを持つ新しいオブジェクトを返します。

試してみましょう

const numberFormat1 = new Intl.NumberFormat("de-DE");
const options1 = numberFormat1.resolvedOptions();

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

console.log(options1.numberingSystem);
// Expected output: "latn"

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

構文

numberFormat.resolvedOptions()

返値

この NumberFormat オブジェクトの初期化時に計算されたロケールと数値整形オプションを反映したプロパティを持つ新しいオブジェクトです。

解説

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

locale

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

numberingSystem

もし存在すれば、 options 引数でこのプロパティに指定された値、または Unicode 拡張キーの "nu" を使って要求された値、または既定として設定される値です。

notation

options 引数でこのプロパティに指定された値、または既定として設定される standard です。

compactDisplay

options 引数でこのプロパティに指定された値、または既定として設定される short です。

このプロパティは notation が "compact" に設定されている場合のみ存在します。

signDisplay

options 引数でこのプロパティに指定された値、または既定として設定される auto です。

useGrouping

options 引数でこのプロパティに指定された値、または既定として設定される値。

currency, currencyDisplay

options 引数でこのプロパティに指定された値、または既定として設定される値。style"currency"の場合のみ、これらのプロパティは存在しています。

次の2つのプロパティのグループのうちどちらかのみが含まれています。:

minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits

options 引数でプロパティに対して提供されるか既定で設定される値。 minimumSignificantDigits または maximumSignificantDigitsoptions 引数で提供されなかった場合のみ、これらのプロパティは存在しています。

minimumSignificantDigits, maximumSignificantDigits

options引数でプロパティに対して提供されるかデフォルトとして設定される値。 これらのプロパティのうち少なくとも1つがoptions引数で提供された場合のみ、これらのプロパティは存在しています。

resolvedOptions メソッドの使用

js
var de = new Intl.NumberFormat("de-DE");
var usedOptions = de.resolvedOptions();

usedOptions.locale; // "de-DE"
usedOptions.numberingSystem; // "latn"
usedOptions.notation; // "standard"
usedOptions.signDisplay; // "auto"
usedOption.style; // "decimal"
usedOptions.minimumIntegerDigits; // 1
usedOptions.minimumFractionDigits; // 0
usedOptions.maximumFractionDigits; // 3
usedOptions.useGrouping; // true

仕様書

Specification
ECMAScript® 2025 Internationalization API Specification
# sec-intl.numberformat.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.

関連情報