Link Search Menu Expand Document

compileFluentResource() 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.

Compile a Fluent resource (i.e. an FTL file) into a Map of MessageFormat instances.

A runtime provided by getFluentRuntime() is automatically used in these instances.

Signature:

export declare function compileFluentResource(source: string | Map<string, Message>, locales?: string | string[], options?: MessageFormatOptions): Map<string, MessageFormat>;

Parameters

Parameter Type Description
source string | Map<string, Message> A Fluent resource, either as the string contents of an FTL file, or in the shape output by compileFluentResourceData().
locales string | string[] (Optional) The locale code or codes to use for all of the resource’s messages.
options MessageFormatOptions (Optional) The MessageFormat constructor options to use for all of the resource’s messages.

Returns:

Map<string, MessageFormat>