Intl.PluralRules.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 2019.

The resolvedOptions() method of Intl.PluralRules instances returns a new object with properties reflecting the options computed during initialization of this PluralRules object.

Try it

const pluralRules1 = new Intl.PluralRules("uk");
const options1 = pluralRules1.resolvedOptions();

const pluralRules2 = new Intl.PluralRules("bn");
const options2 = pluralRules2.resolvedOptions();

console.log(options1.pluralCategories);
// Expected output: Array ["few", "many", "one", "other"]

console.log(options2.pluralCategories);
// Expected output: Array ["one", "other"]

Syntax

js
resolvedOptions()

Parameters

None.

Return value

A new object with properties reflecting the options computed during the initialization of this PluralRules object. The object has the following properties, in the order they are listed:

locale

The BCP 47 language tag for the locale actually used, determined by the locale negotiation process. No Unicode extension key will be included in the output.

type

The value provided for this property in the options argument, with default filled in as needed. It is either "cardinal" or "ordinal". The default is "cardinal".

minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits Optional

The value provided for these properties in the options argument, with defaults filled in as needed. These properties are present only if neither minimumSignificantDigits nor maximumSignificantDigits was provided in the options argument.

minimumSignificantDigits, maximumSignificantDigits Optional

The value provided for these properties in the options argument, with defaults filled in as needed. These properties are present only if at least one of them was provided in the options argument.

pluralCategories

An Array of plural categories used by the given locale, selected from the list "zero", "one", "two", "few", "many" and "other".

roundingIncrement

The value provided for this property in the options argument, with default filled in as needed. It is one of 1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, and 5000. The default is 1.

roundingMode

The value provided for this property in the options argument, with default filled in as needed. It is one of "ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", and "halfEven". The default is "halfExpand".

roundingPriority

The value provided for this property in the options argument, with default filled in as needed. It is either "auto", "morePrecision", or "lessPrecision". The default is "auto".

trailingZeroDisplay

The value provided for this property in the options argument, with default filled in as needed. It is either "auto" or "stripIfInteger". The default is "auto".

Examples

Using the resolvedOptions() method

The code below shows the construction of a PluralRules object, followed by logging of each of the resolved options.

js
// Create a PluralRules instance
const de = new Intl.PluralRules("de-DE", {
  maximumSignificantDigits: 2,
  trailingZeroDisplay: "auto",
});

// Resolve the options
const usedOptions = de.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.pluralCategories); // Array ["one", "other"]
console.log(usedOptions.type); // "cardinal"
console.log(usedOptions.minimumIntegerDigits); // 1
console.log(usedOptions.minimumFractionDigits); // undefined (maximumSignificantDigits is set)
console.log(usedOptions.maximumFractionDigits); // undefined (maximumSignificantDigits is set)
console.log(usedOptions.minimumSignificantDigits); // 1
console.log(usedOptions.maximumSignificantDigits); // 2
console.log(usedOptions.roundingIncrement); // 1
console.log(usedOptions.roundingMode); // "halfExpand"
console.log(usedOptions.roundingPriority); // "auto"
console.log(usedOptions.trailingZeroDisplay); // "auto"

Specifications

Specification
ECMAScript® 2027 Internationalization API Specification
# sec-intl.pluralrules.prototype.resolvedoptions

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
resolvedOptions
Chrome – Full support
Chrome 63 (Release date: 2017-12-06)
footnote Full support
Edge – Full support
Edge 18 (Release date: 2018-10-02)
footnote Full support
Firefox – Full support
Firefox 58 (Release date: 2018-01-23)
footnote Full support
Opera – Full support
Opera 50 (Release date: 2018-01-04)
footnote Full support
Safari – Full support
Safari 13 (Release date: 2019-09-19)
footnote Full support
Chrome Android – Full support
Chrome Android 63 (Release date: 2017-12-05)
footnote Full support
Firefox for Android – Full support
Firefox for Android 58 (Release date: 2018-01-22)
footnote Full support
Opera Android – Full support
Opera Android 46 (Release date: 2018-05-14)
footnote Full support
Safari on iOS – Full support
Safari on iOS 13 (Release date: 2019-09-19)
footnote Full support
Samsung Internet – Full support
Samsung Internet 8 (Release date: 2018-07-18)
footnote Full support
WebView Android – Full support
WebView Android 63 (Release date: 2017-12-05)
footnote Full support
WebView on iOS – Full support
WebView on iOS 13 (Release date: 2019-09-19)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.8 (Release date: 2021-03-02)
footnote Full support
Node.js – Full support
Node.js 10 (Release date: 2018-04-24)
footnote
footnote Before version 13.0.0, only the locale data for en-US is available by default. See the PluralRules() constructor for more details.

Legend

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

Full support
Full support
See implementation notes.

See also