Skip to content

Component Macros

Component macros are the markup-oriented half of the Lingui macro family.

In official Lingui React docs, Trans is the general-purpose component for static messages, messages with variables, and messages with inline markup. Plural, Select, and SelectOrdinal are component-form convenience macros that map to the corresponding core macros.

lingui-for keeps that mental model even in frameworks that are not JSX-based.

Component Macro Overview
Trans
Translate rich text with embedded markup and placeholders.
Preview
Say hello to Lingui.
Snippet
<Trans>
  Say hello to <strong>{name}</strong>.
</Trans>

Start with a component macro when:

  • you are writing in template or markup syntax
  • rich text or embedded structure matters
  • the component form reads more naturally than a function call in that framework