JavaScript

Intl.NumberFormat.supportedLocalesOf() メソッド


編集:2023.01.11 by T.A.

[Edge]。→

数値の書式化で、指定されたロケールのサブ タグで対応する物を表す文字列を配列で返します。

構文
Intl.NumberFormat.supportedLocalesOf(locales[, options])
locales 言語タグを持つ文字列、またはそのような文字列の配列。→Intl:locales
options 省略可。以下のプロパティを持つオブジェクト。
localeMatcher
使用するロケールの一致アルゴリズムを示す文字列。値:
lookup
best fit (既定値)

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

戻り値

文字列の配列

D=Intl.NumberFormat.supportedLocalesOf('ja');  //日本語。
	//=[object]:ja
	//0=[string]:ja
D=Intl.NumberFormat.supportedLocalesOf('ja-u-nu-arab');  //日本語、数字の表記法がアラビア・インド数字。
	//=[object]:ja-u-nu-arab
	//0=[string]:ja-u-nu-arab
D=Intl.NumberFormat.supportedLocalesOf('ja', {numberingSystem:'arab'});  //日本語、数字の表記法がアラビア・インド数字。
	//=[object]:ja
	//0=[string]:ja
	//↑numberingSystemはoptionsで対応していないようだ。
D=Intl.NumberFormat.supportedLocalesOf('ja', {currency:'JPY', currencyDisplay:'symbol', style:'currency'});  //日本語、通貨は日本円、シンボル表示、書式は通貨。
	//=[object]:ja
	//0=[string]:ja
	//↑Intl.NumberFormat()でのoptionsで対応していないようだ。
D=Intl.NumberFormat.supportedLocalesOf('ja-u-nu-arab-co-big5han');  //日本語、数字の表記法がアラビア・インド数字、比較方法。
	//=[object]:ja-u-co-big5han-nu-arab
	//0=[string]:ja-u-co-big5han-nu-arab

テスト