# @salmonui/core/locale API reference

> 4 exported symbols of @salmonui/core/locale: 1 component, 1 function, 1 interface and 1 type.

Canonical: https://salmonui.dev/docs/reference/core/locale

```ts
import { … } from '@salmonui/core/locale';
```

## Components

### LocaleProvider

Kind: component

Page: https://salmonui.dev/docs/reference/core/locale/LocaleProvider

```ts
function LocaleProvider({ locale, localeText, children }: LocaleProviderProps): ReactNode;
```

Sets the `locale` and the `localeText` defaults of every Salmon UI
component below it. Renders no element. Without a provider components use
their built-in English text and their own `locale` props, and pay nothing
for this module.

Props: [`LocaleProviderProps`](https://salmonui.dev/docs/reference/core/locale/LocaleProviderProps) (its members are the props)

## Functions

### useLocale

Kind: function

Page: https://salmonui.dev/docs/reference/core/locale/useLocale

```ts
function useLocale(): string | undefined;
```

The `locale` of the nearest `LocaleProvider`, or undefined outside one.

## Interfaces

### LocaleProviderProps

Kind: interface

Page: https://salmonui.dev/docs/reference/core/locale/LocaleProviderProps

```ts
interface LocaleProviderProps {
    readonly locale?: string | undefined;
    readonly localeText?: LocaleCatalog | undefined;
    readonly children?: ReactNode;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `locale` | `readonly locale?: string \| undefined;` | optional | BCP 47 locale for dates, numbers and plural rules of every component below. Default: the outer provider's. |
| `localeText` | `readonly localeText?: LocaleCatalog \| undefined;` | optional | Per-family `localeText` defaults. Merged over the outer provider's, key by key. |
| `children` | `readonly children?: ReactNode;` | optional |  |

## Types

### LocaleCatalog

Kind: type

Page: https://salmonui.dev/docs/reference/core/locale/LocaleCatalog

```ts
type LocaleCatalog = {
    readonly [family: string]: object | undefined;
};
```

Text catalog of a `LocaleProvider`: per component family, the keys of that
component's `localeText` prop. A locale pack (`@salmonui/core/locale/zh-TW`)
is one; applications may also pass their own or spread a pack and override.
