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.


export declare function getFluentRuntime(res: FluentMessageResource): {
    DATETIME: typeof import("messageformat/lib/runtime/default").datetime;
    MESSAGE: (_locales: string[], options: RuntimeOptions, arg?: MessageValue) => import("messageformat").ResolvedMessage;
    NUMBER: typeof import("messageformat/lib/runtime/default").number;


Parameter Type Description
res FluentMessageResource 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.


{ DATETIME: typeof import(“messageformat/lib/runtime/default”).datetime; MESSAGE: (_locales: string[], options: RuntimeOptions, arg?: MessageValue) => import(“messageformat”).ResolvedMessage; NUMBER: typeof import(“messageformat/lib/runtime/default”).number; }


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.