useLocale@astryxdesign/core v0.5.2 · useLocale

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.

ts
import {useLocale} from '@astryxdesign/core/i18n'

Best practices

GuidancePractices
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

FieldTypeDescription
locale

The active InternationalizationProvider BCP 47 locale. Falls back to 'en' when no provider is present.