Skip to content

Core Macros

Core macros are the JavaScript-side Lingui macros.

They cover two jobs:

  • produce translated strings immediately
  • define message descriptors for later translation

In official Lingui, these are t, msg, defineMessage, plural, select, and selectOrdinal. lingui-for keeps those semantics and adapts them to framework syntax where necessary.

Core Macro Overview
t
Translate a message immediately and return a string.
Preview
Hello Lingui
Snippet
<p>{
  $t\`Hello \${name}\`
}</p>

Start with a core macro when:

  • the result you need is a string or descriptor
  • you are not authoring rich text with embedded markup
  • you want behavior that matches official Lingui Core as directly as possible