From e1c29cf4a9b944e095b6f03c8677d089aab0caa6 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 12 Sep 2021 22:33:19 +0900 Subject: Global_Objects/Intl/DisplayNames 以下を更新 (#2325) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Markdown に変換 - 2021/09/03 時点の英語版に同期 - コンストラクターやメソッドのリファレンスは新規翻訳 --- .../intl/displaynames/displaynames/index.md | 103 +++++++++++++++ .../global_objects/intl/displaynames/index.html | 146 --------------------- .../global_objects/intl/displaynames/index.md | 134 +++++++++++++++++++ .../global_objects/intl/displaynames/of/index.md | 70 ++++++++++ .../intl/displaynames/resolvedoptions/index.md | 67 ++++++++++ .../intl/displaynames/supportedlocalesof/index.md | 68 ++++++++++ 6 files changed, 442 insertions(+), 146 deletions(-) create mode 100644 files/ja/web/javascript/reference/global_objects/intl/displaynames/displaynames/index.md delete mode 100644 files/ja/web/javascript/reference/global_objects/intl/displaynames/index.html create mode 100644 files/ja/web/javascript/reference/global_objects/intl/displaynames/index.md create mode 100644 files/ja/web/javascript/reference/global_objects/intl/displaynames/of/index.md create mode 100644 files/ja/web/javascript/reference/global_objects/intl/displaynames/resolvedoptions/index.md create mode 100644 files/ja/web/javascript/reference/global_objects/intl/displaynames/supportedlocalesof/index.md (limited to 'files') diff --git a/files/ja/web/javascript/reference/global_objects/intl/displaynames/displaynames/index.md b/files/ja/web/javascript/reference/global_objects/intl/displaynames/displaynames/index.md new file mode 100644 index 0000000000..219d5331ee --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/displaynames/displaynames/index.md @@ -0,0 +1,103 @@ +--- +title: Intl.DisplayNames() コンストラクター +slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames +tags: + - Constructor + - DisplayNames + - Internationalization + - Intl + - JavaScript + - Localization + - Reference +browser-compat: javascript.builtins.Intl.DisplayNames.DisplayNames +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames +--- +{{JSRef}} + +**`Intl.DisplayNames()`** コンストラクターは、言語、地域、文字体系の表示名の一貫した翻訳を可能にする {{jsxref("Intl/DisplayNames", "Intl.DisplayNames")}} オブジェクトを生成します。 + +{{EmbedInteractiveExample("pages/js/intl-displaynames.html")}} + + + +## 構文 + +```js +new Intl.DisplayNames() +new Intl.DisplayNames(locales) +new Intl.DisplayNames(locales, options) +``` + +### 引数 + +- `locales` {{optional_inline}} + + - : BCP 47 言語タグの文字列、または、そのような文字列の配列です。 `locales` 引数の一般的な形式と解釈は、 {{jsxref("Global_Objects/Intl", "Intl", "#Locale_identification_and_negotiation", 1)}} のページをご覧ください。次の Unicode 拡張キーが利用できます。 + + - `nu` + - : 使用する数値書式です。 + "`arab`", "`arabext`", "`bali`", + "`beng`", "`deva`", "`fullwide`", + "`gujr`", "`guru`", "`hanidec`", + "`khmr`", "`knda`", "`laoo`", + "`latn`", "`limb`", "`mlym`", + "`mong`", "`mymr`", "`orya`", + "`tamldec`", "`telu`", "`thai`", + "`tibt`" です。 + +- `options` {{optional_inline}} + + - : 以下のプロパティの一部またはすべてを持つオブジェクトです。 + + - `localeMatcher` + - : 使用するロケール照合アルゴリズムです。利用可能な値は、 + "`lookup`" と "`best fit`" です。既定値は + "`best fit`" です。このオプションについての情報は、 + {{jsxref("Global_Objects/Intl", "Intl", "#Locale_negotiation", 1)}} ページを参照してください。 + - `style` + + - : 使用する書式化スタイルです。既定値は "`long`" です。 + + - "`narrow`" + - "`short`" + - "`long`" + + - `type` + + - : 使用する種類です。 + + - "`language`" + - "`region`" + - "`script`" + - "`currency`" + + - `fallback` + + - : 使用する代替法です。既定値は "`code`" です。 + + - "`code`" + - "`none`" + +## 例 + +### 基本的な使用法 + +ロケールを指定しない基本的な使用法では、既定のロケールと既定のオプションで書式化された文字列が返されます。 + +```js +console.log((new Intl.DisplayNames([], {type: 'language'})).of('US')); +// 期待される出力: 'us' +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{jsxref("Intl.DisplayNames")}} +- {{jsxref("Global_Objects/Intl", "Intl")}} diff --git a/files/ja/web/javascript/reference/global_objects/intl/displaynames/index.html b/files/ja/web/javascript/reference/global_objects/intl/displaynames/index.html deleted file mode 100644 index f27a416cf6..0000000000 --- a/files/ja/web/javascript/reference/global_objects/intl/displaynames/index.html +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: Intl.DisplayNames -slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames -tags: - - Class - - DisplayNames - - Internationalization - - Intl - - JavaScript - - Reference -translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames ---- -
{{JSRef}}
- -

Intl.DisplayNames オブジェクトは、言語、地域、文字体系の表示名の一貫した翻訳を可能にするオブジェクトのコンストラクターです。

- -
{{EmbedInteractiveExample("pages/js/intl-displaynames.html")}}
- - - -

コンストラクター

- -
-
{{jsxref("Intl/DisplayNames/DisplayNames", "Intl.DisplayNames()")}}
-
Intl.DisplayNames オブジェクトを作成します。
-
- -

静的メソッド

- -
-
{{jsxref("Intl/DisplayNames/supportedLocalesOf", "Intl.DisplayNames.supportedLocalesOf()")}}
-
提供されたロケールのうち、ランタイムのデフォルトロケールにフォールバックすることなくサポートされているロケールを含む配列を返します。
-
- -

インスタンスメソッド

- -
-
{{jsxref("Intl/DisplayNames/of", "Intl.DisplayNames.prototype.of()")}}
-
このメソッドは code を受け取り、Intl.DisplayNames をインスタンス化したときに指定したロケールとオプションに基づく文字列を返します。
-
{{jsxref("Intl/DisplayNames/resolvedOptions", "Intl.DisplayNames.prototype.resolvedOptions()")}}
-
オブジェクトの初期化時に計算されたロケールや書式設定のオプションを反映したプロパティを持つ新しいオブジェクトを返します。
-
- -

- -

国 (地域) の表示名

- -

ロケールを指定した Intl.DisplayNames を作成し、国 (地域) コードの表示名を取得する方法です。

- -
// 英語の地域名を表示
-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 を作成し、言語-文字体系-国 (地域) の一連の表示名を取得する方法です。

- -
// 英語の言語名を表示
-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 を作成し、文字体系の表示名を取得する方法です。

- -
// 英語の文字体系名を表示
-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 を作成し、通貨の表示名を取得する方法です。

- -
// 英語の通貨名を表示
-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'); // "人民幣"
- -

仕様書

- - - - - - - - - - - - -
仕様書
{{SpecName('Intl.DisplayNames', '#intl-displaynames-objects', 'DisplayNames')}}
- -

ブラウザーの互換性

- -
-

{{Compat("javascript.builtins.Intl.DisplayNames")}}

-
- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/intl/displaynames/index.md b/files/ja/web/javascript/reference/global_objects/intl/displaynames/index.md new file mode 100644 index 0000000000..897db00357 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/displaynames/index.md @@ -0,0 +1,134 @@ +--- +title: Intl.DisplayNames +slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames +tags: + - Class + - DisplayNames + - Internationalization + - Intl + - JavaScript + - Localization + - Reference +browser-compat: javascript.builtins.Intl.DisplayNames +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames +--- +{{JSRef}} + +**`Intl.DisplayNames`** オブジェクトは、言語、地域、文字体系の表示名の一貫した翻訳を可能にします。 + +{{EmbedInteractiveExample("pages/js/intl-displaynames.html")}} + + +## コンストラクター + +- {{jsxref("Intl/DisplayNames/DisplayNames", "Intl.DisplayNames()")}} + - : `Intl.DisplayNames` オブジェクトを作成します。 + +## 静的メソッド + +- {{jsxref("Intl/DisplayNames/supportedLocalesOf", "Intl.DisplayNames.supportedLocalesOf()")}} + - : 提供されたロケールのうち、ランタイムの既定のロケールに代替されることなく対応しているロケールを含む配列を返します。 + +## インスタンスメソッド + +- {{jsxref("Intl/DisplayNames/of", "Intl.DisplayNames.prototype.of()")}} + - : このメソッドは `code` を受け取り、`Intl.DisplayNames` をインスタンス化したときに指定したロケールとオプションに基づく文字列を返します。 +- {{jsxref("Intl/DisplayNames/resolvedOptions", "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'); // "人民幣" +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{jsxref("Intl")}} diff --git a/files/ja/web/javascript/reference/global_objects/intl/displaynames/of/index.md b/files/ja/web/javascript/reference/global_objects/intl/displaynames/of/index.md new file mode 100644 index 0000000000..c0598c51be --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/displaynames/of/index.md @@ -0,0 +1,70 @@ +--- +title: Intl.DisplayNames.prototype.of() +slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of +tags: + - DisplayNames + - Internationalization + - Intl + - JavaScript + - Localization + - Method + - Prototype + - Reference +browser-compat: javascript.builtins.Intl.DisplayNames.of +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of +--- +{{JSRef}} + +**`Intl.DisplayNames.prototype.of()`** メソッドは、コードを受け取り、Intl.DisplayNames をインスタンス化するときに指定されたロケールとオプションに基づいて文字列を返します。 + +{{EmbedInteractiveExample("pages/js/intl-displaynames.html")}} + + + +## 構文 + +```js +of(code) +``` + +### 引数 + +- `code` + + - : 与える `code` は、 `type` によって変わります。 + + - type が "region" である場合、コードは [ISO-3166 地域の 2 文字コード](https://www.iso.org/iso-3166-country-codes.html)または [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/) である必要があります。 + - type が "script" である場合、コードは [ISO-15924 文字体系の 4 文字コード](https://unicode.org/iso15924/iso15924-codes.html)である必要があります。 + - type が "language" である場合、コードは _languageCode_ \["-" _scriptCode_] \["-" _regionCode_ ] \*("-" _variant_ ) の形である必要があり、これは [UTS 35's Unicode Language and Locale Identifiers grammar](https://unicode.org/reports/tr35/#Unicode_language_identifier) の unicode_language_id の構文です。 _languageCode_ は 2 文字の ISO 639-1 言語コードまたは 3 文字の ISO 639-2 言語コードです。 + - type が "currency" である場合、コードは [3 文字の ISO 4217 通貨コード](https://www.iso.org/iso-4217-currency-codes.html)である必要があります。 + +### 返値 + +その言語における書式化された文字列です。 + +## 例 + +### of メソッドの使用 + +```js +let regionNames = new Intl.DisplayNames(['en'], {type: 'region'}); +regionNames.of('419'); // "Latin America" + +let languageNames = new Intl.DisplayNames(['en'], {type: 'language'}); +languageNames.of('fr'); // "French" + +let currencyNames = new Intl.DisplayNames(['en'], {type: 'currency'}); +currencyNames.of('EUR'); // "Euro" +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{jsxref("Intl.DisplayNames")}} diff --git a/files/ja/web/javascript/reference/global_objects/intl/displaynames/resolvedoptions/index.md b/files/ja/web/javascript/reference/global_objects/intl/displaynames/resolvedoptions/index.md new file mode 100644 index 0000000000..8f7593317a --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/displaynames/resolvedoptions/index.md @@ -0,0 +1,67 @@ +--- +title: Intl.DisplayNames.prototype.resolvedOptions() +slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions +tags: + - DisplayNames + - Internationalization + - Intl + - JavaScript + - Localization + - Method + - Prototype + - Reference +browser-compat: javascript.builtins.Intl.DisplayNames.resolvedOptions +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions +--- +{{JSRef}} + +**`Intl.DisplayNames.prototype.resolvedOptions()`** メソッドは、現在の {{jsxref("Intl.DisplayNames")}} オブジェクトの初期化時に計算されたロケールとスタイルの書式オプションを反映したプロパティを持つ新しいオブジェクトを返します。 + +## 構文 + +```js +resolvedOptions() +``` + +### 返値 + +この {{jsxref("Intl.DisplayNames")}} オブジェクトの初期化時に計算されたロケールと書式オプションを反映したプロパティを持つ新しいオブジェクトです。 + +## 解説 + +`resolvedOptions()` で返されるオブジェクトには、以下のプロパティがあります。 + +- `locale` + - : このロケールで実際に使用する BCP 47 言語タグです。入力されこのロケールに導いた BCP 47 言語タグで Unicode 拡張値が要求されていた場合、要求されたキーと値の組のうち、このロケールで対応しているものが `locale` に含まれます。 +- `style` + - : コンストラクターの `options` 引数でこのプロパティに与えられた値、または既定値 ("`long`") です。値は "`long`"、"`short`"、"`narrow`" のいずれかです。 +- `type` + - : コンストラクターの `options` 引数でこのプロパティに与えられた値、または既定値 ("`language`") です。値は "`language`"、"`region`"、"`script`"、"`currency`" のいずれかです。 +- `fallback` + - : コンストラクターの `options` 引数でこのプロパティに与えられた値、または既定値 ("`code`") です。値は "`code`" または "`none`" のどちらかです。 + +## 例 + +### resolvedOptions の使用 + +```js +const displayNames = new Intl.DisplayNames(['de-DE'], {type: 'region'}); + +const usedOptions = displayNames.resolvedOptions(); +console.log(usedOptions.locale); // "de-DE" +console.log(usedOptions.style); // "long" +console.log(usedOptions.type); // "region" +console.log(usedOptions.fallback); // "code" +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{jsxref("Intl.DisplayNames")}} diff --git a/files/ja/web/javascript/reference/global_objects/intl/displaynames/supportedlocalesof/index.md b/files/ja/web/javascript/reference/global_objects/intl/displaynames/supportedlocalesof/index.md new file mode 100644 index 0000000000..5732a9f737 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/displaynames/supportedlocalesof/index.md @@ -0,0 +1,68 @@ +--- +title: Intl.DisplayNames.supportedLocalesOf() +slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf +tags: + - DisplayNames + - Internationalization + - Intl + - JavaScript + - Localization + - Method + - Reference +browser-compat: javascript.builtins.Intl.DisplayNames.supportedLocalesOf +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf +--- +{{JSRef}} + +**`Intl.DisplayNames.supportedLocalesOf()`** メソッドは、指定されたロケールのうち、ランタイムの既定のロケールで代替せずに表示名に対応しているものの配列を返します。 + +## 構文 + +```js +Intl.DisplayNames.supportedLocalesOf(locales) +Intl.DisplayNames.supportedLocalesOf(locales, options) +``` + +### 引数 + +- `locales` + - : BCP 47 言語タグを持つ文字列、またはそのような文字列の配列です。 `locales` 引数の一般的な形式については、 {{jsxref("Intl", "Intl", "#Locale_identification_and_negotiation", 1)}} のページを参照してください。 +- `options` {{optional_inline}} + + - : 以下のプロパティを持つオブジェクトです。 + + - `localeMatcher` + - : 使用するロケール照合アルゴリズムです。指定可能な値は "`lookup`" および "`best fit`" で、既定値は "`best fit`" です。このオプションの詳細は、 {{jsxref("Intl", "Intl", "#Locale_negotiation", 1)}} のページを参照してください。 + +### 返値 + +指定したロケールタグうち、ランタイムの既定のロケールで代替せずに表示名に対応しているものを表す文字列の配列です。 + +## 解説 + +`locales` で指定された言語タグのサブセットが入った配列を返します。返される言語タグは、表示名について、使用するロケール照合アルゴリズムで一致しているとみなされ、ランタイムが既定のロケールで代替することなく対応しているものです。 + +## 例 + +### supportedLocalesOf() の使用 + +表示名についてインドネシア語とドイツ語に対応しているが、バリ語に対応していないランタイムを想定した場合、 `supportedLocalesOf` はインドネシア語とドイツ語の言語タグを変更せずに返しますが、 `pinyin` の照合は表示名には関係なく、インドネシア語では使用されません。これは "`lookup`" アルゴリズムの仕様であることに注意してください。 "`best fit`" で照合すると、バリ語の話者のほとんどはインドネシア語も理解しているので、インドネシア語がバリ語に適切に一致すると判断し、バリ語の言語タグも返すかもしれません。 + +```js +const locales = ['ban', 'id-u-co-pinyin', 'de-ID']; +const options = { localeMatcher: 'lookup' }; +console.log(Intl.DisplayNames.supportedLocalesOf(locales, options).join(', ')); +// → "id-u-co-pinyin, de-ID" +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{jsxref("Intl.DisplayNames")}} -- cgit v1.2.3-54-g00ecf