javascript - How can I determine which collation variants a browser supports for Intl.Collator for languages which have multiple "alphabetic orders"? -
javascript es6/harmony has language-specific sorting/collation.
now browsers differ in support i'm finding chrome languages use work , other don't.
but i'm having trouble languages such finnish, japanese, spanish, , swedish, have more 1 way of ordering text, finding ways supported browser?
intl.collator.supportedlocalesof accepts list of locales , returns ones supports, removes unicode extensions each locale before testing support. if do
intl.collator.supportedlocalesof("de-u-co-phonebk") and de locale supported phonebook sorting not supported, you'd ["de-u-co-phonebk"]. worse (because suspect support de locale pretty imply support phonebook sorting), if mistyped as
intl.collator.supportedlocalesof("de-u-co-phonebm") you'd ["de-u-co-phonebm"] potentially bad.
given that's out, think have individually attempt create collators locales, specifying possible unicode locale extensions care affect sort order, examine resolvedoptions().locale on collator see if unicode extension transferred over. example,
intl.collator("de-u-co-phonebk").resolvedoptions().locale will return "de-u-co-phonebk", while
intl.collator("de-u-co-phonebm").resolvedoptions().locale will return "de".
Comments
Post a Comment