JavaScript

Intl.DisplayNames.supportedLocalesOf() メソッド


編集:2023.01.09 by T.A.

[Edge]。→

指定のロケールの内で、対応可能なロケールを配列で返します。

構文
Intl.DisplayNames.supportedLocalesOf(locales[, options])
locales 言語タグを表す文字列、またはそのような文字列の配列。→Intl:locales

¶以下のUnicode 拡張キーの利用が可能。→Intl:Unicode 拡張

キー:
co
比較方法の変化形を表す文字列。→collation

¶指定に意味があるか不明。

options 省略可。以下のプロパティを持つオブジェクトです。
localeMatcher
ロケール照合アルゴリズムを表す文字列。値は以下の何れか。
値: 文字列
lookup
best fit (既定値)

Intl:マッチング アルゴリズム

戻り値

ロケールを表す文字列の配列。

テスト
L=['xja', 'id-u-co-pinyin', 'ja-JP'];  //xjaは存在しない。
O={localeMatcher:'lookup'};
D=Intl.DisplayNames.supportedLocalesOf(L, O);  //=[object]:id-u-co-pinyin,de-ID
	//0=[string]:id-u-co-pinyin
	//1=[string]:ja-JP

テスト