Skip to content

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.

Source
<p>
  <Select value={tone} _formal="Welcome" _casual="Hi" other="Hello" />
</p>
Result

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" />
  • 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