# @askrjs/i18n

> Published API exports for @askrjs/i18n.

Source: [https://askrjs.com/docs/reference/api/i18n/root](https://askrjs.com/docs/reference/api/i18n/root)

Status: stable. Packages: @askrjs/i18n.

**Published packages are authoritative.** Examples may lag behind a published contract. When guidance differs, verify the exports and TypeScript declarations in your installed package, then file an issue.

## Exports

This entrypoint publishes 7 exports from the declarations shipped by @askrjs/i18n.

### `Catalog`

```ts
Catalog: Readonly<Record<string, CatalogMessage>>
```

Read-only map of message keys to typed message functions.

### `CatalogMessage`

```ts
CatalogMessage: (...args: Args) => string
```

Typed message function in a locale catalog.

### `createI18n`

```ts
createI18n: <const SourceLocale extends string, const Catalogs extends Record<SourceLocale, Catalog>>(sourceLocale: SourceLocale, catalogs: Catalogs & ValidCatalogs<Catalogs, SourceLocale>) => I18n<Catalogs>
```

Creates an application-owned internationalization service.

Catalog values are ordinary typed TypeScript functions. Locale selection is
intentionally left to the application and installed lexically through Scope.

### `I18n`

```ts
I18n: any
```

Typed internationalization service backed by aligned locale catalogs.

- `catalogs`: Frozen catalogs supplied at creation time.

- `Scope`: JSX scope component that installs the active locale.

- `text`: Format a message in the active locale.

- `format`: Format a message in an explicitly selected locale.

- `locale`: Read the active locale.

- `direction`: Read the active locale's text direction.

- `catalog`: Read the active catalog identifier.

- `dehydrate`: Serialize the active locale state for hydration.

### `I18nHydration`

```ts
I18nHydration: Readonly<{
  /** Snapshot schema version. */
  version: 1;
  /** Active locale. */
  locale: Locale;
  /** Text direction for the locale. */
  dir: TextDirection;
  /** Catalog selected for the locale. */
  catalog: Locale;
}>
```

Serializable locale state for SSR hydration.

### `I18nScopeProps`

```ts
I18nScopeProps: {
  locale: Locale;
  dir?: TextDirection;
  hydration?: never;
  children?: unknown;
} | {
  locale?: never;
  dir?: never;
  hydration: I18nHydration<Locale>;
  children?: unknown;
}
```

Props for installing locale state through the Scope component.

- `children`: children?: unknown;

- `dir`: dir?: TextDirection | undefined;

- `hydration`: hydration?: Readonly<{ version: 1; locale: Locale; dir: TextDirection; catalog: Locale; }> | undefined;

- `locale`: locale?: Locale | undefined;

### `TextDirection`

```ts
TextDirection: "ltr" | "rtl"
```

Text direction used by a locale.

## Documentation navigation

[Previous](https://askrjs.com/docs/reference/api/fetch/middleware/index.md) | [Next](https://askrjs.com/docs/reference/api/logos/root/index.md)
