Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_DRAFT int32_t U_EXPORT2 uloc_getLocaleForLCID ( uint32_t  hostID,
char *  locale,
int32_t  localeCapacity,
UErrorCode status 
)

Gets the ICU locale ID for the specified Win32 LCID value.

Parameters:
hostIDthe Win32 LCID to translate
localethe output buffer for the ICU locale ID, which will be NUL-terminated if there is room.
localeCapacitythe size of the output buffer
statusan error is returned if the LCID is unrecognized or the output buffer is too small
Returns:
actual the actual size of the locale ID, not including NUL-termination ICU 3.8

Definition at line 2033 of file uloc.c.

References NULL, U_BUFFER_OVERFLOW_ERROR, and U_FAILURE.

{
    int32_t length;
    const char *posix = uprv_convertToPosix(hostid, status);
    if (U_FAILURE(*status) || posix == NULL) {
        return 0;
    }
    length = (int32_t)uprv_strlen(posix);
    if (length+1 > localeCapacity) {
        *status = U_BUFFER_OVERFLOW_ERROR;
    }
    else {
        uprv_strcpy(locale, posix);
    }
    return length;
}

Generated by  Doxygen 1.6.0   Back to index