ICU 76.1 76.1
|
C API: Locale ID functionality similar to C++ class Locale. More...
Go to the source code of this file.
Namespaces | |
namespace | icu |
File coll.h. | |
Typedefs | |
typedef struct ULocale | ULocale |
C typedef for struct ULocale. | |
Functions | |
U_CAPI ULocale * | ulocale_openForLocaleID (const char *localeID, int32_t length, UErrorCode *err) |
Constructs an ULocale from the locale ID. | |
U_CAPI ULocale * | ulocale_openForLanguageTag (const char *tag, int32_t length, UErrorCode *err) |
Constructs an ULocale from the provided IETF BCP 47 language tag. | |
U_CAPI void | ulocale_close (ULocale *locale) |
Close the locale and destroy it's internal states. | |
U_CAPI const char * | ulocale_getLanguage (const ULocale *locale) |
Returns the locale's ISO-639 language code. | |
U_CAPI const char * | ulocale_getScript (const ULocale *locale) |
Returns the locale's ISO-15924 abbreviation script code. | |
U_CAPI const char * | ulocale_getRegion (const ULocale *locale) |
Returns the locale's ISO-3166 region code. | |
U_CAPI const char * | ulocale_getVariant (const ULocale *locale) |
Returns the locale's variant code. | |
U_CAPI const char * | ulocale_getLocaleID (const ULocale *locale) |
Returns the programmatic name of the entire locale, with the language, country and variant separated by underbars. | |
U_CAPI const char * | ulocale_getBaseName (const ULocale *locale) |
Returns the programmatic name of the entire locale as ulocale_getLocaleID() would return, but without keywords. | |
U_CAPI bool | ulocale_isBogus (const ULocale *locale) |
Gets the bogus state. | |
U_CAPI UEnumeration * | ulocale_getKeywords (const ULocale *locale, UErrorCode *err) |
Gets the list of keywords for the specified locale. | |
U_CAPI UEnumeration * | ulocale_getUnicodeKeywords (const ULocale *locale, UErrorCode *err) |
Gets the list of unicode keywords for the specified locale. | |
U_CAPI int32_t | ulocale_getKeywordValue (const ULocale *locale, const char *keyword, int32_t keywordLength, char *valueBuffer, int32_t valueBufferCapacity, UErrorCode *err) |
Gets the value for a keyword. | |
U_CAPI int32_t | ulocale_getUnicodeKeywordValue (const ULocale *locale, const char *keyword, int32_t keywordLength, char *valueBuffer, int32_t valueBufferCapacity, UErrorCode *err) |
Gets the Unicode value for a Unicode keyword. | |
C API: Locale ID functionality similar to C++ class Locale.
Definition in file ulocale.h.
Returns the programmatic name of the entire locale as ulocale_getLocaleID() would return, but without keywords.
locale | the locale |
U_CAPI UEnumeration * ulocale_getKeywords | ( | const ULocale * | locale, |
UErrorCode * | err | ||
) |
Gets the list of keywords for the specified locale.
locale | the locale |
err | the error code |
U_CAPI int32_t ulocale_getKeywordValue | ( | const ULocale * | locale, |
const char * | keyword, | ||
int32_t | keywordLength, | ||
char * | valueBuffer, | ||
int32_t | valueBufferCapacity, | ||
UErrorCode * | err | ||
) |
Gets the value for a keyword.
This uses legacy keyword=value pairs, like "collation=phonebook".
locale | the locale |
keyword | the keyword, a const char * pointer (need not be terminated when the length is non-negative) |
keywordLength | the length of the keyword; if negative, then the keyword need to be null terminated. |
valueBuffer | The buffer to receive the value. |
valueBufferCapacity | The capacity of receiving valueBuffer. |
err | the error code |
Returns the locale's ISO-639 language code.
locale | the locale |
Returns the programmatic name of the entire locale, with the language, country and variant separated by underbars.
If a field is missing, up to two leading underbars will occur. Example: "en", "de_DE", "en_US_WIN", "de__POSIX", "fr__MAC", "__MAC", "_MT", "_FR_EURO"
locale | the locale |
Returns the locale's ISO-3166 region code.
locale | the locale |
Returns the locale's ISO-15924 abbreviation script code.
locale | the locale |
U_CAPI UEnumeration * ulocale_getUnicodeKeywords | ( | const ULocale * | locale, |
UErrorCode * | err | ||
) |
Gets the list of unicode keywords for the specified locale.
locale | the locale |
err | the error code |
U_CAPI int32_t ulocale_getUnicodeKeywordValue | ( | const ULocale * | locale, |
const char * | keyword, | ||
int32_t | keywordLength, | ||
char * | valueBuffer, | ||
int32_t | valueBufferCapacity, | ||
UErrorCode * | err | ||
) |
Gets the Unicode value for a Unicode keyword.
This uses Unicode key-value pairs, like "co-phonebk".
locale | the locale |
keyword | the Unicode keyword, a const char * pointer (need not be terminated when the length is non-negative) |
keywordLength | the length of the Unicode keyword; if negative, then the keyword need to be null terminated. |
valueBuffer | The buffer to receive the Unicode value. |
valueBufferCapacity | The capacity of receiving valueBuffer. |
err | the error code |
Returns the locale's variant code.
locale | the locale |
Gets the bogus state.
Locale object can be bogus if it doesn't exist
locale | the locale |
U_CAPI ULocale * ulocale_openForLanguageTag | ( | const char * | tag, |
int32_t | length, | ||
UErrorCode * | err | ||
) |
Constructs an ULocale from the provided IETF BCP 47 language tag.
The created ULocale should be destroyed by calling ulocale_close();
tag | the language tag, defined as IETF BCP 47 language tag, const char* pointer (need not be terminated when the length is non-negative) |
length | the length of the tag; if negative, then the tag need to be null terminated. |
err | the error code |
U_CAPI ULocale * ulocale_openForLocaleID | ( | const char * | localeID, |
int32_t | length, | ||
UErrorCode * | err | ||
) |
Constructs an ULocale from the locale ID.
The created ULocale should be destroyed by calling ulocale_close();
localeID | the locale, a const char * pointer (need not be terminated when the length is non-negative) |
length | the length of the locale; if negative, then the locale need to be null terminated. |
err | the error code |