[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames [Back]  [Original]

Intl.DisplayNames - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Intl.DisplayNames

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2021 4.

Intl.DisplayNames , .

In this article

const regionNamesInEnglish = new Intl.DisplayNames(["en"], { type: "region" });
const regionNamesInTraditionalChinese = new Intl.DisplayNames(["zh-Hant"], {
  type: "region",
});

console.log(regionNamesInEnglish.of("US"));
// Expected output: "United States"

console.log(regionNamesInTraditionalChinese.of("US"));
// Expected output: ""

Intl.DisplayNames()

Intl.DisplayNames .

Intl.DisplayNames.supportedLocalesOf()

, .

Intl.DisplayNames.prototype Intl.DisplayNames .

Intl.DisplayNames.prototype.constructor

. Intl.DisplayNames Intl.DisplayNames .

Intl.DisplayNames.prototype[Symbol.toStringTag]

Symbol.toStringTag "Intl.DisplayNames". Object.prototype.toString() .

Intl.DisplayNames.prototype.of()

code Intl.DisplayNames .

Intl.DisplayNames.prototype.resolvedOptions()

.

Intl.DisplayNames , .

js
//     .
let regionNames = new Intl.DisplayNames(["en"], { type: "region" });
regionNames.of("419"); // "Latin America"
regionNames.of("BZ"); // "Belize"
regionNames.of("US"); // "United States"
regionNames.of("BA"); // "Bosnia & Herzegovina"
regionNames.of("MM"); // "Myanmar (Burma)"

//     .
regionNames = new Intl.DisplayNames(["ko"], { type: "region" });
regionNames.of("419"); // " "
regionNames.of("BZ"); // ""
regionNames.of("US"); // ""
regionNames.of("BA"); // " "
regionNames.of("MM"); // ""

Intl.DisplayNames , - - .

js
//     .
let languageNames = new Intl.DisplayNames(["en"], { type: "language" });
languageNames.of("fr"); // "French"
languageNames.of("de"); // "German"
languageNames.of("fr-CA"); // "Canadian French"
languageNames.of("ko"); // "Traditional Chinese"
languageNames.of("en-US"); // "American English"
languageNames.of("zh-TW"); // "Chinese (Taiwan)"]

//     .
languageNames = new Intl.DisplayNames(["ko"], { type: "language" });
languageNames.of("fr"); // ""
languageNames.of("zh"); // ""
languageNames.of("de"); // ""

Intl.DisplayNames .

js
//      .
let scriptNames = new Intl.DisplayNames(["en"], { type: "script" });
// Get script names
scriptNames.of("Latn"); // "Latin"
scriptNames.of("Arab"); // "Arabic"
scriptNames.of("Kana"); // "Katakana"

//     .
scriptNames = new Intl.DisplayNames(["ko"], { type: "script" });
scriptNames.of("Latn"); // ""
scriptNames.of("Arab"); // " "
scriptNames.of("Kana"); // ""

Intl.DisplayNames .

js
//     .
let currencyNames = new Intl.DisplayNames(["en"], { type: "currency" });
//   
currencyNames.of("USD"); // "US Dollar"
currencyNames.of("EUR"); // "Euro"
currencyNames.of("TWD"); // "New Taiwan Dollar"
currencyNames.of("CNY"); // "Chinese Yuan"

//     .
currencyNames = new Intl.DisplayNames(["ko"], { type: "currency" });
currencyNames.of("USD"); // " "
currencyNames.of("EUR"); // ""
currencyNames.of("TWD"); // "  "
currencyNames.of("CNY"); // " "

Specification
ECMAScript 2027 Internationalization API Specification
# intl-displaynames-objects


Web Proxy Viewer  |  New URL  |  Original Page