Skip to main content Link Search Menu Expand Document (external link)

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

Signature:

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

Parameters

Parameter Type Description
source string | Fluent.Resource | Map<string, Message> A Fluent resource, as the string contents of an FTL file, as a Fluent.Resource, or in the shape output by fluentToResourceData() as data.
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>

Remarks

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