import type { Language } from "./types.ts"; /** What an alias is. `official` is the name the owner or operator gives it (when it is not the everyday one), `wikipedia` the title of an article that is cited, `sponsor` a naming-rights name, `former` an earlier name and `nickname` a short form or a name people use. */ export type PlaceNameKind = "official" | "wikipedia" | "sponsor" | "former" | "nickname"; /** Another name of a place: a title, an earlier or a sponsor's name, a nickname. */ export interface PlaceAlias { name: string; /** The language of the name: `en`, `ja`, `es`, `de`... */ lang: string; kind: PlaceNameKind; /** The first and the last year the name was in use, where a source dates it. */ from?: number; to?: number; /** Where the name was read: an article and its revision, or a Wikidata item and property (`Wikidata Q49136 P1448`). */ source?: string; /** For a `wikipedia` alias, the revision of the article that is cited. */ revision?: number; /** The reading of a name in Japanese that has kanji, in kana (`よこはまこくさいそうごうきょうぎじょう`); given for the cited and official names of the places of Japan. */ reading?: string; } /** The names a place carries. */ export interface PlaceNames { /** The everyday name in English, the one English sports media use. */ name: string; /** The everyday name in Japanese. */ nameJa?: string; /** The reading of `nameJa` in hiragana and katakana, given wherever `nameJa` has kanji. */ readingJa?: string; /** The everyday name in the language of the place. */ localName?: string; /** The language of `localName`: `es`, `pt`, `de`, `ja`, ... */ localLanguage?: string; /** Every other name: the cited titles of Wikipedia, the official, sponsor and former names with their years, the nicknames. */ aliases?: readonly PlaceAlias[]; /** Names the place had for some years, first to last: where two share a year the later one is the name at the end of it. */ names?: readonly { name: string; from: number; to: number; }[]; } /** * A name made fit to compare: width, case, accents, kana (hiragana is katakana), the old and new forms of the same sound (ヂ, ヅ, ヴ), the long vowel mark and every space, dot * and mark of punctuation put aside, so that `Estádio Maracanã` and `estadio maracana` are one name, as are `ヤンキー・スタジアム` and `ヤンキースタジアム`. */ export declare function plainName(text: string): string; /** Every name a place answers to, with how close to the everyday name it is: 0 the everyday names, 1 the official, cited and sponsor names, 2 the former names and nicknames. */ export interface NameEntry { name: string; lang: string; rank: 0 | 1 | 2; from?: number; to?: number; } /** The names of a place, in order of rank: its everyday names, its dated names, then its aliases. */ export declare function nameEntries(place: PlaceNames): NameEntry[]; /** How well a query matches a place: the lowest rank of any of its names that is the query once made plain (with or without a leading `The`), or `undefined` for no name. */ export declare function nameRank(place: PlaceNames, query: string): 0 | 1 | 2 | undefined; /** Whether every word of a text is found in some name of the place (made plain), for a search box. */ export declare function nameContainsAll(place: PlaceNames, words: readonly string[]): boolean; /** * The places that answer to a name, best match first: the everyday names, then the official, cited and sponsor names and the dated names, then the former names and the * nicknames; places of the same rank keep the order of the list given. */ export declare function placesNamed(places: readonly T[], query: string | undefined): T[]; /** * The name a place officially has, in a language, when it is not the everyday name: the `official` alias in that language that stands in `year` (without a year, the one that * stands today). In English, where there is none in English, a name in the place's own language that is written in Latin letters stands for it (`Estadio Banorte`). `undefined` when * there is none or when it is the name shown. * @example * ```ts * import { PARKS, officialName } from "@johnmorrisdotca/kyogijo-stadiums/parks"; * const koshien = PARKS["hanshin-koshien-stadium"]; * console.log(officialName(koshien, "en"), "/", officialName(koshien, "ja")); * // Hanshin Koshien Stadium / 阪神甲子園球場 * ``` */ export declare function officialName(place: PlaceNames, language: Language, shown?: string, year?: number): string | undefined;