ICU-3591 acceptLanguage API

X-SVN-Rev: 16686
This commit is contained in:
Steven R. Loomis 2004-10-30 09:46:11 +00:00
parent d0b0ab46a4
commit fd09b2d910
2 changed files with 65 additions and 0 deletions

View file

@ -2770,4 +2770,24 @@ uloc_getISOCountries()
return COUNTRIES;
}
U_CAPI int32_t U_EXPORT2
uloc_acceptLanguageFromHTTP(char *result, int32_t *resultAvailable, UAcceptResult *outResult,
const char *httpAcceptLanguage,
UEnumeration* availableLocales,
UErrorCode *status)
{
*status = U_INTERNAL_PROGRAM_ERROR;
return -1;
}
U_CAPI int32_t U_EXPORT2
uloc_acceptLanguage(char *result, int32_t resultAvailable,
UAcceptResult *outResult, const char *acceptList[],
UEnumeration* availableLocales,
UErrorCode *status) {
*status = U_INTERNAL_PROGRAM_ERROR;
return -1;
}
/*eof*/

View file

@ -859,6 +859,51 @@ uloc_setKeywordValue(const char* keywordName,
const char* keywordValue,
char* buffer, int32_t bufferCapacity,
UErrorCode* status);
/**
* enums for the 'outResult' parameter return value
* @see uloc_acceptLanguageFromHTTP
* @see uloc_acceptLanguage
* @draft ICU 3.2
*/
typedef enum {
ULOC_ACCEPT_VALID = 0, /* An exact match was found. */
ULOC_ACCEPT_FALLBACK = 1 /* A fallback was found, for example,
Accept list contained 'ja_JP'
which matched available locale 'ja'. */
} UAcceptResult;
/**
* @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
* @param result - buffer to accept the result locale
* @param resultAvailable the size of the result buffer.
* @param availableLocales - list of available locales to match
* @param status Error status, may be BUFFER_OVERFLOW_ERROR
* @return length needed for the locale.
* @draft ICU 3.2
*/
U_DRAFT int32_t U_EXPORT2
uloc_acceptLanguageFromHTTP(char *result, int32_t *resultAvailable, UAcceptResult *outResult,
const char *httpAcceptLanguage,
UEnumeration* availableLocales,
UErrorCode *status);
/**
* @param acceptList -list of accceptable languages
* @param result - buffer to accept the result locale
* @param resultAvailable the size of the result buffer.
* @param availableLocales - list of available locales to match
* @param status Error status, may be BUFFER_OVERFLOW_ERROR
* @return length needed for the locale.
* @draft ICU 3.2
*/
U_DRAFT int32_t U_EXPORT2
uloc_acceptLanguage(char *result, int32_t resultAvailable,
UAcceptResult *outResult, const char *acceptList[],
UEnumeration* availableLocales,
UErrorCode *status);
/*eof*/