Reviewed by Hyatt.
[WebKit-https.git] / WebKit / Misc.subproj / WebNSUserDefaultsExtras.m
index ee50a08196efda8a659e0e084eb7715e7f0603cf..3f20928321b7a9120590d056cbd7617d64301c63 100644 (file)
@@ -6,8 +6,8 @@
 
 #import <WebKit/WebNSUserDefaultsExtras.h>
 
-#import <CoreFoundation/CFBundlePriv.h>
 #import <WebKit/WebAssertions.h>
+#import <WebKitSystemInterface.h>
 
 @implementation NSString (WebNSUserDefaultsPrivate)
 
 {
     // Look up the language code using CFBundle.
     NSString *languageCode = self;
-    SInt32 languageCodeNumber, regionCodeNumber;
-    if (CFBundleGetLocalizationInfoForLocalization((CFStringRef)self, &languageCodeNumber, &regionCodeNumber, NULL, NULL)) {
-        CFStringRef shortName = CFMakeCollectable(CFBundleCopyLocalizationForLocalizationInfo(languageCodeNumber, regionCodeNumber, -1, 0xFFFF));
-        if (shortName) {
-            languageCode = [(id)shortName autorelease];
-        }
-    }
+    NSString *preferredLanguageCode = [(id)WKCopyCFLocalizationPreferredName((CFStringRef)self) autorelease];
+
+    if (preferredLanguageCode)
+        languageCode = preferredLanguageCode;
     
     // Make the string lowercase.
     NSString *lowercaseLanguageCode = [languageCode lowercaseString];