From 9d86391bdb052d0858c48625dee0f18ec19948f7 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Tue, 14 May 2013 13:30:30 +0200 Subject: [PATCH] Fixed: CPLocal can't handle unknown language codes When the language code is not known it still sets the current language code to the unknown code instead of the defualt 'en_US' code. This makes the test cases for CPDateFormatter fail when run on a foreign system. --- Foundation/CPLocale.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Foundation/CPLocale.j b/Foundation/CPLocale.j index 01945215c..2d46d68f8 100644 --- a/Foundation/CPLocale.j +++ b/Foundation/CPLocale.j @@ -101,7 +101,7 @@ var sharedSystemLocale = nil, language = [CPString stringWithFormat:@"%s_%s", [language lowercaseString], [language uppercaseString]]; - if ([availableLocaleIdentifiers indexOfObject:language]) + if ([availableLocaleIdentifiers indexOfObject:language] !== CPNotFound) localeIdentifier = language; }