- CUPS now sends the `Date` HTTP header in IPP requests (rdar://33302034)
- The `cupsGetNamedDest` function did not use the local default printer
(rdar://33228500)
+- The `cupsLocalizeDest*` functions did not provide base localizations for
+ all registered IPP attributes and values (Issue #5056)
CHANGES IN CUPS V2.2.4
*ltype; /* Localized media type */
+ DEBUG_printf(("cupsLocalizeDestMedia(http=%p, dest=%p, dinfo=%p, flags=%x, size=%p(\"%s\"))", (void *)http, (void *)dest, (void *)dinfo, flags, (void *)size, size ? size->media : "(null)"));
+
/*
* Range check input...
*/
if (!http || !dest || !dinfo || !size)
{
+ DEBUG_puts("1cupsLocalizeDestMedia: Returning NULL.");
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (NULL);
}
key.id = size->media;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations, &key)) != NULL)
+ {
+ DEBUG_printf(("1cupsLocalizeDestMedia: Returning \"%s\".", match->str));
return (match->str);
+ }
/*
* If not, get the localized size, source, and type strings...
*/
lang = cupsLangDefault();
+
+ snprintf(temp, sizeof(temp), "media.%s", size->media);
+ if ((lsize = _cupsLangString(lang, temp)) != NULL && strcmp(lsize, temp))
+ {
+ DEBUG_printf(("1cupsLocalizeDestMedia: Returning standard localization \"%s\".", lsize));
+ return (lsize);
+ }
+
pwg = pwgMediaForSize(size->width, size->length);
if (pwg->ppd)
* Use inches since the size is a multiple of 1/4 inch.
*/
- snprintf(temp, sizeof(temp), _cupsLangString(lang, _("%g x %g")), size->width / 2540.0, size->length / 2540.0);
+ snprintf(temp, sizeof(temp), _cupsLangString(lang, _("%g x %g \"")), size->width / 2540.0, size->length / 2540.0);
}
else
{
cupsArrayAdd(dinfo->localizations, match);
+ DEBUG_printf(("1cupsLocalizeDestMedia: Returning \"%s\".", match->str));
+
return (match->str);
}
{
_cups_message_t key, /* Search key */
*match; /* Matching entry */
+ const char *localized; /* Localized string */
+
+ DEBUG_printf(("cupsLocalizeDestOption(http=%p, dest=%p, dinfo=%p, option=\"%s\")", (void *)http, (void *)dest, (void *)dinfo, option));
if (!http || !dest || !dinfo)
return (option);
if (!dinfo->localizations)
cups_create_localizations(http, dinfo);
- if (cupsArrayCount(dinfo->localizations) == 0)
- return (option);
-
key.id = (char *)option;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
&key)) != NULL)
return (match->str);
+ else if ((localized = _cupsLangString(cupsLangDefault(), option)) != NULL)
+ return (localized);
else
return (option);
}
_cups_message_t key, /* Search key */
*match; /* Matching entry */
char pair[256]; /* option.value pair */
+ const char *localized; /* Localized string */
+ DEBUG_printf(("cupsLocalizeDestValue(http=%p, dest=%p, dinfo=%p, option=\"%s\", value=\"%s\")", (void *)http, (void *)dest, (void *)dinfo, option, value));
+
if (!http || !dest || !dinfo)
return (value);
+ if (!strcmp(option, "media"))
+ {
+ pwg_media_t *media = pwgMediaForPWG(value);
+ cups_size_t size;
+
+ strlcpy(size.media, value, sizeof(size.media));
+ size.width = media ? media->width : 0;
+ size.length = media ? media->length : 0;
+ size.left = 0;
+ size.right = 0;
+ size.bottom = 0;
+ size.top = 0;
+
+ return (cupsLocalizeDestMedia(http, dest, dinfo, CUPS_MEDIA_FLAGS_DEFAULT, &size));
+ }
+
if (!dinfo->localizations)
cups_create_localizations(http, dinfo);
- if (cupsArrayCount(dinfo->localizations) == 0)
- return (value);
-
snprintf(pair, sizeof(pair), "%s.%s", option, value);
key.id = pair;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
&key)) != NULL)
return (match->str);
+ else if ((localized = _cupsLangString(cupsLangDefault(), pair)) != NULL && strcmp(localized, pair))
+ return (localized);
else
return (value);
}
{
const char *s; /* Localized message */
+
+ DEBUG_printf(("_cupsLangString(lang=%p, message=\"%s\")", (void *)lang, message));
+
/*
* Range check input...
*/
*match; /* Matching message */
+ DEBUG_printf(("_cupsMessageLookup(a=%p, m=\"%s\")", (void *)a, m));
+
/*
* Lookup the message string; if it doesn't exist in the catalog,
* then return the message that was passed to us...
CFReadStreamRef stream = NULL; /* File stream */
CFPropertyListRef plist = NULL; /* Localization file */
#ifdef DEBUG
+ const char *cups_strings = getenv("CUPS_STRINGS");
+ /* Test strings file */
CFErrorRef error = NULL; /* Error when opening file */
#endif /* DEBUG */
* Load the cups.strings file...
*/
+#ifdef DEBUG
+ if (cups_strings)
+ {
+ DEBUG_puts("1appleMessageLoad: Using debug CUPS_STRINGS file.");
+ strlcpy(filename, cups_strings, sizeof(filename));
+ }
+ else
+#endif /* DEBUG */
+
snprintf(filename, sizeof(filename),
CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings",
_cupsAppleLanguage(locale, applelang, sizeof(applelang)));
* Try with original locale string...
*/
+ DEBUG_printf(("1appleMessageLoad: \"%s\": %s", filename, strerror(errno)));
snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);
}
* Try with just the language code...
*/
+ DEBUG_printf(("1appleMessageLoad: \"%s\": %s", filename, strerror(errno)));
+
strlcpy(baselang, locale, sizeof(baselang));
if (baselang[3] == '-' || baselang[3] == '_')
baselang[3] = '\0';
snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", baselang);
}
- DEBUG_printf(("1appleMessageLoad: filename=\"%s\"", filename));
-
if (access(filename, 0))
{
/*
* Try alternate lproj directory names...
*/
+ DEBUG_printf(("1appleMessageLoad: \"%s\": %s", filename, strerror(errno)));
+
if (!strncmp(locale, "en", 2))
locale = "English";
else if (!strncmp(locale, "nb", 2))
snprintf(filename, sizeof(filename),
CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);
- DEBUG_printf(("1appleMessageLoad: alternate filename=\"%s\"", filename));
}
+ DEBUG_printf(("1appleMessageLoad: filename=\"%s\"", filename));
+
url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
(UInt8 *)filename,
(CFIndex)strlen(filename), false);
}
else if (!value)
{
- printf("%s (%s)\n", option, cupsCheckDestSupported(http, dest, dinfo, option, NULL) ? "supported" : "not-supported");
+ printf("%s (%s - %s)\n", option, cupsLocalizeDestOption(http, dest, dinfo, option), cupsCheckDestSupported(http, dest, dinfo, option, NULL) ? "supported" : "not-supported");
if ((attr = cupsFindDestSupported(http, dest, dinfo, option)) != NULL)
{
case IPP_TAG_ENUM :
for (i = 0; i < count; i ++)
- printf(" %s\n", ippEnumString(option, ippGetInteger(attr, i)));
+ {
+ int val = ippGetInteger(attr, i);
+ char valstr[256];
+
+ snprintf(valstr, sizeof(valstr), "%d", val);
+ printf(" %s (%s)\n", ippEnumString(option, ippGetInteger(attr, i)), cupsLocalizeDestValue(http, dest, dinfo, option, valstr));
+ }
break;
case IPP_TAG_RANGE :
}
break;
+ case IPP_TAG_KEYWORD :
+ for (i = 0; i < count; i ++)
+ printf(" %s (%s)\n", ippGetString(attr, i, NULL), cupsLocalizeDestValue(http, dest, dinfo, option, ippGetString(attr, i, NULL)));
+ break;
+
case IPP_TAG_TEXTLANG :
case IPP_TAG_NAMELANG :
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
- case IPP_TAG_KEYWORD :
case IPP_TAG_URI :
case IPP_TAG_URISCHEME :
case IPP_TAG_CHARSET :
msgstr ""
"Project-Id-Version: CUPS 2.2.5\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "%-7s %-7.7s %-7d %-31.31s %.0f bytes"
msgstr ""
-#: cups/dest-localization.c:112
+#: cups/dest-localization.c:118
#, c-format
msgid "%d x %d mm"
msgstr ""
-#: cups/dest-localization.c:104
+#: cups/dest-localization.c:110
#, c-format
-msgid "%g x %g"
+msgid "%g x %g \""
msgstr ""
-#: cups/dest-localization.c:167 cups/dest-localization.c:174
+#: cups/dest-localization.c:173 cups/dest-localization.c:180
#, c-format
msgid "%s (%s)"
msgstr ""
-#: cups/dest-localization.c:181
+#: cups/dest-localization.c:187
#, c-format
msgid "%s (%s, %s)"
msgstr ""
-#: cups/dest-localization.c:158
+#: cups/dest-localization.c:164
#, c-format
msgid "%s (Borderless)"
msgstr ""
-#: cups/dest-localization.c:165 cups/dest-localization.c:172
+#: cups/dest-localization.c:171 cups/dest-localization.c:178
#, c-format
msgid "%s (Borderless, %s)"
msgstr ""
-#: cups/dest-localization.c:179
+#: cups/dest-localization.c:185
#, c-format
msgid "%s (Borderless, %s, %s)"
msgstr ""
"\"%s\": Bad uriScheme value \"%s\" - bad length %d (RFC 8011 section 5.1.7)." = "“%s”: Bad uriScheme value “%s” - bad length %d (RFC 8011 section 5.1.7).";
"%-7s %-7.7s %-7d %-31.31s %.0f bytes" = "%-7s %-7.7s %-7d %-31.31s %.0f bytes";
"%d x %d mm" = "%d x %d mm";
-"%g x %g" = "%g x %g";
+"%g x %g \"" = "%g x %g ″";
"%s (%s)" = "%s (%s)";
"%s (%s, %s)" = "%s (%s, %s)";
"%s (Borderless)" = "%s (Borderless)";
msgstr ""
"Project-Id-Version: CUPS 1.4.6\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2012-09-29 11:21+0200\n"
"Last-Translator: Àngel Mompó <mecatxis@gmail.com>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
msgstr ""
#, c-format
-msgid "%g x %g"
+msgid "%g x %g \""
msgstr ""
#, c-format
msgstr ""
"Project-Id-Version: CUPS 1.6\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2012-09-14 10:26+0100\n"
"Last-Translator: Jan Bartos <jan.bartos@madeta.cz>\n"
"Language-Team: Czech\n"
msgstr ""
#, c-format
-msgid "%g x %g"
+msgid "%g x %g \""
msgstr ""
#, c-format
msgstr ""
"Project-Id-Version: CUPS 2.0\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2016-09-17 18:45+0200\n"
"Last-Translator: Joachim Schwender <joachim.schwender@web.de>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgstr "%d×%d mm"
#, c-format
-msgid "%g x %g"
-msgstr "%g×%g"
+msgid "%g x %g \""
+msgstr ""
#, c-format
msgid "%s (%s)"
#~ msgstr ""
#~ " -d domain Browse/löse auf in der angegebenen Domäne."
+#~ msgid "%g x %g"
+#~ msgstr "%g×%g"
+
#~ msgid "720dpi"
#~ msgstr "720 dpi"
msgstr ""
"Project-Id-Version: CUPS 2.2\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2016-06-26 21:17+0100\n"
"Last-Translator: Juan Pablo González Riopedre <jpgriopedre@yahoo.es>\n"
"Language-Team: Spanish\n"
msgstr "%d x %d mm"
#, c-format
-msgid "%g x %g"
-msgstr "%g x %g"
+msgid "%g x %g \""
+msgstr ""
#, c-format
msgid "%s (%s)"
#~ "\"%s\": Valor uriScheme \"%s\" incorrecto - longitud %d incorrecta (RFC "
#~ "2911 sección 4.1.6)."
+#~ msgid "%g x %g"
+#~ msgstr "%g x %g"
+
#~ msgid "CD/DVD/Bluray"
#~ msgstr "CD/DVD/Bluray"
msgstr ""
"Project-Id-Version: CUPS 1.6\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2012-12-12 11:12+0100\n"
"Last-Translator: denis meramdjougoma <dcmeram@libertysurf.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgstr ""
#, c-format
-msgid "%g x %g"
+msgid "%g x %g \""
msgstr ""
#, c-format
msgstr ""
"Project-Id-Version: CUPS 1.6\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2013-07-14 12:00+0200\n"
"Last-Translator: Giovanni Scafora <giovanni@archlinux.org>\n"
"Language-Team: Arch Linux Italian Team <giovanni@archlinux.org>\n"
msgstr ""
#, c-format
-msgid "%g x %g"
+msgid "%g x %g \""
msgstr ""
#, c-format
msgstr ""
"Project-Id-Version: CUPS 2.0\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2014-11-15 19:27+0900\n"
"Last-Translator: OPFC TRANSCUPS <opfc-transcups@sourceforge.jp>\n"
"Language-Team: OPFC TRANSCUPS <opfc-transcups@sourceforge.jp>\n"
msgstr "%d x %d mm"
#, c-format
-msgid "%g x %g"
-msgstr "%g x %g"
+msgid "%g x %g \""
+msgstr ""
#, c-format
msgid "%s (%s)"
#~ msgid "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes"
#~ msgstr "%-6s %-10.10s %-4d %-10d %-27.27s %.0f バイト"
+#~ msgid "%g x %g"
+#~ msgstr "%g x %g"
+
#~ msgid "%s: Error - expected destination after \"-b\" option."
#~ msgstr "%s: エラー - \"-b\" オプションのあとに宛先が必要です。"
msgstr ""
"Project-Id-Version: CUPS 2.1.2\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2016-01-31 16:45-0200\n"
"Last-Translator: Rafael Fontenelle <rffontenelle@gmail.com>\n"
"Language-Team: Brazilian Portuguese <traducao-cups-pt-br@googlegroups.com>\n"
msgstr "%d x %d mm"
#, c-format
-msgid "%g x %g"
-msgstr "%g x %g"
+msgid "%g x %g \""
+msgstr ""
#, c-format
msgid "%s (%s)"
#~ msgid "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes"
#~ msgstr "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes"
+#~ msgid "%g x %g"
+#~ msgstr "%g x %g"
+
#~ msgid "720dpi"
#~ msgstr "720dpi"
msgstr ""
"Project-Id-Version: CUPS 2.0\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2015-01-28 12:00-0800\n"
"Last-Translator: Aleksandr Proklov\n"
"Language-Team: PuppyRus Linux Team\n"
msgstr "%d x %d мм"
#, c-format
-msgid "%g x %g"
-msgstr "%g x %g"
+msgid "%g x %g \""
+msgstr ""
#, c-format
msgid "%s (%s)"
#~ "\"%s\": Ошибка uriScheme значение \"%s\" - ошибка длины %d (RFC 2911 "
#~ "раздел 4.1.6)."
+#~ msgid "%g x %g"
+#~ msgstr "%g x %g"
+
#~ msgid "File Folder "
#~ msgstr "Каталог файла "
msgstr ""
"Project-Id-Version: CUPS 1.6\n"
"Report-Msgid-Bugs-To: https://github.com/apple/cups/issues\n"
-"POT-Creation-Date: 2017-07-19 12:33-0400\n"
+"POT-Creation-Date: 2017-07-19 13:46-0400\n"
"PO-Revision-Date: 2017-06-11 12:38+0800\n"
"Last-Translator: Mingcong Bai <jeffbai@aosc.xyz>\n"
"Language-Team: \n"
msgstr "%d x %d 毫米"
#, c-format
-msgid "%g x %g"
-msgstr "%g x %g"
+msgid "%g x %g \""
+msgstr ""
#, c-format
msgid "%s (%s)"
#~ msgstr ""
#~ "“%s”:无效的 uriScheme 赋值“%s”- 无效长度 %d(RFC 2911 章节 4.1.6)。"
+#~ msgid "%g x %g"
+#~ msgstr "%g x %g"
+
#~ msgid "Envelope #10 "
#~ msgstr "10 号信封 "