countryName関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The name of a country in a language, from its ISO 3166 code, through Intl.DisplayNames: no list to write ("DE" is
Germany, Allemagne, ドイツ, Alemania, Deutschland). The home nations (GB-ENG, GB-SCT, GB-WLS, GB-NIR) are not regions
to Intl, so they have names here. A code Intl does not know gives undefined.
インポート
import { countryName } from "@johnmorrisdotca/taisen-brackets/layout";
ほかのエクスポート元: @johnmorrisdotca/taisen-brackets
定義
function countryName(code: string, locale?: string | Locale): string | undefined
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | The country's ISO 3166 code: |
locale (省略可) | string | Locale | The language, as for |
戻り値
string | undefined
The name, or undefined when the code is not a country the runtime knows.
例
import { countryName } from "@johnmorrisdotca/taisen-brackets";
console.log(countryName("JP", "en"), countryName("JP", "ja"));Japan 日本出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。