This example shows how to retrieve locale information by item.
int main(void) {
LocaleObject locale_object = NULL;
UniChar *pinfo_item;
int rc = ULS_SUCCESS;
/*****************************************************************/
/* Assumes LANG environment variable set to a valid locale name, */
/* such as fr_FR */
/*****************************************************************/
rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
(UniChar *)L"", &locale_object);
if (rc != ULS_SUCCESS) {
printf("UniCreateLocaleObject error: return code = %u\n", rc);
return 1;
}
/* Retrieve name of the tenth month locale item */
rc = UniQueryLocaleItem(locale_object,
MON_10,
&pinfo_item);
if (rc != ULS_SUCCESS) {
printf("UniQueryLocaleItem error: return code = %u\n", rc);
return 1;
}
rc = UniFreeMem(pinfo_item);
if (rc != ULS_SUCCESS) {
printf("UniFreeMem error: return code = %u\n", rc);
return 1;
}
return ULS_SUCCESS;
}