useLocale @astryx-svelte/core v0.4.5 · i18n
Usage
Reads the authoritative Astryx locale. Use it to thread the provider locale into pure formatting helpers and sibling-package APIs; do not derive a second locale from navigator.language or a hardcoded literal.tsimport { i18n } from '@astryx-svelte/core';
Best practices
| Guidance | Practices |
|---|---|
| Do | Pass the returned locale to pure Astryx helpers or package APIs that require an explicit locale. |
| Don't | Use navigator.language or a hardcoded display locale as a fallback; InternationalizationProvider is the locale source. |
Returns
| Field | Type | Default | Description |
|---|---|---|---|
locale | Locale | — | The active InternationalizationProvider BCP 47 locale. Falls back to 'en' when no provider is present. Not declared by core, so this type is mapped from upstream's rather than read from the compiler. |