useLocale
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.
@astryxdesign/core/i18n
Signature
Call shape
useLocale(): LocaleReturns
| Name | Type and behavior |
|---|---|
locale | LocaleThe active InternationalizationProvider BCP 47 locale. Falls back to 'en' when no provider is present. |
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.
- Pass the returned locale to pure Astryx helpers or package APIs that require an explicit locale.
- Use navigator.language or a hardcoded display locale as a fallback; InternationalizationProvider is the locale source.