{
label_x *ptr;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ char *lbl = NULL;
+ const char *locale;
+ GList *tmp;
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- if (info->app_info == NULL || info->app_info->label == NULL)
+ if (info->app_info == NULL)
return PMINFO_R_ERROR;
- ptr = (label_x *)info->app_info->label->data;
- if (ptr == NULL)
- return PMINFO_R_ERROR;
+ locale = info->locale;
+ if (locale == NULL)
+ locale = DEFAULT_LOCALE;
- if (ptr->text == NULL)
- return PMINFO_R_ERROR;
- else
- *label = ptr->text;
+ for (tmp = info->app_info->label; tmp; tmp = tmp->next) {
+ ptr = (label_x *)tmp->data;
+ if (ptr == NULL || strcmp(locale, ptr->lang) != 0)
+ continue;
+ lbl = ptr->text;
+ break;
+ }
+
+ if (lbl != NULL) {
+ *label = lbl;
+ return PMINFO_R_OK;
+ }
+
+ for (tmp = info->app_info->label; tmp; tmp = tmp->next) {
+ ptr = (label_x *)tmp->data;
+ if (ptr == NULL || strcmp(DEFAULT_LOCALE, ptr->lang) != 0)
+ continue;
+ lbl = ptr->text;
+ break;
+ }
+
+ *label = lbl ? lbl : "";
return PMINFO_R_OK;
}