translateMessage

See source code

Translates message through an editor's i18n, falling back to its English.

Takes the editor's i18n rather than reading a context, so it works in the places this package has to keep working: a ShapeUtil with no hooks available, or an error fallback rendered outside the editor it's reporting on.

With no i18n at all the English is returned unformatted, for the reason given on defaultI18n. Every other case goes through the adapter, which does substitute.

function translateMessage(
  i18n: null | TLI18n | undefined,
  message: TLI18nMessage,
  values?: TLI18nValues,
): string;

Parameters

NameDescription

i18n

null | TLI18n | undefined;

message

values

Returns

string;
Prev
toPrecision
Next
uniq