Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

nameOffunction

What a region is called in a language: the English name, or in Japanese the everyday short name where there is one (アメリカ), else the full Japanese name, else the English.

Import it

import { nameOf } from "@johnmorrisdotca/chizu";

Definition

function nameOf(region: Pick<ChizuRegion, "name" | "nameJa" | "nameShortJa">, language: ChizuLanguage): string

Parameters

NameTypeDescription
regionPick<ChizuRegion, "name" | "nameJa" | "nameShortJa">

The native region, or built-in map selector where the signature requires text.

languageChizuLanguage

The English or Japanese display language.

Returns

string

What a region is called in a language: the English name, or in Japanese the everyday short name where there is one (アメリカ), else the full Japanese name, else the English.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { nameOf } from "@johnmorrisdotca/chizu";

const us = WORLD.regions.find((region) => region.code === "US")!;
console.log(nameOf(us, "en"), nameOf(us, "ja"));
// United States アメリカ
United States アメリカ

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.