In my Tizen 2.3 native mobile app I'm trying to detect the UI language as it is set in the Tizen OS Settings, and show it as a human readable format. I use the following code:
i18n_uchar *bufUC = malloc(100);
int32_t sizeReq;
if (i18n_ulocale_get_display_name(NULL, NULL, bufUC, 99, &sizeReq) == I18N_ERROR_NONE) {
char *buf = malloc(100);
if (i18n_ustring_copy_au(buf, bufUC) && strlen(buf)) addListItem("Tizen Language", buf, 0);
free(buf);
}
free(bufUC);
However, the results are inconsitent, and I'm not sure why is that. If I select English, Spanish, German, Hungarian and Italian language, the results are as follows:
English (United States)
espanol (Espana)
de (DE)
hu (HU)
it (IT)
So somehow the locale code is not properly decoded into a human readable format by i18n_ulocale_get_display_name. Is it an OS bug? Or maybe I should use a different method to show the information I'm looking for? I've tried to use system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE) as well, but it provides only the locale code, not the display name of the language.
Thank you.
Regards,
Tamas