From e4be3c55902745534f599dee75dec34993e26d01 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 13 Aug 2024 19:34:45 -0400 Subject: [PATCH] Fix cupsLocalizeDestMedia to localize the media source/type when set. --- cups/dest-localization.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/cups/dest-localization.c b/cups/dest-localization.c index 36ef85721..75241455e 100644 --- a/cups/dest-localization.c +++ b/cups/dest-localization.c @@ -118,18 +118,37 @@ cupsLocalizeDestMedia( lsize = temp; } - if (mdb) + if (media->source[0]) + { + if ((lsource = cupsLocalizeDestValue(http, dest, dinfo, "media-source", media->source)) == media->source) + lsource = cupsLangGetString(lang, _("Other Tray")); + } + else if (mdb) { DEBUG_printf("1cupsLocalizeDestMedia: MATCH mdb%p [key=\"%s\" size_name=\"%s\" source=\"%s\" type=\"%s\" width=%d length=%d B%d L%d R%d T%d]", (void *)mdb, mdb->key, mdb->size_name, mdb->source, mdb->type, mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top); if ((lsource = cupsLocalizeDestValue(http, dest, dinfo, "media-source", mdb->source)) == mdb->source && mdb->source) lsource = cupsLangGetString(lang, _("Other Tray")); + } + else + { + lsource = NULL; + } + + if (media->type[0]) + { + if ((ltype = cupsLocalizeDestValue(http, dest, dinfo, "media-type", media->type)) == media->type) + ltype = cupsLangGetString(lang, _("Other Media")); + } + else if (mdb) + { + DEBUG_printf("1cupsLocalizeDestMedia: MATCH mdb%p [key=\"%s\" size_name=\"%s\" source=\"%s\" type=\"%s\" width=%d length=%d B%d L%d R%d T%d]", (void *)mdb, mdb->key, mdb->size_name, mdb->source, mdb->type, mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top); + if ((ltype = cupsLocalizeDestValue(http, dest, dinfo, "media-type", mdb->type)) == mdb->type && mdb->type) ltype = cupsLangGetString(lang, _("Other Media")); } else { - lsource = NULL; ltype = NULL; }