Internationalization Provider
@astryxdesign/core v0.7.1 · InternationalizationProvider
Props
| Prop | Type | Default | Description |
|---|---|---|---|
locale | 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. Required. |
messages | ProviderMessagesByLocale | — | Map of BCP 47 tag to a catalog keyed by the original @astryx.* message keys. A catalog replaces the shipped text for that locale. The built-in "en" and "zh-CN" catalogs are always available and do not need to be listed. |
overrides | ProviderOverrides | — | Sparse per-locale key overrides applied on top of the messages catalog, or on top of the built-in text when there is none. Overrides are locale-keyed so a runtime locale swap picks up the correct set. |
dir | 'ltr' | 'rtl' | derived from locale | Explicit text direction for the context. When omitted, direction is derived from the locale. It sets the direction Astryx reads, but it does NOT set the DOM dir attribute; set that yourself on <html> or a wrapping element and keep the two in sync. |
Slots
| Slot | Description |
|---|---|
default | The subtree that reads this locale, catalog set, and direction. |
Exports
| Export | Type | Description |
|---|---|---|
getLocaleDirection | (locale: string) => 'ltr' | 'rtl' | Direction for a language tag. Uses Intl.Locale#getTextInfo when the runtime has it, otherwise a right-to-left language list. An unparseable tag reads as 'ltr'. |
useLocaleDirection | () => ComputedRef<'ltr' | 'rtl'> | The direction of the nearest provider, or one derived from the nearest locale. |
ProviderMessagesByLocale | Record<string, AstryxUpstreamCatalog> | Type of messages. The catalog value is a Record<string, string | { defaultMessage: string }> keyed by @astryx.*. |
ProviderOverrides | ProviderMessagesByLocale | Type of overrides. |
Native attributes
The component renders no element of its own, so class and style are not forwarded.