Intl【国際化API名前空間】オブジェクト

メモ

プロパティ一覧

プロパティ説明
Intl.Collator【国際化文字列比較】コンストラクタ
Intl.DateTimeFormat【国際化日時フォーマット】コンストラクタ
Intl.DisplayNames 【国際化表示名】コンストラクタ
Intl.ListFormat 【国際化リスト要素フォーマット】コンストラクタ
Intl.Locale 【Unicode ロケール識別子】コンストラクタ
Intl.NumberFormat【国際化数値フォーマット】コンストラクタ
Intl.PluralRules 【複数形ルール】コンストラクタ
Intl.RelativeTimeFormat 【国際化相対時間フォーマット】コンストラクタ
Intl.Segmenter 【国際化テキスト区切り】コンストラクタ

メソッド一覧

メソッド説明
Intl.getCanonicalLocales ( locales ) 標準ロケール名取得

Intl.getCanonicalLocales【標準ロケール名取得】

メモ

構文

Intl.getCanonicalLocales( locales )

BCP 47に正規化した言語タグの配列 (重複は削除)
locales言語タグ文字列 または 言語タグ文字列の配列

TypeError 例外言語タグが文字列以外
RangeError 例外不正な言語タグ

console.log(Intl.getCanonicalLocales("ja"));
// 出力:Array [ "ja" ]
console.log(Intl.getCanonicalLocales("ja-jp"));
// 出力:Array [ "ja-JP" ]

console.log(Intl.getCanonicalLocales(["ja-jp", "en-us", "en-gb", "JA-JP", "EN-US", "EN-GB"]));
// 出力:Array(3) [ "ja-JP", "en-US", "en-GB" ]

console.log(Intl.getCanonicalLocales(null));     // TypeError 例外
console.log(Intl.getCanonicalLocales("ja_JP"));  // RangeError 例外