summaryrefslogtreecommitdiff
path: root/cups/language.c
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-11-19 15:18:33 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-11-19 15:18:33 +0000
commitb2656447cee661a40be821b0046f07b384a722c5 (patch)
treeb5d5679eea8f5bf08cfa2bf0cfc1c46249cb29a3 /cups/language.c
parent6028693e0d17e0630635385819da97e35c516d9b (diff)
downloadcups-b2656447cee661a40be821b0046f07b384a722c5.tar.gz
Command-line programs were not localized on Mac OS X (<rdar://problem/14546232>)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12262 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/language.c')
-rw-r--r--cups/language.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/cups/language.c b/cups/language.c
index fdc06cba1..dcc144930 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.");