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

Intl.DisplayNames - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Intl.DisplayNames

Baseline

20214

Intl.DisplayNames

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

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

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

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(["zh-Hant"], { 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("zh-Hant"); // "Traditional Chinese"
languageNames.of("en-US"); // "American English"
languageNames.of("zh-TW"); // "Chinese (Taiwan)"]

// 
languageNames = new Intl.DisplayNames(["zh-Hant"], { 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(["zh-Hant"], { type: "script" });
scriptNames.of("Latn"); // ""
scriptNames.of("Arab"); // ""
scriptNames.of("Kana"); // ""

Intl.DisplayNames

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

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

ECMAScript 2027 Internationalization API Specification
# intl-displaynames-objects


Web Proxy Viewer  |  New URL  |  Original Page