adium 4834:77986f019c23: Patch from rafaelglauber: Changed from ...

commits at adium.im commits at adium.im
Mon May 21 20:02:37 UTC 2012


details:	http://hg.adium.im/adium/rev/77986f019c23
revision:	4834:77986f019c23
branch:		adium-1.5.1
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Mon May 21 22:02:27 2012 +0200

Patch from rafaelglauber: Changed from "caseInsensitiveCompare" to "localizedCaseInsensitive" to get the correct ordering for languages like Swedish

Fixes #12678

diffs (38 lines):

diff -r 4a5092083b6b -r 77986f019c23 Source/AIAlphabeticalSort.m
--- 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 {




More information about the commits mailing list