subdivisionTypeLabel関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The word for a kind of subdivision. Given a subdivision's code, its own kind ("JP-13" is "metropolis", 都); given a country's code, the kind most of its first-level subdivisions are ("JP" is "prefecture", 県). In English the kind's name with spaces; in Japanese the word the names of that kind in that country end in.
インポート
import { subdivisionTypeLabel } from "@johnmorrisdotca/kuni/subdivisions";
定義
function subdivisionTypeLabel(code: string, language?: Language): string | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | A subdivision's code ("JP-13") or a country's alpha-2 code ("JP"). |
language (省略可) | "en" | "ja" | "en" (the default) or "ja". |
戻り値
string | null
The word; null where the kind is not known, or, in Japanese, where the names do not agree on one.
例
import { subdivisionTypeLabel } from "@johnmorrisdotca/kuni/subdivisions";
console.log(subdivisionTypeLabel("JP-13")); // "metropolis"
console.log(subdivisionTypeLabel("JP-13", "ja")); // "都"
console.log(subdivisionTypeLabel("CA", "ja")); // "州"
console.log(subdivisionTypeLabel("XX")); // nullmetropolis
都
州
null出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。