Interprets a MessageFormat 2 AST and produces formatted output.
The AST is produced by Cldr.Message.V2.Parser and uses tuples like
{:text, "..."}, {:expression, operand, function, attrs},
{:complex, declarations, body}, {:match, selectors, variants}, etc.
Summary
Functions
Formats a parsed MF2 AST with the given bindings.
Functions
@spec format_list(list() | tuple(), map() | Keyword.t(), Keyword.t()) :: {:ok, list(), list(), list()} | {:error, list(), list(), list()}
@spec format_list(term(), map() | list(), Keyword.t()) :: {:ok, list(), list(), list()} | {:error, list(), list(), list()} | {:format_error, String.t()}
Formats a parsed MF2 AST with the given bindings.
Arguments
astis a parsed MF2 message AST as returned byCldr.Message.V2.Parser.parse/1.bindingsis a map or keyword list of variable bindings. String keys are NFC-normalized to match parser output.optionsis a keyword list of options including:backendand:locale.
Returns
{:ok, iolist, bound, unbound}on success, whereboundis the list of variable names that were resolved andunboundis empty.{:error, iolist, bound, unbound}when one or more variables could not be resolved. Theiolistcontains a partial result.