Usage
Wraps your app to set the active locale and (optionally) merge additional translation catalogs + per-locale overrides. Astryx components inside the subtree resolve their strings against this context. If no provider is present, components fall back to the shipped English defaults.
tsimport {InternationalizationProvider} from '@astryxdesign/core/i18n'
Best practices
| Guidance | Practices |
|---|---|
| Do | Use shipped Astryx locale catalogs from |
| Do | Use a same-shape local catalog only when Astryx has not shipped that locale yet or you are testing in-progress translations. |
| Do | Use real BCP 47 tags such as |
| Do | Set the |
| Don't | Cast custom catalog maps to |
Props
| Prop | Type | Description |
|---|---|---|
localerequired | string | BCP 47 language tag for the active locale (e.g. "en", "pt", "pt-BR", "zh-Hans"). Regional tags fall back to their base language, then to the shipped "en" catalog. |
childrenrequired | ReactNode | Content to render with the internationalization provider. |
messages | MessagesByLocale | Optional map of BCP 47 tag to translation catalog. Import shipped catalogs from |
overrides | Overrides | Sparse per-locale key overrides applied on top of shipped defaults. Overrides are locale-keyed so a runtime locale swap picks up the correct set. |
dir | 'ltr' | 'rtl' | Explicit text-direction override for the context. When omitted, direction is derived from |
Examples
Common configurations, variations, and states.Load a locale catalog shipped by Astryx and re-render InternationalizationProvider with a new locale to update Astryx strings live.
Override a small number of Astryx strings without providing a full locale catalog.
Toggle text direction with the dir prop and watch Astryx components mirror. Pagination flips its prev/next chevrons under RTL. The dir prop is passed to both InternationalizationProvider (so Astryx components pick it up) and the VStack (so the DOM subtree mirrors); both channels stay in sync with no extra wrapper.