# Locale provider

> Localize every Salmon UI component at once with LocaleProvider and the built-in Traditional Chinese pack, override single strings, nest providers, and add your own locale pack.

Canonical: https://salmonui.dev/docs/data-grid/locale-provider

Every Salmon UI component takes its visible and assistive text from a
`localeText` prop over built-in English, and its dates, numbers and plural
rules from a `locale` prop. `LocaleProvider` sets both for a whole subtree,
so an application localizes once instead of on every instance. It works
for every category, not only the Data Grid: pagers, pickers, dropdowns,
form validation messages, dialogs, toasts and the rest read the same
provider.

## Setup

Wrap the application (or the part of it to localize) in the provider and
pass a locale pack:

```tsx
import { LocaleProvider } from '@salmonui/core/locale';
import { zhTW } from '@salmonui/core/locale/zh-TW';

export function App() {
  return (
    <LocaleProvider locale="zh-TW" localeText={zhTW}>
      <OrdersPage />
    </LocaleProvider>
  );
}
```

`LocaleProvider` renders no element. It takes two props, both optional:

| Prop | Type | Meaning |
| --- | --- | --- |
| `locale` | `string` | BCP 47 locale for every `Intl` format, plural rule and collation below it (dates, numbers, currency, month and weekday names, first day of the week) |
| `localeText` | `LocaleCatalog` | Text per component family: `{ pager: {...}, dataGrid: {...}, datePicker: {...}, ... }`, each entry with the keys of that component's `localeText` prop |

Without a provider every component shows its built-in English text and
uses its own `locale` prop; an application that never renders a provider
pays only a context read per component and imports no pack.

### Live demo: Traditional Chinese admin page

Live demo: https://salmonui.dev/demos/data-grid/locale-zh-tw

An order admin page under one LocaleProvider with the built-in zh-TW pack (data grid, pager, date pickers, dropdowns, form validation, file upload, tabs, breadcrumbs, dialogs and toasts), switchable to the built-in English text.

`Demo.tsx`:

```tsx
'use client';

import { useMemo, useState } from 'react';
import { Button, ToggleButton, ToggleButtonGroup } from '@salmonui/buttons/button';
import { DatePicker } from '@salmonui/calendars/date-picker';
import { DateRangePicker } from '@salmonui/calendars/date-range-picker';
import { LocaleProvider } from '@salmonui/core/locale';
import { zhTW } from '@salmonui/core/locale/zh-TW';
import { DataGrid, type DataGridColumn } from '@salmonui/data-grid';
import { Combobox } from '@salmonui/dropdowns/combobox';
import { Select, type SelectValue } from '@salmonui/dropdowns/select';
import { FileUpload } from '@salmonui/inputs/file-upload';
import { Form } from '@salmonui/inputs/form';
import { NumberField } from '@salmonui/inputs/number-field';
import { TextField } from '@salmonui/inputs/text-field';
import { BreadcrumbItem, Breadcrumbs } from '@salmonui/navigation/breadcrumbs';
import { Pager } from '@salmonui/navigation/pager';
import { Tab, TabList, TabPanel, Tabs } from '@salmonui/navigation/tabs';
import { Badge, type BadgeTone } from '@salmonui/notifications/badge';
import { Toaster, useToast } from '@salmonui/notifications/toast';
import { Dialog, DialogProvider, useConfirm } from '@salmonui/overlays/dialog';

// An order admin page under one LocaleProvider: every component string
// (pager, grid menus, pickers, dropdowns, validation, dialogs, toasts) comes
// from the zh-TW pack, the app's own labels from its own dictionary. The
// "English" button renders the same page without the provider.

type Lang = 'zh' | 'en';
type Status = 'unpaid' | 'processing' | 'shipped' | 'done' | 'cancelled';

interface Order {
  readonly id: string;
  readonly customer: string;
  readonly product: string;
  readonly quantity: number;
  readonly amount: number;
  readonly placed: Date;
  readonly status: Status;
}

const CUSTOMERS = ['王小明', '李美玲', '陳志豪', '林雅婷', '張家豪', '黃淑芬', '吳俊傑', '劉怡君', '蔡宗翰', '楊佩珊'];
const PRODUCTS: readonly (readonly [string, number])[] = [
  ['拿鐵咖啡豆 1 kg', 680],
  ['凍頂烏龍茶葉', 450],
  ['手沖壺組', 1280],
  ['電動磨豆機', 3600],
  ['濾紙（100 入）', 120],
  ['冷泡茶包禮盒', 520],
];
const STATUSES: readonly Status[] = ['unpaid', 'processing', 'shipped', 'done', 'done', 'cancelled'];
const TONES: Record<Status, BadgeTone> = { unpaid: 'warning', processing: 'info', shipped: 'primary', done: 'success', cancelled: 'neutral' };

// Deterministic data: identical on the server and in the browser.
const ORDERS: readonly Order[] = Array.from({ length: 64 }, (_, i) => {
  const [product, price] = PRODUCTS[(i * 5) % PRODUCTS.length]!;
  const quantity = 1 + ((i * 7) % 6);
  return {
    id: `SO-${String(20261100 + i + 1)}`,
    customer: CUSTOMERS[(i * 3) % CUSTOMERS.length]!,
    product,
    quantity,
    amount: price * quantity,
    placed: new Date(Date.UTC(2026, 10, 26 - (i % 25), 1 + (i % 9))),
    status: STATUSES[(i * 11) % STATUSES.length]!,
  };
});

const ACTIVITY = Array.from({ length: 48 }, (_, i) => ({ id: i, customer: CUSTOMERS[i % CUSTOMERS.length]!, order: ORDERS[i]!.id }));

// The application's own strings; component strings come from the pack.
const TEXT = {
  zh: {
    home: '首頁',
    sales: '銷售管理',
    title: '訂單管理',
    subtitle: '查詢、建立與匯入訂單',
    language: '介面語言',
    list: '訂單列表',
    create: '新增訂單',
    import: '匯入訂單',
    placed: '下單日期',
    status: '訂單狀態',
    customer: '客戶',
    customerHint: '輸入或選擇客戶',
    search: '查詢',
    reset: '重設',
    remove: '刪除所選',
    removeTitle: (n: number) => `刪除 ${n} 筆訂單？`,
    removeBody: '刪除後無法復原。',
    removeConfirm: '刪除',
    removed: (n: number) => `已刪除 ${n} 筆訂單`,
    details: '訂單詳情',
    detailsBody: '最近一筆訂單由王小明於今日建立，共 3 項商品。',
    order: '訂單編號',
    product: '商品',
    quantity: '數量',
    amount: '金額',
    grid: '訂單',
    statuses: { unpaid: '待付款', processing: '處理中', shipped: '已出貨', done: '已完成', cancelled: '已取消' } as Record<Status, string>,
    name: '客戶名稱',
    phone: '聯絡電話',
    delivery: '交貨日期',
    payment: '付款方式',
    payments: ['信用卡', '銀行轉帳', '貨到付款'],
    note: '備註',
    submit: '建立訂單',
    created: '已建立訂單',
    createdBody: (name: string) => `${name} 的訂單已送出。`,
    file: '訂單檔案',
    fileHint: 'CSV 或 Excel 檔，單檔 5 MB 以內',
    upload: '開始匯入',
    activity: '操作紀錄',
    activityPages: '操作紀錄分頁',
    activityItem: (who: string, id: string) => `${who} 更新了訂單 ${id}`,
    selected: (n: number) => `已選取 ${n} 筆`,
  },
  en: {
    home: 'Home',
    sales: 'Sales',
    title: 'Orders',
    subtitle: 'Search, create and import orders',
    language: 'Interface language',
    list: 'Order list',
    create: 'New order',
    import: 'Import',
    placed: 'Order date',
    status: 'Status',
    customer: 'Customer',
    customerHint: 'Type or pick a customer',
    search: 'Search',
    reset: 'Reset',
    remove: 'Delete selected',
    removeTitle: (n: number) => `Delete ${n} orders?`,
    removeBody: 'This cannot be undone.',
    removeConfirm: 'Delete',
    removed: (n: number) => `${n} orders deleted`,
    details: 'Order details',
    detailsBody: 'The latest order was placed today by 王小明, with 3 items.',
    order: 'Order',
    product: 'Product',
    quantity: 'Qty',
    amount: 'Amount',
    grid: 'Orders',
    statuses: { unpaid: 'Unpaid', processing: 'Processing', shipped: 'Shipped', done: 'Completed', cancelled: 'Cancelled' } as Record<Status, string>,
    name: 'Customer name',
    phone: 'Phone',
    delivery: 'Delivery date',
    payment: 'Payment',
    payments: ['Credit card', 'Bank transfer', 'Cash on delivery'],
    note: 'Note',
    submit: 'Create order',
    created: 'Order created',
    createdBody: (name: string) => `The order for ${name} was sent.`,
    file: 'Order file',
    fileHint: 'CSV or Excel, up to 5 MB',
    upload: 'Import',
    activity: 'Activity',
    activityPages: 'Activity pages',
    activityItem: (who: string, id: string) => `${who} updated order ${id}`,
    selected: (n: number) => `${n} selected`,
  },
};
type Text = (typeof TEXT)['zh'];

// Filters from the column header menus, no filter row: a compact back-office table.
const FILTERING = { ui: 'menu' } as const;

function useColumns(t: Text): DataGridColumn<Order>[] {
  return useMemo(
    () => [
      { type: 'selection' },
      { field: 'id', header: t.order, primaryKey: true, width: 130 },
      { field: 'customer', header: t.customer, width: 100 },
      { field: 'product', header: t.product, width: 140 },
      { field: 'quantity', header: t.quantity, type: 'number', align: 'end', width: 90 },
      { field: 'amount', header: t.amount, type: 'number', format: 'C0', align: 'end', width: 104 },
      { field: 'placed', header: t.placed, type: 'date', format: 'yMMMd', width: 140 },
      {
        field: 'status',
        header: t.status,
        width: 120,
        valueGetter: (row: Order) => t.statuses[row.status],
        renderCell: ({ row }) => (
          <Badge tone={TONES[row.status]} variant="dot">
            {t.statuses[row.status]}
          </Badge>
        ),
      },
    ],
    [t],
  );
}

function OrderList({ t }: { t: Text }) {
  const columns = useColumns(t);
  const [selected, setSelected] = useState<readonly string[]>([]);
  const [status, setStatus] = useState<SelectValue | null>(null);
  const confirm = useConfirm();
  const toast = useToast();
  const statusItems = (Object.keys(t.statuses) as Status[]).map((value) => ({ value, label: t.statuses[value] }));
  const rows = useMemo(() => (status ? ORDERS.filter((order) => order.status === status) : ORDERS), [status]);
  return (
    <div className="demo-admin__stack">
      <section className="demo-admin__card demo-admin__filters" aria-label={t.search}>
        <DateRangePicker label={t.placed} />
        <div className="demo-admin__field">
          <label htmlFor="zh-demo-status" className="demo-admin__label">
            {t.status}
          </label>
          <Select id="zh-demo-status" data={statusItems} value={status} onValueChange={setStatus} clearable />
        </div>
        <div className="demo-admin__field">
          <span id="zh-demo-customer" className="demo-admin__label">
            {t.customer}
          </span>
          <Combobox aria-labelledby="zh-demo-customer" data={CUSTOMERS} placeholder={t.customerHint} />
        </div>
        <div className="demo-admin__actions">
          <Button tone="primary">{t.search}</Button>
          <Button variant="outline" onClick={() => setStatus(null)}>
            {t.reset}
          </Button>
        </div>
      </section>
      <section className="demo-admin__card demo-admin__card--flush" aria-label={t.list}>
        <div className="demo-admin__bar">
          <span className="demo-admin__muted">{t.selected(selected.length)}</span>
          <div className="demo-admin__actions">
            <Dialog trigger={<Dialog.Trigger render={(p) => <Button {...p} variant="outline">{t.details}</Button>} />} closeButton>
              <Dialog.Title>{t.details}</Dialog.Title>
              <Dialog.Body>{t.detailsBody}</Dialog.Body>
            </Dialog>
            <Button
              tone="danger"
              variant="outline"
              disabled={selected.length === 0}
              onClick={async () => {
                const ok = await confirm({ title: t.removeTitle(selected.length), description: t.removeBody, confirmLabel: t.removeConfirm, tone: 'danger' });
                if (ok) toast.add({ title: t.removed(selected.length), tone: 'success' });
              }}
            >
              {t.remove}
            </Button>
          </div>
        </div>
        <DataGrid<Order>
          aria-label={t.grid}
          data={rows}
          columns={columns}
          sorting
          filtering={FILTERING}
          paging={{ pageSize: 8, pageSizeOptions: [8, 20, 50] }}
          selection={{ mode: 'row', multiple: true, rowIds: selected }}
          onSelectionChange={(event) => setSelected(event.rowIds as readonly string[])}
          currency="TWD"
          timeZone="Asia/Taipei"
          height="auto"
        />
      </section>
    </div>
  );
}

function NewOrder({ t }: { t: Text }) {
  const toast = useToast();
  return (
    <Form
      className="demo-admin__card demo-admin__form"
      onSubmit={(event) => {
        event.preventDefault();
        const name = String(new FormData(event.currentTarget).get('name') ?? '');
        toast.add({ title: t.created, description: t.createdBody(name), tone: 'success', dismissible: true });
      }}
    >
      <TextField name="name" label={t.name} required />
      <TextField name="phone" label={t.phone} type="tel" />
      <NumberField name="quantity" label={t.quantity} required min={1} max={99} />
      <DatePicker name="delivery" label={t.delivery} />
      <div className="demo-admin__field">
        <label htmlFor="zh-demo-payment" className="demo-admin__label">
          {t.payment}
        </label>
        <Select id="zh-demo-payment" name="payment" data={t.payments} defaultValue={t.payments[0]!} />
      </div>
      <TextField name="note" label={t.note} />
      <div className="demo-admin__actions demo-admin__span">
        <Button type="submit" tone="primary">
          {t.submit}
        </Button>
        <Button type="reset" variant="outline">
          {t.reset}
        </Button>
      </div>
    </Form>
  );
}

function ImportOrders({ t }: { t: Text }) {
  return (
    <Form className="demo-admin__card demo-admin__stack" onSubmit={(event) => event.preventDefault()}>
      <FileUpload name="file" label={t.file} description={t.fileHint} accept=".csv,.xlsx" maxSize={5 * 1024 * 1024} required />
      <div className="demo-admin__actions">
        <Button type="submit" tone="primary">
          {t.upload}
        </Button>
      </div>
    </Form>
  );
}

function Activity({ t }: { t: Text }) {
  const [page, setPage] = useState(1);
  const items = ACTIVITY.slice((page - 1) * 4, page * 4);
  return (
    <section className="demo-admin__card" aria-labelledby="zh-demo-activity">
      <h4 id="zh-demo-activity" className="demo-admin__heading">
        {t.activity}
      </h4>
      <ul className="demo-admin__list">
        {items.map((item) => (
          <li key={item.id}>{t.activityItem(item.customer, item.order)}</li>
        ))}
      </ul>
      <Pager aria-label={t.activityPages} page={page} pageSize={4} totalCount={ACTIVITY.length} buttonCount={5} onPageChange={(event) => setPage(event.page)} />
    </section>
  );
}

function AdminPage({ t, lang, onLang }: { t: Text; lang: Lang; onLang: (lang: Lang) => void }) {
  return (
    <div className="demo-admin" lang={lang === 'zh' ? 'zh-TW' : 'en'} data-salmon-a11y-root="">
      <header className="demo-admin__header">
        <Breadcrumbs onItemClick={(event) => event.preventDefault()}>
          <BreadcrumbItem href="#demo-locale-zh-tw-title">{t.home}</BreadcrumbItem>
          <BreadcrumbItem href="#demo-locale-zh-tw-title">{t.sales}</BreadcrumbItem>
          <BreadcrumbItem>{t.title}</BreadcrumbItem>
        </Breadcrumbs>
        <div className="demo-admin__title-row">
          <div>
            <h3 className="demo-admin__title">{t.title}</h3>
            <p className="demo-admin__muted">{t.subtitle}</p>
          </div>
          <ToggleButtonGroup aria-label={t.language} value={lang} onValueChange={(value) => value && onLang(value as Lang)} disallowEmpty size="sm">
            <ToggleButton value="zh">繁體中文</ToggleButton>
            <ToggleButton value="en">English</ToggleButton>
          </ToggleButtonGroup>
        </div>
      </header>
      <Tabs defaultValue="list">
        <TabList aria-label={t.title}>
          <Tab value="list">{t.list}</Tab>
          <Tab value="create">{t.create}</Tab>
          <Tab value="import">{t.import}</Tab>
        </TabList>
        <TabPanel value="list">
          <OrderList t={t} />
        </TabPanel>
        <TabPanel value="create">
          <NewOrder t={t} />
        </TabPanel>
        <TabPanel value="import">
          <ImportOrders t={t} />
        </TabPanel>
      </Tabs>
      <Activity t={t} />
    </div>
  );
}

export default function LocaleZhTwDemo() {
  const [lang, setLang] = useState<Lang>('zh');
  const page = (
    <Toaster>
      <DialogProvider>
        <AdminPage t={TEXT[lang]} lang={lang} onLang={setLang} />
      </DialogProvider>
    </Toaster>
  );
  // English: the same tree without a provider, so every component falls back to its built-in English text.
  return lang === 'zh' ? (
    <LocaleProvider locale="zh-TW" localeText={zhTW}>
      {page}
    </LocaleProvider>
  ) : (
    page
  );
}
```

## The zh-TW pack

`@salmonui/core/locale/zh-TW` is the built-in Traditional Chinese (Taiwan)
pack. It is plain data with no React import, so it loads on the server and
in the browser alike. It exports:

- `zhTW`: the whole catalog, every component family.
- One named export per family (`pager`, `dataGrid`, `datePicker`,
  `select`, `textField`, `validation`, `dialog`, `tabs`, `breadcrumbs`,
  ...), the same objects `zhTW` holds.
- `locale`: the string `'zh-TW'`.

The family names are the component names in camelCase. Two families are
shared: `validation` holds the field validation messages every input uses
(`validationRequired`, ...), and `dialog` names the dialog close button.

### Whole catalog or per family

`zhTW` is the simplest choice and covers every component, including ones
added later. An application that renders only a few families can import
just those and let the bundler drop the rest:

```tsx
import { LocaleProvider } from '@salmonui/core/locale';
import { dataGrid, datePicker, locale, pager, select, validation } from '@salmonui/core/locale/zh-TW';

const text = { dataGrid, datePicker, pager, select, validation };

<LocaleProvider locale={locale} localeText={text}>
  <OrdersPage />
</LocaleProvider>;
```

Keep the catalog object stable: define it at module level (or memoize it)
rather than building a new object on every render, so components that
compile their text once per catalog do not recompute.

## Overriding single strings

A pack is a frozen object; spread it to change a few keys and keep the
rest:

```tsx
import { zhTW } from '@salmonui/core/locale/zh-TW';

const text = {
  ...zhTW,
  pager: { ...zhTW.pager, pageSize: '每頁顯示' },
  validation: { ...zhTW.validation, validationRequired: '必填' },
};

<LocaleProvider locale="zh-TW" localeText={text}>…</LocaleProvider>;
```

Message syntax is the same as on each component's `localeText` prop:
`{param}` placeholders and, where a component documents them, plural forms
(`one`, `other`, ...) chosen for the provider's `locale`. The recurrence
summary messages (`recurrenceEditor`) also use their `one` form for an
interval or count of exactly 1 in every language, so a language with a
single plural category can still word it: the zh-TW summary reads 「每週」
for an interval of 1 and 「每 2 週」 for 2. A few families
take functions for text that is built from a value, such as TagGroup's
`remove(label)`, ColorPicker's `colorName(color)` and `hueName(hue)`, the
dialog's `resizeEdge(edge)` and Gauge's `pointer(gauge, n)`; override them
with a function too.

Badge, Progress, Spinner and Avatar are safe to render as Server
Components, so they read no context: set their own `locale` and
`localeText` props (AvatarGroup's `more(count)`). Charts have no
`localeText` prop; the provider's `chart`, `bulletChart`, `stockChart`,
`rangeSelector`, `heatMap`, `treeMap`, `sankeyChart`, `pieChart`,
`funnelChart`, `gauge` and `geoMap` entries fill their `text` prop
(`stockText` on StockChart): chart names and role descriptions, legend,
toolbar and breadcrumb names. The automatic chart summary sentences stay
English; pass `description` to replace them.

## Precedence

From strongest to weakest, for each key:

1. The component's own `localeText` prop.
2. The nearest `LocaleProvider` whose catalog has that family and key.
3. Outer providers, in order.
4. The component's built-in English text.

`locale` follows the same order: a component's own `locale` prop wins over
the nearest provider's. So a single instance can still differ from the
rest of the page:

```tsx
<LocaleProvider locale="zh-TW" localeText={zhTW}>
  {/* Every pager reads 「每頁筆數」, this one reads 「每頁訂單」. */}
  <Pager totalCount={480} pageSizeOptions localeText={{ pageSize: '每頁訂單' }} />
  {/* Dates in this picker are formatted for Japan; its strings stay zh-TW. */}
  <DatePicker label="出貨日" locale="ja-JP" />
</LocaleProvider>
```

## Nesting

Providers nest. An inner provider merges over the outer one per family,
key by key, so it only has to name what changes:

```tsx
<LocaleProvider locale="zh-TW" localeText={zhTW}>
  <AppShell>
    {/* Same strings, Hong Kong formats. */}
    <LocaleProvider locale="zh-HK">
      <Reports />
    </LocaleProvider>
    {/* One family changed for this panel only. */}
    <LocaleProvider localeText={{ pager: { pageSize: '每頁顯示' } }}>
      <AuditLog />
    </LocaleProvider>
  </AppShell>
</LocaleProvider>
```

An inner provider without `locale` keeps the outer one's.

## Dates and numbers

The provider's `locale` drives every `Intl` formatter below it: column
formats of the Data Grid (`C0`, `N2`, `yMMMd`, ...), number fields, the
date and time pickers (field order, month and weekday names, first day of
the week), plural rules and sorting. Currency and time zone are not part of
the locale; pass them on the components that format money or instants
(`currency="TWD"`, `timeZone="Asia/Taipei"`). Pass a `timeZone` for
server rendering so the server and the browser format instants the same
way (see [Values, time zones and globalization](https://salmonui.dev/docs/calendars/dates)).

`useLocale()` returns the nearest provider's `locale` (or `undefined`
outside one), for application code that formats its own text:

```tsx
import { useLocale } from '@salmonui/core/locale';

function Total({ value }: { value: number }) {
  const locale = useLocale() ?? 'en-US';
  return <span>{new Intl.NumberFormat(locale, { style: 'currency', currency: 'TWD' }).format(value)}</span>;
}
```

The provider does not set the text direction or the document language: set
`lang` (and `dir` for right-to-left locales) on `<html>` or on a container
(see [Right-to-left](https://salmonui.dev/docs/data-grid/rtl)).

## Next.js App Router

`LocaleProvider` is a Client Component, and the packs contain a few
functions (TagGroup's `remove(label)`, ColorPicker's `colorName(color)`), which
cannot be passed from a Server Component to a Client Component. Put the
provider and the pack in a small client wrapper and render it from the
root layout:

```tsx
// app/providers.tsx
'use client';

import type { ReactNode } from 'react';
import { LocaleProvider } from '@salmonui/core/locale';
import { zhTW } from '@salmonui/core/locale/zh-TW';

export function Providers({ children }: { children: ReactNode }) {
  return (
    <LocaleProvider locale="zh-TW" localeText={zhTW}>
      {children}
    </LocaleProvider>
  );
}
```

```tsx
// app/layout.tsx (a Server Component)
import type { ReactNode } from 'react';
import { Providers } from './providers';

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="zh-TW">
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}
```

Pages and layouts below stay Server Components; every Salmon UI client
component they render reads the provider, including components passed
through Server Components as children. React context does not reach a
component that itself renders as a Server Component, so such a component
takes its text from its own `localeText` prop.

## Server rendering

The provider is plain React context with no effect and no browser read, so
server rendering (Next.js, Vite SSR, streaming) produces the localized
markup directly and hydration matches it: there is no English flash and no
hydration warning. Render the same `locale` and catalog on the server and
in the browser; a locale chosen per request (from a cookie or the
`Accept-Language` header) must reach the client as a prop, not be read
from `navigator.language` during render.

## Adding a locale pack

A pack is an object with the same families and keys as `zhTW`:

1. Copy the `zh-TW` pack and translate every value. Keep the keys exactly;
   keep `{param}` placeholders, plural forms and function signatures.
2. Pass it to the provider: `<LocaleProvider locale="ja-JP" localeText={jaJP}>`.

A partial pack is fine too: a family or key it leaves out falls back to
English. Type it as `LocaleCatalog` (from `@salmonui/core/locale`) and give
each family the type of its component's `localeText` prop
(`DataGridLocaleText`, ...) to have TypeScript check the keys.

Packs shipped with Salmon UI live under `packages/core/src/locale/<tag>/`
and are checked by a coverage test
(`tooling/checks/tests/locale-coverage.test.mjs`): it finds every family the
components read and fails when a pack misses a family or a key, or has a key
the English defaults do not. A new component string therefore cannot ship
untranslated. To contribute a pack, add `packages/core/src/locale/<tag>.ts`
with its per-package files, export it as the `@salmonui/core/locale/<tag>`
subpath and list it in the test's packs, which then checks it like
`zh-TW`.

## Data Grid strings

The Data Grid's own catalog (`dataGrid` in a pack) has the same keys as
its `localeText` prop; see [Localization](https://salmonui.dev/docs/data-grid/localization) for
the message format, number and date formats and the date editors.

## API reference

See [`LocaleProvider`](https://salmonui.dev/docs/reference/core/locale/LocaleProvider),
[`useLocale`](https://salmonui.dev/docs/reference/core/locale/useLocale) and
[`zhTW`](https://salmonui.dev/docs/reference/core/locale-zh-TW/zhTW) in the API reference.
