diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2013-08-12 19:49:44 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2013-08-12 19:49:44 +0000 |
commit | 41e6c1f1fdc13479cc65bb64e9ae7924c35ca08f (patch) | |
tree | ac0a4c27ae624b3eca90edc8beb5877e80a72f38 /cups/http-support.c | |
parent | 38bb3cf454bac792ea8a1d642b4133d1eff16365 (diff) |
Localize HTTP status codes based on Accept-Lanaguage (<rdar://problem/14201195>)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11233 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/http-support.c')
-rw-r--r-- | cups/http-support.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/cups/http-support.c b/cups/http-support.c index 1aa4a1634..bec39d0f4 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -35,6 +35,8 @@ * components. * httpSeparateURI() - Separate a Universal Resource Identifier into its * components. + * _httpStatus() - Return the localized string describing a HTTP + * status code. * httpStatus() - Return a short string describing a HTTP status * code. * _cups_hstrerror() - hstrerror() emulation function for Solaris and @@ -1322,21 +1324,17 @@ httpSeparateURI( /* - * 'httpStatus()' - Return a short string describing a HTTP status code. + * '_httpStatus()' - Return the localized string describing a HTTP status code. * - * The returned string is localized to the current POSIX locale and is based - * on the status strings defined in RFC 2616. + * The returned string is localized using the passed message catalog. */ const char * /* O - Localized status string */ -httpStatus(http_status_t status) /* I - HTTP status code */ +_httpStatus(cups_lang_t *lang, /* I - Language */ + http_status_t status) /* I - HTTP status code */ { const char *s; /* Status string */ - _cups_globals_t *cg = _cupsGlobals(); /* Global data */ - - if (!cg->lang_default) - cg->lang_default = cupsLangDefault(); switch (status) { @@ -1419,7 +1417,27 @@ httpStatus(http_status_t status) /* I - HTTP status code */ break; } - return (_cupsLangString(cg->lang_default, s)); + return (_cupsLangString(lang, s)); +} + + +/* + * 'httpStatus()' - Return a short string describing a HTTP status code. + * + * The returned string is localized to the current POSIX locale and is based + * on the status strings defined in RFC 2616. + */ + +const char * /* O - Localized status string */ +httpStatus(http_status_t status) /* I - HTTP status code */ +{ + _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); + + return (_httpStatus(cg->lang_default, status)); } |