useCollator@astryxdesign/core v0.5.2 · useCollator
Usage
Returns the sanctioned locale-aware comparator for custom sorting. The collator is recreated when the provider locale or an option changes.
tsimport {useCollator} from '@astryxdesign/core/i18n'
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
| Param | Type | Description |
|---|---|---|
options | Intl.CollatorOptions | Optional collation behavior such as numeric ordering, sensitivity, punctuation handling, and case order. |
Returns
| Field | Type | Description |
|---|---|---|
| collator | Intl.Collator | A memoized collator bound to the active InternationalizationProvider locale. |