# Module /i18n/context

Dynamic locale scoping and translated message lookup context (t, with-locale) for multilingual applications.

```tangu
(use /i18n/context)
```

## Structs

### Bundle

`Struct` in `/i18n/context`

Structured i18n translation bundle with normalized locale catalogs and explicit fallbacks.

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `default-locale` | `String` | `—` | — |
| `locales` | `Map` | `—` | — |
| `fallbacks` | `Map` | `—` | — |

## Constants

### *bundle*

`Constant (Any)`

Active ICU/catalog translation bundle dynamically scoped via `let-ds`.

### *locale*

`Constant (Any)`

Active BCP 47 locale tag dynamically scoped via `let-ds` (default `"en"`).

## Functions & symbols

### Bundle-construct

`(Bundle-construct input ...rest)`

Constructs a normalized `Bundle` from `{:en {...} :el {...}}` (plus optional opts)
or `{:default-locale "en" :locales {...} :fallbacks {...}}`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `input` | `Any` | no | — |
| `rest` | `Any` | yes | — |

### clear-registered-bundles!

`(clear-registered-bundles!)`

Clears all entries from the global bundle registry (intended for isolated test suites).

### current-bundle

`(current-bundle)`

Returns the currently bound translation bundle from dynamic scope (or ()).

### current-language

`(current-language)`

Returns the normalized lowercase base language subtag (e.g. "el-GR" -> "el").

### current-locale

`(current-locale)`

Returns the active locale tag from dynamic scope, defaulting to "en".

### localize-field

`(localize-field entity field ...rest)`

Resolves a localized field from a domain entity (`entity:names`, `entity:field` map, `field-<lang>`, or fallback string).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `entity` | `Any` | no | — |
| `field` | `Any` | no | — |
| `rest` | `Any` | yes | — |

### register-bundle

`(register-bundle ns bundle)`

Registers a `Bundle` under namespace `ns` (overwriting any existing entry for `ns`) and returns it.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `ns` | `Any` | no | — |
| `bundle` | `Any` | no | — |

### registered-bundle

`(registered-bundle ns)`

Looks up a previously registered `Bundle` by namespace `ns` (returns `()` if unregistered).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `ns` | `Any` | no | — |

### t

`(t key ...rest)`

Translates `key` against registered `:ns/key` bundles or dynamic `*bundle*` and `*locale*`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `key` | `Any` | no | — |
| `rest` | `Any` | yes | — |

### t-html

`(t-html key ...rest)`

Renders a translation message into an `#html`-spliceable fragment Array preserving structured HTML params.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `key` | `Any` | no | — |
| `rest` | `Any` | yes | — |

### unregister-bundle

`(unregister-bundle ns)`

Removes any registered bundle for namespace `ns`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `ns` | `Any` | no | — |

### validate-bundle

`(validate-bundle bundle)`

Validates locale parity across all keys, plural `:other` fallbacks, and `{var}` placeholders.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `bundle` | `Any` | no | — |

### validate-registered-bundles

`(validate-registered-bundles)`

Validates all currently registered bundles with `validate-bundle` and aggregates parity reports.
