# Locale Settings

> The Language & region section of settings: a language listed by its own name, a region that drives every Automatic format, a time zone, then date format, 12 or 24-hour time, first day of the week, number separators and currency. A live preview with a week strip and a sample under each row are formatted with Intl from the draft, Detect from browser fills it all, and a save bar holds changes.

- Slug: `locale-settings`
- Category: [Settings](https://www.assembli.design/category/settings.md)
- Type: block
- Tags: language, region, locale, timezone, date-format, settings, i18n
- npm dependencies: @base-ui/react, lucide-react
- shadcn/ui dependencies: @assembli/timezone-select, @assembli/unsaved-changes-bar
- Live preview: https://www.assembli.design/preview/locale-settings
- Page: https://www.assembli.design/components/locale-settings

![Locale Settings preview](https://www.assembli.design/thumbnails/locale-settings-light.png)

## Props

Other props pass through to the root element.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` (required) | `LocaleValue` |  |  |
| `onSave` | `(value: LocaleValue) => Promise<unknown> \| void` |  | Persist the settings. Reject to keep the changes and show the error in the save bar. |
| `languages` | `LocaleLanguage[]` | `LOCALE_LANGUAGES` |  |
| `regions` | `LocaleRegion[]` | `LOCALE_REGIONS` |  |
| `currencies` | `string[]` | `LOCALE_CURRENCIES` |  |
| `sample` | `string \| number \| Date` |  | The moment the previews show. Defaults to the reader's clock. |
| `sampleAmount` | `number` | `1234.56` | Amount shown in the number and currency previews. |
| `barStrategy` | `"fixed" \| "absolute"` | `"fixed"` | `fixed` floats the save bar over the viewport; `absolute` pins it to the nearest positioned ancestor. |
| `title` | `React.ReactNode` | `"Language & region"` |  |
| `description` | `React.ReactNode` | `"Choose the language Northwind speaks and how dates, times …` |  |

## Install

One-time setup (needs a subscription):

1. Add the registry to the project's `components.json`: `{"@assembli":{"url":"https://www.assembli.design/r/{name}.json","headers":{"Authorization":"Bearer ${ASSEMBLI_API_KEY}"}}}` (merge into `"registries"`).
2. Put an API key from https://www.assembli.design/account in `.env.local` as `ASSEMBLI_API_KEY=asm_…`.

Then install with the shadcn CLI (writes `components/locale-settings/locale-settings.tsx` and installs dependencies):

```bash
npx shadcn@latest add @assembli/locale-settings
```

Registry item JSON: https://www.assembli.design/r/locale-settings.json (send `Authorization: Bearer <api key>`)

## Code

> Component source needs an Assembli subscription ($12/month or $96/year) and an API key sent as `Authorization: Bearer <key>`. To get one without copying anything, POST https://www.assembli.design/api/agent/login (or call the MCP tool connect_account), show the user the link it returns, and poll https://www.assembli.design/api/agent/token for the key. Or subscribe at https://www.assembli.design/pricing and create a key at https://www.assembli.design/account.
