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

U_STABLE int32_t U_EXPORT2 uloc_getLanguage ( const char *  localeID,
char *  language,
int32_t  languageCapacity,
UErrorCode err 
)

Gets the language code for the specified locale.

Parameters:
localeID the locale to get the ISO language code with
language the language code for localeID
languageCapacity the size of the language buffer to store the language code with
err error information if retrieving the language code failed
Returns:
the actual buffer size needed for the language code. If it's greater than languageCapacity, the returned language code will be truncated. ICU 2.0

Definition at line 1828 of file uloc.c.

References NULL, and U_FAILURE.

{
    /* uloc_getLanguage will return a 2 character iso-639 code if one exists. *CWB*/
    int32_t i=0;

    if (err==NULL || U_FAILURE(*err)) {
        return 0;
    }
    
    if(localeID==NULL) {
        localeID=uloc_getDefault();
    }

    i=ulocimp_getLanguage(localeID, language, languageCapacity, NULL);
    return u_terminateChars(language, languageCapacity, i, err);
}


Generated by  Doxygen 1.6.0   Back to index