Reference · The realistic Earth's pure parts
cityNameTextfunction
The name to write for a city: Japanese on a page in Japanese where kuni has it (the short form, 東京 for 東京都, when kuni gives one), else English.
Import it
import { cityNameText } from "@johnmorrisdotca/chikyu-earth/realistic";
Definition
function cityNameText(city: { name: { en: string; ja?: string; jaShort?: string; }; }, lang: "en" | "ja"): string
Parameters
| Name | Type | Description |
|---|---|---|
city | { name: { en: string; ja?: string; jaShort?: string; }; } | The city. |
lang | "en" | "ja" | The page's language, |
Returns
string
The name.
Examples
import { cityNameText } from "@johnmorrisdotca/chikyu-earth/realistic";
const osaka = { name: { en: "Osaka", ja: "大阪市" } };
console.log(cityNameText(osaka, "en"), cityNameText(osaka, "ja"), cityNameText({ name: { en: "Paris" } }, "ja"));Osaka 大阪市 ParisWhat it prints (run when this page was built)