new Intl.DisplayNames(locales, options) builds a helper that turns codes into human-readable names. Set options.type to "language", "region" or "currency" (and other types), then call of(code).
The locale of the DisplayNames object chooses the language of the label: English DisplayNames say "French", French DisplayNames say "anglais" for English.
Remember
new Intl.DisplayNames(locales, { type })
names.of(code)
type: "language" | "region" | "currency" | ...
of("fr") → "French" in en
Syntax
Create DisplayNames with a type, then call of with a code.
JavaScript
const languages = new Intl.DisplayNames(["en"], { type: "language" });
console.log(languages.of("fr"));
Call
What it does
new Intl.DisplayNames(["en"], { type: "language" })
The Try It page first checks that Intl.DisplayNames exists, because it is new in ES2021. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.
How It Works
Type language. Codes like "fr" and "en" are language tags.
Label locale. The constructor locale chooses English or French wording.
of(code). Returns the readable name for that code.
Example 2 — Region Names for US
Turn the region code US into a country name in English and French.
JavaScript
const en = new Intl.DisplayNames(["en"], { type: "region" });
const fr = new Intl.DisplayNames(["fr"], { type: "region" });
console.log("en: " + en.of("US"));
console.log("fr: " + fr.of("US"));
The Try It page first checks that Intl.DisplayNames exists, because it is new in ES2021. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.
How It Works
Type region. Use two-letter region codes such as "US".
Localized labels. French uses États-Unis for the same code.
UI lists. Handy for country pickers without hard-coding translations.
Example 3 — Currency Names for JPY
Show the Japanese Yen name in English and French.
JavaScript
const en = new Intl.DisplayNames(["en"], { type: "currency" });
const fr = new Intl.DisplayNames(["fr"], { type: "currency" });
console.log("en: " + en.of("JPY"));
console.log("fr: " + fr.of("JPY"));
The Try It page first checks that Intl.DisplayNames exists, because it is new in ES2021. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.
How It Works
Type currency. Pass ISO currency codes such as "JPY".
Full names. DisplayNames gives words, while NumberFormat can show symbols and amounts.
Two locales. The same code reads differently in English and French.
Compatibility
Browser & Runtime Support
Intl.DisplayNames is part of ES2021. Current browsers and Node.js 14+ support it.
✓ ES2021 · Widely supported
Intl.DisplayNames
Supported in Chrome 81+, Edge 81+, Firefox 86+, Safari 14.1+, Opera 68+ and Node.js 14+.
ES2021Standard since
Google Chrome81+ · Desktop & Mobile
Full support
Microsoft Edge81+ · Chromium based
Full support
Mozilla Firefox86+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Opera68+ · Chromium based
Full support
Samsung InternetRecent versions · Android
Supported
Android WebView81+ · Chromium based
Supported
Node.js14+ · Server runtime
Supported
DenoSupported · JavaScript runtime
Supported
BunSupported · JavaScript runtime
Supported
Internet ExplorerNo native support
Not supported
Intl.DisplayNamesExcellent
Bottom line: Safe in current browsers. Guard with typeof Intl.DisplayNames === "function" when supporting older Node or browsers.
Frequently Asked Questions
It turns codes for languages, regions, currencies and similar keys into readable names in a chosen language.
Common types are language, region and currency. Engines may also support script, calendar, dateTimeField and others.
A string display name, or undefined when nothing is available for that code.
No. DisplayNames names the currency. NumberFormat formats an amount with a currency style.
Yes on older engines. Check typeof Intl.DisplayNames === "function" before using it.