fluentToResource() function

This API is provided as a beta 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 | FluentMessageResourceData, locales?: string | string[], options?: MessageFormatOptions & FluentToMessageOptions): FluentMessageResource;

Parameters

Parameter Type Description
source string | Fluent.Resource | FluentMessageResourceData 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 & FluentToMessageOptions (Optional) The MessageFormat constructor options to use for all of the resource’s messages.

Returns:

FluentMessageResource

Remarks

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