本文へ移動

Kuni国

国、コード、名前、行政区画を調べ、必要なときに国のデータを読み込み、標準の国のカードを表示できます。

「国(くに)」は、国を表す日本語です。 名前について(英語)

目次

リファレンス · すべての行政区画

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

引数

名前型説明
codestring

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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kuni 1.4.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。