Trans
Trans is the general-purpose Component Macro for translated markup content.
Use Trans when a translator needs to preserve links, emphasis, or other embedded structure. It can
also be used for non-rich-text messages, but its clearest advantage shows up when the message is
naturally authored as markup.
For the framework-agnostic Lingui semantics, see the
official Trans reference.
<p>
<Trans>
Say hello to <strong>{name}</strong>.
</Trans>
</p> Say hello to Lingui.
Locale
Name
<script lang="ts"> import { Trans } from "lingui-for-svelte/macro";</script>
<Trans> Read the <a href="/docs">documentation</a>.</Trans>---import { Trans } from "lingui-for-astro/macro";---
<Trans> Read the <a href="/docs">documentation</a>.</Trans>import { Trans } from "@lingui/react/macro";
function Component() { return ( <Trans> Read the <a href="/docs">documentation</a>. </Trans> );}When Trans is a good fit
Section titled “When Trans is a good fit”- the translation includes links or emphasis
- the structure matters to translators
- the message reads more naturally as markup than as a string template