Select
Select is the Component Macro counterpart to the core select macro.
It expresses the same case-based ICU selection logic, but in a way that can read more naturally in a markup file than a nested function call.
Custom case values (everything except other) are prefixed with _ to distinguish them from
reserved component props like value. For example, a formal case becomes _formal="...". The
other case is not prefixed because it is a required ICU keyword, not a custom value.
For the framework-agnostic Lingui semantics, see the
official Select reference.
<p>
<Select value={tone} _formal="Welcome" _casual="Hi" other="Hello" />
</p> Hi
Locale
Tone
<script lang="ts"> import { Select } from "lingui-for-svelte/macro";
let tone = $state("casual");</script>
<Select value={tone} _formal="Welcome" _casual="Hi" other="Hello" />---import { Select } from "lingui-for-astro/macro";
const tone = "casual";---
<Select value={tone} _formal="Welcome" _casual="Hi" other="Hello" />import { Select } from "@lingui/react/macro";
function Component() { return <Select value={tone} _formal="Welcome" _casual="Hi" other="Hello" />;}When Select is a good fit
Section titled “When Select is a good fit”- your file is already markup-oriented
- the select branches are easier to read as component props
- you want the component form without changing the underlying Lingui semantics