Closed erickbelfy closed 3 years ago
The sorting is done via .localeCompare()
.
So for Chinese it doens't work properly it sorts wrong, is there a way to provide a provide a sorting attribute where we can do our own sorting? instead of creating our own select just for two languages?
Currently there's no such possibility. You can create a bug somewhere in W3C spec discussion repos or somewhere and report your case to them.
Thanks for fast reply, i will close it.
I mean, it would be easy to add some custom compareStrings()
property to the component:
https://gitlab.com/catamphetamine/react-phone-number-input/-/blob/995f7643f79306f2e2267e3bb1f429f678a45d21/source/phoneInputHelpers.js#L53
https://gitlab.com/catamphetamine/react-phone-number-input/-/blob/995f7643f79306f2e2267e3bb1f429f678a45d21/source/PhoneInputWithCountry.js#L471
https://gitlab.com/catamphetamine/react-phone-number-input/-/blob/995f7643f79306f2e2267e3bb1f429f678a45d21/source/PhoneInputWithCountry.js#L672
But if something like that was added, would it advocate people using an incorrect approach to implementing sorting?
Why wouldn't .localeCompare()
produce the correct results all the time?
There can be different "collations" for same locales too, read MDN for what it is.
for chinese traditional and simplified it doesn't , it puts libanon as a last position for instance. this means that .localeCompare is broken, i say that based on a language we can provide some particular sorting methods
the country selects gets unsorted when using these locales. is there any property we can pass to define sorting ourselves?