UNPKG

@messageformat/fluent

Version:

Conversion & compatibility tools for using Fluent with MessageFormat 2

22 lines (21 loc) 915 B
import * as Fluent from '@fluent/syntax'; import { type Model as MF } from 'messageformat'; /** * Convert a {@link MF.Message | Model.Message} data object into a * {@link https://projectfluent.org/fluent.js/syntax/classes/pattern.html | Fluent.Pattern} * (i.e. the value of a Fluent message or an attribute). * * @param options.defaultKey - The Fluent identifier or numeric literal to use for the * default/fallback variant, which is labelled as `*` in MessageFormat 2, * when not explicitly defined in the data. * Defaults to `other`. * @param options.functionMap - A mapping of custom MessageFormat 2 → Fluent function names. */ export declare function messageToFluent(msg: MF.Message, options?: { defaultKey?: string; functionMap?: Record<string, string>; }): Fluent.Pattern; export declare function valueToMessageRef(value: string): { msgId: string; msgAttr: string | null; };