]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Command-line programs were not localized on Mac OS X (<rdar://problem/14546232>)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 19 Nov 2014 15:18:33 +0000 (15:18 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 19 Nov 2014 15:18:33 +0000 (15:18 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12262 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-2.0.txt
cups/language.c

index e00e1233c87aba9ddb6e14c836ff6be00ca42995..da44da732c42d86b9b474832b8335fd015148ca9 100644 (file)
@@ -1,6 +1,12 @@
 CHANGES-2.0.txt
 ---------------
 
+CHANGES IN CUPS V2.0.2
+
+       - Command-line programs were not localized on Mac OS X
+         (<rdar://problem/14546232>)
+
+
 CHANGES IN CUPS V2.0.1
 
        - Security: SSLv3 is now disabled by default to protect against the
index fdc06cba1ef759bc1cc504176560aba39480118a..dcc1449305deef45710c2fd0c3b0544dd1cd9b36 100644 (file)
@@ -1139,7 +1139,7 @@ appleLangDefault(void)
   int                  i;              /* Looping var */
   CFBundleRef          bundle;         /* Main bundle (if any) */
   CFArrayRef           bundleList;     /* List of localizations in bundle */
-  CFPropertyListRef    localizationList;
+  CFPropertyListRef    localizationList = NULL;
                                        /* List of localization data */
   CFStringRef          languageName;   /* Current name */
   CFStringRef          localeName;     /* Canonical from of name */
@@ -1165,14 +1165,42 @@ appleLangDefault(void)
     else if ((bundle = CFBundleGetMainBundle()) != NULL &&
              (bundleList = CFBundleCopyBundleLocalizations(bundle)) != NULL)
     {
+      CFURLRef resources = CFBundleCopyResourcesDirectoryURL(bundle);
+
       DEBUG_puts("3appleLangDefault: Getting localizationList from bundle.");
 
-      localizationList =
-         CFBundleCopyPreferredLocalizationsFromArray(bundleList);
+      if (resources)
+      {
+        CFStringRef    cfpath = CFURLCopyPath(resources);
+       char            path[1024];
+
+        if (cfpath)
+       {
+        /*
+         * See if we have an Info.plist file in the bundle...
+         */
+
+         CFStringGetCString(cfpath, path,sizeof(path), kCFStringEncodingUTF8);
+         DEBUG_printf(("3appleLangDefault: Got a resource URL (\"%s\")", path));
+         strlcat(path, "Contents/Info.plist", sizeof(path));
+
+          if (!access(path, R_OK))
+           localizationList = CFBundleCopyPreferredLocalizationsFromArray(bundleList);
+         else
+           DEBUG_puts("3appleLangDefault: No Info.plist, ignoring resource URL...");
+
+         CFRelease(cfpath);
+       }
+
+       CFRelease(resources);
+      }
+      else
+        DEBUG_puts("3appleLangDefault: No resource URL.");
 
       CFRelease(bundleList);
     }
-    else
+
+    if (!localizationList)
     {
       DEBUG_puts("3appleLangDefault: Getting localizationList from preferences.");