Course contentsShow
← JavaScript
Lesson 2243 of 2,72346. InternationalizationFree lesson

DisplayNames for Currencies and Scripts

Format currency codes and script identifiers into their localized display names.

DisplayNames for Currencies and Scripts

What you'll learn: How to transform currency codes like "USD" and script identifiers like "Latn" into human-readable, localized names using Intl.DisplayNames.

Understanding Currency and Script Display Names

You've already seen how Intl.DisplayNames can translate language and region codes into localized names. The same API extends to currencies and scripts—two other ISO standard code systems that are much friendlier when displayed in plain language.

Currency codes (like "EUR", "JPY", "GBP") follow the ISO 4217 standard, while script identifiers (like "Cyrl" for Cyrillic, "Arab" for Arabic) follow ISO 15924. Users rarely recognize these codes, so displaying "Euro" or "Cyrillic" creates a better experience.

Formatting Currency Codes

To get localized currency names, set the type option to "currency":

const currencyNames = new Intl.DisplayNames(['en'], { type: 'currency' });

console.log(currencyNames.of('USD')); // "US Dollar"
console.log(currencyNames.of('JPY')); // "Japanese Yen"
console.log(currencyNames.of('EUR')); // "Euro"

Change the locale to see how it adapts:

const currencyNamesFr = new Intl.DisplayNames(['fr'], { type: 'currency' });
console.log(currencyNamesFr.of('USD')); // "dollar des États-Unis"

Formatting Script Identifiers

For writing systems, use type: 'script':

const scriptNames = new Intl.DisplayNames(['en'], { type: 'script' });

console.log(scriptNames.of('Latn')); // "Latin"
console.log(scriptNames.of('Cyrl')); // "Cyrillic"
console.log(scriptNames.of('Arab')); // "Arabic"

This is invaluable when building language pickers or displaying font/script options to users.

Key Takeaway: Use Intl.DisplayNames with type: 'currency' or type: 'script' to convert ISO codes into user-friendly, localized names—perfect for dropdown menus, settings panels, and internationalized UIs.