CKTIS / JavaScript
Intl.DisplayNames — localized names for codes
Intl.DisplayNames turns language, region, and other category codes into display names using the locale resolved by the runtime. Learn the required type, missing-name handling, and the distinction between an input code and the output locale.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
new Intl.DisplayNames(locales, { type, style, fallback, languageDisplay }).of(code)Intl.DisplayNames belongs to ECMA-402, not the DOM API. It produces names for user interfaces rather than translating arbitrary text. In new Intl.DisplayNames("pl", { type: "region" }), "pl" requests the Polish locale. The runtime matches the request against its available locales, so the formatter can resolve to a different locale and Polish output is not guaranteed. The argument to .of("US") identifies the region to name. The constructor requires new and the type option.
type accepts "language", "region", "script", "currency", "calendar", or "dateTimeField". style selects name length: "long" (default), "short", or "narrow"; these variants need not differ. For "language", the languageDisplay option selects "dialect" (default) or "standard".
.of(code) returns a name. If a structurally valid code has no available name, fallback: "code" (default) returns the normalized code, whereas fallback: "none" returns undefined. A structurally invalid code throws RangeError regardless of fallback; "USA" is not a valid code for "region".
resolvedOptions() exposes the effective settings, including the resolved locale in its locale property. Exact names depend on the runtime's locale data, so do not treat them as stable identifiers. Check Intl.DisplayNames availability in the target runtime; its presence in Node 24 does not establish browser support.
Examples
const names = new Intl.DisplayNames("en", { type: "region" });
console.log(typeof names.of("US"));
console.log(names.resolvedOptions().type);
try {
names.of("USA");
} catch (error) {
console.log(error.name);
}Result
string region RangeError
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.