-[NSString localizedCompare:], CFStringCompare(..,kCFCompareLocalized)
-[NSString localizedCompare:], CFStringCompare(..,kCFCompareLocalized)
- Subject: -[NSString localizedCompare:], CFStringCompare(..,kCFCompareLocalized)
- From: email@hidden
- Date: Thu, 21 Nov 2002 15:04:27 -0700
I am unable to get the results I am expecting from the localized
comparison routines -[NSString localizedCompare] and
CFStringCompare(..,kCFCompareLocalized).
The extent of the documentation is:
- (NSComparisonResult)localizedCompare:(NSString *)string
Performs a localized compare between the receiver and string.
Either I am naive in my expectation of what a localized compare is
supposed to do, or this functionality is simply not yet implemented in
Cocoa. The "International" System Preferences panel suggests that the
latter conclusion is incorrect because the "Script" section (below
"Languages") contains the following description:
"These affect sort order, case conversion, and word definitions for the
selected script."
So apparently one is supposed to be able to get different sort orders
depending on the locale. If this is true, one would expect the
routines in question to return different results depending on the
locale, but they do not (at least for me).
A few examples of localized sorting:
Spanish: cat < czar < churo < darn ('ch' is treated as a single
character that follows 'c')
English: cat < churo < czar < darn
French accents: cote < ctte < coti < ctti (rightmost accent determines
sort order)
normal accents: cote < coti < ctte < ctti
Swedish: z < v
Germain: v < z
So my question is: Is this what is meant by "localizedCompare?" If so,
why is it not working? Am I doing something wrong, or is it not
implemented yet? (My application gets localized correctly except for no
apparent change in sort order. I also set both the "Language" and the
"Script Behavior" popup buttons in the Preferences panel)
One possibility is that "localizedCompare" has to do only with
composed-character Unicode comparisons. I do not think this is the
case because CoreFoundation has two constants, kCFCompareNonLiteral and
kCFCompareLocalized. kCFCompareNonLiteral deals with
composed-characters (v = o + (), leaving kCFCompareLocalized to deal
with sorting by locale (perhaps).
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.