UNPKG

@formatjs/intl-enumerator

Version:
11 lines (10 loc) 363 B
import { collations } from "./collations.generated.js"; function isSupported(collation, locale = "en") { try { return Intl.Collator(`${locale}-u-co-${collation}`).resolvedOptions().collation === collation; } catch {} return false; } export function getSupportedCollations(locale) { return collations.filter((collation) => isSupported(collation, locale)); }