Skip to main content

textOrMessage

A definition's text as a placeholder value for a Message: a key becomes a message with no parameters, which the one place that speaks the sentence formats in the active language, and a plain string stays as it is. Use it where a pure helper builds an announcement from a definition's name and has no catalogue to hand. A HostText is passed on as it is: formatMessage reads it with the active catalogue.

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

Signature​

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

function textOrMessage(text: DefinitionText): MessagePart;

Parameters​

  • text (DefinitionText)

Returns​

MessagePart

See also​

Source: packages/core/src/messages/resolveText.ts:84