Link Search Menu Expand Document

getFluentRuntime() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Build a MessageFormat runtime to use with Fluent messages.

This builds on top of the default runtime, but uses all-caps names for the DATETIME and NUMBER message formatters. A custom function MESSAGE is also included to support Fluent term and message references.

Signature:

export declare function getFluentRuntime(res: Map<string, MessageFormat>): {
    DATETIME: RuntimeFunction<import("messageformat").MessageDateTime>;
    MESSAGE: RuntimeFunction<ResolvedMessage>;
    NUMBER: RuntimeFunction<import("messageformat").MessageNumber>;
};

Parameters

Parameter Type Description
res Map<string, MessageFormat> A Map of MessageFormat instances, for use by MESSAGE. This Map may be passed in as initially empty, and later filled out by the caller.

Returns:

{ DATETIME: RuntimeFunction<import(“messageformat”).MessageDateTime>; MESSAGE: RuntimeFunction<ResolvedMessage>; NUMBER: RuntimeFunction<import(“messageformat”).MessageNumber>; }