@formatjs/intl-enumerator
Version:
Intl.Enumerator polyfill
11 lines (10 loc) • 363 B
JavaScript
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));
}