Intl

Intl.DisplayNames

Creates an Intl.DisplayNames object that enables the consistent translation of language, region, and script display names

Syntax

JavaScript
new Intl.DisplayNames(locales, options)

Parameters

ParameterTypeDescription
localesstring | string[]A BCP 47 language tag or array of tags
optionsIntl.DisplayNamesOptionsOptions: type (language, region, script, currency, calendar, dateTimeField)

Return Value

An Intl.DisplayNames object with an of() method

Examples

Basic Usage
const dn = new Intl.DisplayNames('en', { type: 'region' })
console.log(dn.of('US')) // 'United States'
console.log(dn.of('JP')) // 'Japan'
Practical Example
const dn = new Intl.DisplayNames('en', { type: 'language' })
console.log(dn.of('fr')) // 'French'
console.log(dn.of('zh-Hans')) // 'Simplified Chinese'
Advanced Usage
const dn = new Intl.DisplayNames('en', { type: 'currency' })
console.log(dn.of('USD')) // 'US Dollar'
console.log(dn.of('EUR')) // 'Euro'
console.log(dn.of('JPY')) // 'Japanese Yen'

Understanding Intl.DisplayNames

The Intl.DisplayNames method in JavaScript creates an Intl.DisplayNames object that enables the consistent translation of language, region, and script display names. It belongs to the Intl object and is one of the most widely used methods for working with intl values in modern JavaScript and TypeScript applications.

The method signature is new Intl.DisplayNames(locales, options). It accepts 2 parameters: locales, options. When called, it returns an intl.displaynames object with an of() method. Understanding when and how to use DisplayNames() helps you write more expressive, readable code.

Common use cases for Intl.DisplayNames include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like intl-numberformat, intl-datetimeformat, intl-listformat, enabling you to chain operations together for complex data manipulation pipelines.

Supported in Chrome 81+, Firefox 86+, Safari 14.1+, Edge 81+.

Browser Compatibility

Supported in Chrome 81+, Firefox 86+, Safari 14.1+, Edge 81+.

Related Methods

More Intl Methods

Other methods in the Intl object

Related Tools

More Intl Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.