This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
The resolvedOptions() method of Intl.DisplayNames instances returns a new object with properties reflecting the options computed during initialization of this DisplayNames object.
resolvedOptions()
None.
A new object with properties reflecting the options computed during the initialization of this DisplayNames object. The object has the following properties, in the order they are listed:
localeThe 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.
styleThe value provided for this property in the options argument, with default filled in as needed. It is either "narrow", "short", or "long". The default is "long".
typeThe value provided for this property in the options argument. It is either "language", "region", "script", "currency", "calendar", or "dateTimeField". It is required so there is no default.
fallbackThe value provided for this property in the options argument. It is either "code" or "none". The default is "code".
languageDisplayThe value provided for this property in the options argument. It is either "dialect" or "standard". The default is "dialect".
const displayNames = new Intl.DisplayNames(["de-DE"], { type: "region" });
const usedOptions = displayNames.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.style); // "long"
console.log(usedOptions.type); // "region"
console.log(usedOptions.fallback); // "code"
const displayNames = new Intl.DisplayNames("en", {
type: "language",
languageDisplay: "standard",
});
const usedOptions = displayNames.resolvedOptions();
console.log(usedOptions.type); // "language"
console.log(usedOptions.languageDisplay); // "standard"
| 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 |
81 | 81 | 86 | 68 | 14.1 | 81 | 86 | 58 | 14.5 | 13.0 | 81 | 14.5 | 1.0.0 | 1.8 | 14.0.0 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions