useCollator @astryx-svelte/core v0.4.5 · i18n
Usage
Returns the sanctioned locale-aware comparator for custom sorting. The collator is recreated when the provider locale or an option changes.tsimport { i18n } from '@astryx-svelte/core';
Best practices
| Guidance | Practices |
|---|---|
| Do | Reuse collator.compare in custom Table comparators and other user-visible string ordering. |
| Don't | Construct Intl.Collator directly or call localeCompare; those bypass the provider-backed locale contract. |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
options | () => Intl.CollatorOptions | — | Optional collation behavior such as numeric ordering, sensitivity, punctuation handling, and case order. |
Returns
| Field | Type | Default | Description |
|---|---|---|---|
collator | Intl.Collator | — | A memoized collator bound to the active InternationalizationProvider locale. Not declared by core, so this type is mapped from upstream's rather than read from the compiler. |