i18n.Function.getCodexRegionName - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / i18n / getCodexRegionName

Function: getCodexRegionName()

getCodexRegionName(id, locale): string | null

Defined in: src/i18n/codex-regions.ts:37

Look up a galactic codex region's source-backed display name for a locale.

Parameters

id

number

Region id, 1–42, as CodexRegion.id carries it. Id 0 means "outside the mapped region grid" and has no name.

locale

string

A BCP 47 language or regional tag, such as "de" or "de-DE"; see GameLocale for how a tag is matched.

Returns

string | null

The localized region name; the canonical CodexRegion.name for any English tag; or null when the id is not 1–42 or the locale is not one of the six this catalogue stores.

Remarks

The catalogue is keyed by region id rather than by English name, because the id is the region's stable identity while the name is the value being translated.

All six stored locales are complete, so a supported locale always answers. The game leaves many regions untranslated in some languages, and spells Izanami, Temple, Mare Somnia, Xibalba and Tenebrae alike in all six. The catalogue stores those source values verbatim rather than treating them as a missing translation.

Throws

If locale is not a string. A nullish or out-of-range id is a lookup miss and returns null.

Example

import { getCodexRegionName } from '@elite-dangerous-almanac/core/i18n/codex-regions';

getCodexRegionName(1, 'de-DE'); // -> 'Galaktisches Zentrum'
getCodexRegionName(5, 'fr'); // -> 'Bras de la Règle'
getCodexRegionName(5, 'it'); // -> null
⚠️ **GitHub.com Fallback** ⚠️