本文へ移動

Kuni国

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

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

目次

リファレンス · 国の豆知識

CountryTrivia型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The trivia about one country, from the /trivia entry: null where the source has none.

インポート

import type { CountryTrivia } from "@johnmorrisdotca/kuni/trivia";

定義

interface CountryTrivia {
    alpha2: string;
    inception: {
        year: number;
        day?: string;
    } | null;
    officialLanguages: readonly string[];
    largestCity: {
        id: string;
        name: {
            en: string;
            ja: string | null;
        };
    } | null;
}

メンバー

名前型説明
alpha2string

ISO 3166-1 alpha-2, "JP"

inception{ year: number; day?: string; } | null

When Wikidata says the country, as it is today, began (P571, inception): the year, and the day where Wikidata gives one. Often the day of independence (India, 1947-08-15), sometimes a constitution or a union (Japan, 1947-05-03), so it is not a date of independence. null where Wikidata has none, or several.

officialLanguagesreadonly string[]

The languages CLDR records as official there, by law or in fact, most spoken first: language subtags, ISO 639-1 where the language has one ("en") and ISO 639-3 otherwise ("gsw"). Empty where CLDR records none. The languages people speak, official or not, are country(code).languages.

largestCity{ id: string; name: { en: string; ja: string | null; }; } | null

The city with the most people in the city itself (its city proper: the municipality or district that is the city, as its census counts it), not the urban area round it: Rome for Italy, not Milan. Its id in /cities and its name. null for a country with no city of 15,000 people in kuni, or whose largest place kuni does not have under its code (Guam's Dededo). docs/trivia.md lists the figures set by hand and every gap.

例

import type { CountryTrivia } from "@johnmorrisdotca/kuni/trivia";
import { trivia } from "@johnmorrisdotca/kuni/trivia";

const value: CountryTrivia = trivia("JP")!;
console.log(typeof value === "object" ? Object.keys(value).slice(0,6) : value);
[ 'alpha2', 'inception', 'officialLanguages', 'largestCity' ]

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

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

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