Intl.Collator.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.

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

Try it

const numberDe = new Intl.NumberFormat("de-DE");
const numberAr = new Intl.NumberFormat("ar");

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

console.log(numberAr.resolvedOptions().numberingSystem);
// Expected output: "arab"

Syntax

js
resolvedOptions()

Parameters

None.

Return value

A new object with properties reflecting the options computed during the initialization of this Collator 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. Only the co, kn, and kf Unicode extension keys, if requested and supported, may be included in the output.

usage

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

sensitivity

The value provided for this property in the options argument, with default filled in as needed. It is either "base", "accent", "case", or "variant". The default is "variant" for usage "sort"; it's locale dependent for usage "search".

ignorePunctuation

The value provided for this property in the options argument, with default filled in as needed. It is a boolean. The default is true for Thai (th) and false for all other languages.

collation

The value provided for this property in the options argument, or using the Unicode extension key "co", with default filled in as needed. It is a supported collation type for this locale. The default is "default".

numeric

The value provided for this property in the options argument, or using the Unicode extension key "kn", with default filled in as needed. It is a boolean. The default is false. If the implementation does not support this Unicode extension key, this property is omitted.

caseFirst

The value provided for this property in the options argument, or using the Unicode extension key "kf", with default filled in as needed. It is either "upper", "lower", or "false". The default is "false". If the implementation does not support this Unicode extension key, this property is omitted.

Examples

Using the resolvedOptions method

js
const de = new Intl.Collator("de", { sensitivity: "base" });
const usedOptions = de.resolvedOptions();

usedOptions.locale; // "de"
usedOptions.usage; // "sort"
usedOptions.sensitivity; // "base"
usedOptions.ignorePunctuation; // false
usedOptions.collation; // "default"
usedOptions.numeric; // false

Specifications

Specification
ECMAScript® 2027 Internationalization API Specification
# sec-intl.collator.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 24 (Release date: 2013-01-10)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 29 (Release date: 2014-04-29)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 25 (Release date: 2013-02-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 56 (Release date: 2017-09-28)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1.5 (Release date: 2013-09-25)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
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 0.12 (Release date: 2015-02-06)
footnote
footnote Before version 13.0.0, only the locale data for en-US is available by default. See the Collator() 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