Skip to main content

formatMessage

Turns a Message into text with catalogue. A placeholder that holds another message, or a list with messages among its items, is formatted first, so a sentence can carry a distance, a travel mode or a layer's name and the whole thing is in one language. A message with a count goes through plural, so the active catalogue chooses whether it has forms.

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

Signature​

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

function formatMessage(catalogue: MessageCatalogue, input: Message): string;

Parameters​

  • catalogue (MessageCatalogue)
  • { key, params }
  • input (Message)

Returns​

string

See also​

Source: packages/core/src/messages/formatMessage.ts:39