* See if we have an Info.plist file in the bundle...
*/
- CFStringGetCString(cfpath, path,sizeof(path), kCFStringEncodingUTF8);
+ CFStringGetCString(cfpath, path, sizeof(path), kCFStringEncodingUTF8);
DEBUG_printf(("3appleLangDefault: Got a resource URL (\"%s\")", path));
strlcat(path, "Contents/Info.plist", sizeof(path));
if (localizationList)
{
-
#ifdef DEBUG
if (CFGetTypeID(localizationList) == CFArrayGetTypeID())
DEBUG_printf(("3appleLangDefault: Got localizationList, %d entries.",
strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
}
}
+ else
+ DEBUG_printf(("3appleLangDefault: Using previous locale \"%s\".", cg->language));
/*
* Return the cached locale...
*
* PPD file routines for CUPS.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
char custom_name[PPD_MAX_NAME];
/* CustomFoo attribute name */
ppd_attr_t *custom_attr; /* CustomFoo attribute */
- char ll[4], /* Language + '.' */
- ll_CC[7]; /* Language + country + '.' */
- size_t ll_len = 0, /* Language length */
- ll_CC_len = 0; /* Language + country length */
+ char ll[7], /* Base language + '.' */
+ ll_CC[7]; /* Language w/country + '.' */
+ size_t ll_len = 0, /* Base language length */
+ ll_CC_len = 0; /* Language w/country length */
static const char * const ui_keywords[] =
{
#ifdef CUPS_USE_FULL_UI_KEYWORDS_LIST
return (NULL);
snprintf(ll_CC, sizeof(ll_CC), "%s.", lang->language);
- snprintf(ll, sizeof(ll), "%2.2s.", lang->language);
+
+ /*
+ * <rdar://problem/22130168>
+ *
+ * Need to use a different base language for some locales...
+ */
+
+ if (!strcmp(lang->language, "zh_HK"))
+ strlcpy(ll, "zh_TW.", sizeof(ll));
+ else
+ snprintf(ll, sizeof(ll), "%2.2s.", lang->language);
ll_CC_len = strlen(ll_CC);
ll_len = strlen(ll);
*
* Localization test program for CUPS.
*
- * Copyright 2007-2010 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
};
- _cupsSetLocale(argv);
-
if (argc == 1)
{
language = cupsLangDefault();
{
language = cupsLangGet(argv[1]);
language2 = cupsLangGet(argv[1]);
+
+ setenv("LANG", argv[1], 1);
+ setenv("SOFTWARE", "CUPS/" CUPS_SVERSION, 1);
}
+ _cupsSetLocale(argv);
+
if (language != language2)
{
errors ++;
}
}
+ if (argc == 3)
+ {
+ ppd_file_t *ppd; /* PPD file */
+ ppd_option_t *option; /* PageSize option */
+ ppd_choice_t *choice; /* PageSize/Letter choice */
+
+ if ((ppd = ppdOpenFile(argv[2])) == NULL)
+ {
+ printf("Unable to open PPD file \"%s\".\n", argv[2]);
+ errors ++;
+ }
+ else
+ {
+ ppdLocalize(ppd);
+
+ if ((option = ppdFindOption(ppd, "PageSize")) == NULL)
+ {
+ puts("No PageSize option.");
+ errors ++;
+ }
+ else
+ {
+ printf("PageSize: %s\n", option->text);
+
+ if ((choice = ppdFindChoice(option, "Letter")) == NULL)
+ {
+ puts("No Letter PageSize choice.");
+ errors ++;
+ }
+ else
+ {
+ printf("Letter: %s\n", choice->text);
+ }
+ }
+
+ ppdClose(ppd);
+ }
+ }
+
return (errors > 0);
}