MF1 (v3) docsGitHub
  • Preparing search index...
  • The search index is not available
Unicode MessageFormat for JavaScript
  • Unicode MessageFormat for JavaScript
  • @messageformat/icu-messageformat-1
  • mf1ToMessage

Function mf1ToMessage

  • mf1ToMessage(
        locales: undefined | string | string[],
        source: string | Model.Message | Token[],
        options?: MF1Options & MessageFormatOptions<never, never>,
    ): MessageFormat

    Compile an ICU MessageFormat 1 message into a MessageFormat instance.

    import { mf1ToMessage } from '@messageformat/icu-messageformat-1';

    const msg = mf1ToMessage('en', 'The total is {V, number, ::currency/EUR}.');
    msg.format({ V: 4.2 });
    'The total is €4.20.'
    

    Parameters

    • locales: undefined | string | string[]

      The locale to use for the message.

    • source: string | Model.Message | Token[]

      An ICU MessageFormat message, either in its syntax representation, as an array of @messageformat/parser AST tokens, or as a Model.Message data structure.

    • options: MF1Options & MessageFormatOptions<never, never> = {}

      See MF1Options and MessageFormatOptions

    Returns MessageFormat

    • Defined in mf1-to-message.ts:35

Settings

Member Visibility
MF1 (v3) docsGitHub
Unicode MessageFormat for JavaScript
  • Loading...