subdivisionTypeLabelfunction
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 it
import { subdivisionTypeLabel } from "@johnmorrisdotca/kuni/subdivisions";
Definition
function subdivisionTypeLabel(code: string, language?: Language): string | null
Parameters
| Name | Type | Description |
|---|---|---|
code | string | A subdivision's code ("JP-13") or a country's alpha-2 code ("JP"). |
language (optional) | "en" | "ja" | "en" (the default) or "ja". |
Returns
string | null
The word; null where the kind is not known, or, in Japanese, where the names do not agree on one.
Examples
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
都
州
nullWhat it prints (run when this page was built)