EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
i18n·hook·@astryxdesign/core

useCollator

Returns the sanctioned locale-aware comparator for custom sorting. The collator is recreated when the provider locale or an option changes.

@astryxdesign/core/i18n

Signature

Call shape
useCollator(options?: Intl.CollatorOptions): Intl.Collator
Parameters
NameType and behavior
optionsIntl.CollatorOptions · optional
Optional collation behavior such as numeric ordering, sensitivity, punctuation handling, and case order.
Returns
NameType and behavior
collatorIntl.Collator
A memoized collator bound to the active InternationalizationProvider locale.

Usage

Returns the sanctioned locale-aware comparator for custom sorting. The collator is recreated when the provider locale or an option changes.

  • Reuse collator.compare in custom Table comparators and other user-visible string ordering.
  • Construct Intl.Collator directly or call localeCompare; those bypass the provider-backed locale contract.