Skip to the content

Kuni国

Look up countries, codes, names and subdivisions, load country data on demand and mount a native country card.

Kuni (国) is Japanese for a country. About the name

Contents

Reference · All subdivisions

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

NameTypeDescription
codestring

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"));             // null
metropolis
都
州
null

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kuni 1.4.0.