本文へ移動

Kuni国

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

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

目次

リファレンス · /names/fr

Names型

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

One language's names: what an entry @johnmorrisdotca/kuni/names/<language> exports. Every function is pure.

インポート

import type { Names } from "@johnmorrisdotca/kuni/names/fr";

ほかのエクスポート元: @johnmorrisdotca/kuni/names/es, @johnmorrisdotca/kuni/names/de, @johnmorrisdotca/kuni/names/zh-Hans, @johnmorrisdotca/kuni/names/zh-Hant, @johnmorrisdotca/kuni/names/ko, @johnmorrisdotca/kuni/names/pt, @johnmorrisdotca/kuni/names/ar, @johnmorrisdotca/kuni/names/ru

定義

interface Names {
    readonly language: NamesLanguage;
    countryName(code: string, options?: NamesNameOptions): string | null;
    countryVariants(code: string): readonly string[];
    countryByName(text: string): CountryCode | null;
    countries(options?: NamesListOptions): readonly NamedCountry[];
    fold(text: string): string;
}

メンバー

名前型説明
languageNamesLanguage

The language of this entry.

countryName(code: string, options?: NamesNameOptions): string | null

A country's name in this language, as countryName(code, options) says.

countryVariants(code: string): readonly string[]

The variant forms CLDR gives for a country in this language; empty for most and for a code that is not a country.

countryByName(text: string): CountryCode | null

The country somebody typed, by name, short form, variant or alias in this language (or its alpha-2 code), as countryByName(text) says.

countries(options?: NamesListOptions): readonly NamedCountry[]

All 250 countries with their names in this language, in the order asked.

fold(text: string): string

What two ways of typing a name have in common in this language, as fold(text) says; the lookups compare names folded this way.

例

import type { Names } from "@johnmorrisdotca/kuni/names/fr";

const read = (names: Names): string | null => names.countryName("JP");
console.log(typeof read);   // "function"
function

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

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

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