adium/adium

Parents 4a5092083b6b
Children 70630a47af92
Patch from rafaelglauber: Changed from "caseInsensitiveCompare" to "localizedCaseInsensitive" to get the correct ordering for languages like Swedish

Fixes #12678
--- a/Source/AIAlphabeticalSort.m Wed May 16 15:00:13 2012 +0200
+++ b/Source/AIAlphabeticalSort.m Mon May 21 22:02:27 2012 +0200
@@ -137,6 +137,8 @@
NSInteger alphabeticalSort(id objectA, id objectB, BOOL groups, id<AIContainingObject> container)
{
//If we were not passed groups or if we should be sorting groups, sort alphabetically
+
+ // Changed from "caseInsensitiveCompare" to "localizedCaseInsensitive" to get the correct ordering for languages like Swedish
if (!groups) {
if (sortByLastName) {
NSString *space = @" ";
@@ -145,21 +147,21 @@
NSArray *componentsA = [displayNameA componentsSeparatedByString:space];
NSArray *componentsB = [displayNameB componentsSeparatedByString:space];
- NSComparisonResult returnValue = [[componentsA lastObject] caseInsensitiveCompare:[componentsB lastObject]];
+ NSComparisonResult returnValue = [[componentsA lastObject] localizedCaseInsensitiveCompare:[componentsB lastObject]];
//If the last names are the same, compare the whole object, which will amount to sorting these objects by first name
if (returnValue == NSOrderedSame) {
- returnValue = [displayNameA caseInsensitiveCompare:displayNameB];
+ returnValue = [displayNameA localizedCaseInsensitiveCompare:displayNameB];
}
return (returnValue);
} else {
- return [[objectA longDisplayName] caseInsensitiveCompare:[objectB longDisplayName]];
+ return [[objectA longDisplayName] localizedCaseInsensitiveCompare:[objectB longDisplayName]];
}
} else {
//If sorting groups, do a caseInsesitiveCompare; otherwise, keep groups in manual order
if (sortGroups) {
- return [[objectA longDisplayName] caseInsensitiveCompare:[objectB longDisplayName]];
+ return [[objectA longDisplayName] localizedCaseInsensitiveCompare:[objectB longDisplayName]];
} else if ([container orderIndexForObject:objectA] > [container orderIndexForObject:objectB]) {
return NSOrderedDescending;
} else {