问题
I am adding Chinese support to my application.
I have this line that sorts english and other languages
NSSortDescriptor *sortByItem = [NSSortDescriptor sortDescriptorWithKey:@"countryName" ascending:YES
selector:@selector(localizedStandardCompare:)];
But this line appears not to be sorting in Chinese.
How do I modify this line so it will sort in Chinese?
回答1:
Your assumption that NSSortDescriptor
is wrong and Numbers is correct is not a good assumption. It depends on what locale you used in each case (was your iOS device in a Chinese locale? Was your Mac?) Chinese is generally sorted by radical+stroke, but you need a little experience to know how to break characters down into this form. I would frankly trust NSSortDescriptor
first in any case. Numbers is hardly the gold standard in such things.
Your best bet if you're working on localizing is to engage a service that specializes in that to help you. If you don't have enough experience in the language to know if you're sorting correctly, then it's hard to imagine getting the rest correct.
来源:https://stackoverflow.com/questions/29868944/nssortdescriptor-in-chinese-how