Skip to content

createStrings

createStrings(locale?): Strings

Defined in: packages/core/src/i18n/strings.ts:161

The lookup for one document’s locale: table.

ParameterTypeDescription
locale?unknownthe document’s locale: (v1 config.locale, v2 runtime.map.locale); anything that isn’t an object means “no overrides”.

Strings

a function from key (and placeholder values) to text. A key the table doesn’t set, or sets to something other than a non-empty string, falls back to English.

const t = createStrings({ "maplibre-yaml.Legend.Title": "Leyenda" });
t("maplibre-yaml.Legend.Title"); // "Leyenda"
t("maplibre-yaml.Notice.More", { count: 3 }); // "…and 3 more (see the browser console)."