MF1Functions: {
    "mf1:currency": (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber;
    "mf1:datetime": (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageDateTime;
    "mf1:duration": (
        ctx: MessageFunctionContext,
        _options: unknown,
        operand?: unknown,
    ) => {
        source: string;
        toParts: () => [{ source: string; type: "mf1:duration"; value: string }];
        toString: () => string;
        type: "mf1:duration";
        valueOf: () => number;
    };
    "mf1:number": (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber;
    "mf1:plural": (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber;
    "mf1:unit": (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber;
} = ...

Function handlers for ICU MessageFormat 1.

Used by mf1ToMessage.

Type declaration

  • mf1:currency: (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber

    A wrapper around DraftFunctions.currency, used for formatting a number, currency and number, ::currency placeholder.

  • mf1:datetime: (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageDateTime

    A wrapper around DraftFunctions.datetime, used for formatting date and time placeholders.

  • mf1:duration: (
        ctx: MessageFunctionContext,
        _options: unknown,
        operand?: unknown,
    ) => {
        source: string;
        toParts: () => [{ source: string; type: "mf1:duration"; value: string }];
        toString: () => string;
        type: "mf1:duration";
        valueOf: () => number;
    }

    Formats a duration expressed as seconds.

    The formatted value includes one or two : separators, matching the pattern hhhh:mm:ss, possibly with a leading - for negative values and a trailing .sss part for non-integer input.

  • mf1:number: (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber

    A wrapper around DefaultFunctions.number, used for formatting most number placeholders.

  • mf1:plural: (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber

    A plural or selectordinal selector that includes an offset.

    Selectors without an offset are represented by :number.

  • mf1:unit: (
        ctx: MessageFunctionContext,
        options: Record<string, unknown>,
        operand?: unknown,
    ) => MessageNumber

    A wrapper around DraftFunctions.unit, used for formatting number, percent, number, ::unit, and other placeholders.