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'
Anatomy
| Element | Description |
|---|---|
| Provider boundary | Required: A nonvisual context boundary that supplies locale, message catalogs, overrides, and direction to descendant Astryx components, and a calendar system to |
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 |
| Do | Set |
| 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 | ProviderMessagesByLocale | Optional map of BCP 47 tag to a rich or generated runtime catalog. Import compact 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 |
calendar | 'gregory' | 'iso8601' | 'buddhist' | 'roc' | 'japanese' | 'persian' | 'indian' | 'hebrew' | 'chinese' | 'dangi' | 'coptic' | 'ethiopic' | 'ethioaa' | 'islamic-civil' | 'islamic-tbla' | 'islamic-umalqura' | Calendar system of the subtree, such as 'persian', 'hebrew', or 'buddhist'. |
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.
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.
Reword an Astryx string for every component under the provider, without a full locale catalog. One component rewords its own string through its prop, such as Selector placeholder.
Use with shadcn
Already using the shadcn registry workflow? Install the real Astryx package and a local public re-export. Component implementation source stays in Astryx.
This install URL expires with the draft preview.bashnpx shadcn@4.19.0 add https://astryx-oavgaeu70-fbopensource.vercel.app/shadcn/components/internationalization-provider.json