# caique/locale

> Every export of caique/locale, with its signature and doc comment: checkLocales, render, sayFor, plus 2 types.

Source: https://caique.interlace.tools/docs/api/locale

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

```ts
import { checkLocales, render, sayFor } from 'caique/locale';
```

## Functions

### checkLocales

R6 — refuse a pack whose caique messages cannot be rendered: an id caique does not have, a
placeholder the English lacks, a plural message missing a form its locale selects. Ids that
do not begin `caique.` are another package's and are left to it. A tag is burgee's to check,
which reads it the same way; here it only has to name an object.

```ts
function checkLocales(plugin: {
    name: string;
    locales?: unknown;
}): void;
```

| Parameter | Type |
| :-- | :-- |
| `plugin` | `{ name: string; locales?: unknown; }` |

**Returns** `void`

### render

A checked message in `locale`, with the values put back: the plural form by `count`, then each `{name}`.

```ts
function render(message: Message, values: Readonly<Record<string, string>>, locale: string): string;
```

| Parameter | Type |
| :-- | :-- |
| `message` | `Message` |
| `values` | `Readonly<Record<string, string>>` |
| `locale` | `string` |

**Returns** `string`

### sayFor

```ts
function sayFor(locale: string | undefined): (english: string) => string;
```

| Parameter | Type |
| :-- | :-- |
| `locale` | `string \| undefined` |

**Returns** `(english: string) => string`

## Types

### Locales

A pack's `locales`: language tag → message id → translation. Ids outside `caique.` are another package's.

```ts
type Locales = Readonly<Record<string, Readonly<Record<string, Message>>>>;
```

### Message

A translation: one string, or — for a message that carries `{count}` — one per plural form.

```ts
type Message = string | Readonly<Partial<Record<Intl.LDMLPluralRule, string>>>;
```
