From: msweet Date: Wed, 19 Nov 2014 15:18:33 +0000 (+0000) Subject: Command-line programs were not localized on Mac OS X () X-Git-Tag: v2.2b1~437 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=b2656447cee661a40be821b0046f07b384a722c5;p=thirdparty%2Fcups.git Command-line programs were not localized on Mac OS X () git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12262 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-2.0.txt b/CHANGES-2.0.txt index e00e1233c8..da44da732c 100644 --- a/CHANGES-2.0.txt +++ b/CHANGES-2.0.txt @@ -1,6 +1,12 @@ CHANGES-2.0.txt --------------- +CHANGES IN CUPS V2.0.2 + + - Command-line programs were not localized on Mac OS X + () + + CHANGES IN CUPS V2.0.1 - Security: SSLv3 is now disabled by default to protect against the diff --git a/cups/language.c b/cups/language.c index fdc06cba1e..dcc1449305 100644 --- a/cups/language.c +++ b/cups/language.c @@ -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.");