Converts a MessageFormat 2 AST back to its canonical string form.
Used by Localize.Message.canonical_message/2.
Summary
Functions
Converts a parsed MF2 AST back to a canonical message string.
Functions
@spec to_string(list() | tuple(), Keyword.t()) :: String.t() | {:error, Exception.t()}
Converts a parsed MF2 AST back to a canonical message string.
Arguments
astis a parsed MF2 message AST as returned byLocalize.Message.Parser.parse/1.optionsis a keyword list of options (currently unused but reserved for future use).
Returns
- A canonical message string.
Examples
iex> {:ok, ast} = Localize.Message.Parser.parse("Hello {$name}!")
iex> Localize.Message.Print.to_string(ast)
"Hello {$name}!"