Skip to main content

createMessageCatalogue

Builds the dependency-free default MessageCatalogue: a plain Record<MessageKey, string> of resolved text (partial, for a translation in progress), formatted with Intl.PluralRules and Intl.ListFormat. A key missing from catalogue falls back to fallback's value, using its language for plural selection and warning once per missing key for this instance. Substitutions continue to use the active language.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { createMessageCatalogue } from "@mapcairn/core";

function createMessageCatalogue(language: string, catalogue: Readonly<Partial<Record<MessageKey, string>>>, fallback: Readonly<Record<MessageKey, string>>, options?: CreateMessageCatalogueOptions): MessageCatalogue;

Parameters​

  • language (string)
  • catalogue (Readonly<Partial<Record<MessageKey, string>>>)
  • fallback (Readonly<Record<MessageKey, string>>)
  • options? (CreateMessageCatalogueOptions)

Returns​

MessageCatalogue

See also​

Source: packages/core/src/messages/createMessageCatalogue.ts:132