[Edge]。→、
Intl.DisplayNames に従い指定値を翻訳し文字列で返します。
| Intl.DisplayNames | Intl.DisplayNames |
|---|---|
| code | 値は文字列で、Intl.DisplayNames の options の type の指定値により異なります。
|
文字列。
DA=new Intl.DisplayNames('ja', {type:'language'}); //日本語、タイプ:言語。
D=DA.of('en'); //英語。(enを日本語に翻訳)
//=[string]:英語
D=DA.of('en-US'); //英語でアメリカ合衆国。
//=[string]:英語 (アメリカ合衆国)
D=DA.of('Latn-US'); //ラテン文字でアメリカ合衆国。
//=[string]:latn (アメリカ合衆国)。おかしい。
D=DA.of('en-Latn'); //英語でラテン文字。
//=[string]:英語 (ラテン文字)
D=DA.of('en-Latn-US'); //英語でラテン文字でアメリカ合衆国。
//=[string]:英語 (ラテン文字、アメリカ合衆国)
D=DA.of('root'); //?
//=[string]:root
//↑この結果から、「unicode_language_id」の公式は有効でないと思える。
DA=new Intl.DisplayNames('ja', {type:'region'}); //日本語、タイプ:国。
D=DA.of('US'); //アメリカ合衆国。
//=[string]:アメリカ合衆国
D=DA.of('JP'); //日本国。
//=[string]:日本
DA=new Intl.DisplayNames('ja', {type:'script'}); //日本語、タイプ:文字体系。
D=DA.of('Jpan'); //日本文字。
//=[string]:日本語の文字
D=DA.of('Cyrl'); //キリル文字。
//=[string]:キリル文字
DA=new Intl.DisplayNames('ja', {type:'currency'}); //日本語、タイプ:通貨。
D=DA.of('JPY'); //円。
//=[string]:日本円
D=DA.of('CAD'); //カナダ ドル。
//=[string]:カナダ ドル