summaryrefslogtreecommitdiff
path: root/scheduler/client.c
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-08-28 16:18:18 -0400
committerMichael Sweet <michael.r.sweet@gmail.com>2017-08-28 16:18:18 -0400
commit2793a478d0904d31ea4aff2db90b8026d4c67ff9 (patch)
tree6b2633ecc9b91f80a2385c59f7be7b61259a0bbf /scheduler/client.c
parent5b6caf71b8130c59d72dbb61964f5fd219ab8a43 (diff)
downloadcups-2793a478d0904d31ea4aff2db90b8026d4c67ff9.tar.gz
The web interface did not support newer language identifiers used by Microsoft
web browsers (Issue #5803) Make sure cupsLangGet supports region codes and that the scheduler uses cupsLangGet when mapping IPP naturalLanguage values to POSIX locales.
Diffstat (limited to 'scheduler/client.c')
-rw-r--r--scheduler/client.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/scheduler/client.c b/scheduler/client.c
index f27decda4..78695ae65 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -3627,42 +3627,12 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
else
auth_type[0] = '\0';
- if (con->request &&
- (attr = ippFindAttribute(con->request, "attributes-natural-language",
- IPP_TAG_LANGUAGE)) != NULL)
+ if (con->request && (attr = ippFindAttribute(con->request, "attributes-natural-language", IPP_TAG_LANGUAGE)) != NULL)
{
- switch (strlen(attr->values[0].string.text))
- {
- default :
- /*
- * This is an unknown or badly formatted language code; use
- * the POSIX locale...
- */
-
- strlcpy(lang, "LANG=C", sizeof(lang));
- break;
-
- case 2 :
- /*
- * Just the language code (ll)...
- */
+ cups_lang_t *language = cupsLangGet(ippGetString(attr, 0, NULL));
- snprintf(lang, sizeof(lang), "LANG=%s.UTF8",
- attr->values[0].string.text);
- break;
-
- case 5 :
- /*
- * Language and country code (ll-cc)...
- */
-
- snprintf(lang, sizeof(lang), "LANG=%c%c_%c%c.UTF8",
- attr->values[0].string.text[0],
- attr->values[0].string.text[1],
- toupper(attr->values[0].string.text[3] & 255),
- toupper(attr->values[0].string.text[4] & 255));
- break;
- }
+ snprintf(lang, sizeof(lang), "LANG=%s.UTF8", language->language);
+ cupsLangFree(language);
}
else if (con->language)
snprintf(lang, sizeof(lang), "LANG=%s.UTF8", con->language->language);