Content

Union type representing all supported content formats for translation

Overview

Content represents all supported content formats for translation.

type Content = JsxChildren | IcuMessage | I18nextMessage;

Type Definition

Union Members

TypeDescriptionUse Case
JsxChildrenRich JSX content with elements and variablesReact components, structured HTML content
IcuMessageICU MessageFormat stringsComplex pluralization, date/number formatting
I18nextMessagei18next compatible message stringsSimple interpolation, existing i18next projects

Examples

JSX Content

const jsxContent: Content = {
  t: 'div',
  c: ['Hello ', { k: 'userName' }]
};

ICU Message Format

const icuContent: Content = 'Hello {name}!' as IcuMessage;

i18next Format

const i18nextContent: Content = 'Welcome back, {{name}}!' as I18nextMessage;

Notes

  • Content unifies different message formats under a single type
  • Content type can be inferred from structure or explicitly specified

How is this guide?

Content