Skip to content

pantoken-root / renderers/web-components/src / formatMessage

Function: formatMessage() ​

formatMessage(locale, source, params?): string

Alpha

Format an MF2 source message for locale, substituting params. Throws on invalid MF2 syntax — validate with @pantoken/i18n-engine's validateMf2 at build time, not at format time.

messageformat already isolates each placeholder's formatted value in FSI/PDI bidi marks by default (its bidiIsolation: "default" option) — isolate is for interpolation done OUTSIDE of MF2 formatting, not needed here.

Parameters ​

locale ​

string

source ​

string

params? ​

Record<string, unknown>

Returns ​

string