fix e_intl_locale_parts_combine() usage to handle locales without regions

SVN revision: 81241
This commit is contained in:
Mike Blumenkrantz 2012-12-18 12:10:33 +00:00
parent 747a446838
commit 3577ddfff2
3 changed files with 28 additions and 14 deletions

View File

@ -880,7 +880,7 @@ _e_intl_locale_validate(const char *locale)
Eina_List *all_locales; Eina_List *all_locales;
E_Locale_Parts *locale_parts; E_Locale_Parts *locale_parts;
char *locale_next; char *locale_next;
char *locale_lr; char *locale_lr = NULL;
char *locale_cs_canonic; char *locale_cs_canonic;
int found; int found;
@ -889,9 +889,13 @@ _e_intl_locale_validate(const char *locale)
locale_parts = e_intl_locale_parts_get(locale); locale_parts = e_intl_locale_parts_get(locale);
/* Gather the search information */ /* Gather the search information */
locale_lr = if (locale_parts)
e_intl_locale_parts_combine(locale_parts, {
E_INTL_LOC_LANG | E_INTL_LOC_REGION); if (locale_parts->mask & E_INTL_LOC_REGION)
locale_lr = e_intl_locale_parts_combine(locale_parts, E_INTL_LOC_LANG | E_INTL_LOC_REGION);
else if (locale_parts->lang)
locale_lr = strdup(locale_parts->lang);
}
if (!locale_lr) if (!locale_lr)
{ {
/* Not valid locale, maybe its an alias */ /* Not valid locale, maybe its an alias */
@ -915,12 +919,17 @@ _e_intl_locale_validate(const char *locale)
if (found == 0) if (found == 0)
{ {
E_Locale_Parts *locale_parts_next; E_Locale_Parts *locale_parts_next;
char *locale_lr_next; char *locale_lr_next = NULL;
locale_parts_next = e_intl_locale_parts_get(locale_next); locale_parts_next = e_intl_locale_parts_get(locale_next);
locale_lr_next = e_intl_locale_parts_combine(locale_parts_next, if (locale_parts_next)
E_INTL_LOC_LANG | E_INTL_LOC_REGION); {
if (locale_parts_next->mask & E_INTL_LOC_REGION)
locale_lr_next = e_intl_locale_parts_combine(locale_parts_next,
E_INTL_LOC_LANG | E_INTL_LOC_REGION);
else if (locale_parts_next->lang)
locale_lr_next = strdup(locale_parts_next->lang);
}
if ((locale_parts) && (locale_lr_next) && if ((locale_parts) && (locale_lr_next) &&
(!strcmp(locale_lr, locale_lr_next))) (!strcmp(locale_lr, locale_lr_next)))
{ {

View File

@ -1047,8 +1047,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
locale_parts = e_intl_locale_parts_get(cfdata->cur_language); locale_parts = e_intl_locale_parts_get(cfdata->cur_language);
if (locale_parts) if (locale_parts)
{ {
cur_sig_loc = e_intl_locale_parts_combine(locale_parts, if (locale_parts->mask & E_INTL_LOC_REGION)
E_INTL_LOC_LANG | E_INTL_LOC_REGION); cur_sig_loc = e_intl_locale_parts_combine(locale_parts,
E_INTL_LOC_LANG | E_INTL_LOC_REGION);
else if (locale_parts->lang)
cur_sig_loc = strdup(locale_parts->lang);
e_intl_locale_parts_free(locale_parts); e_intl_locale_parts_free(locale_parts);
} }

View File

@ -101,11 +101,13 @@ wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UN
locale_parts = e_intl_locale_parts_get(line); locale_parts = e_intl_locale_parts_get(line);
if (locale_parts) if (locale_parts)
{ {
char *basic_language; char *basic_language = NULL;
basic_language = if (locale_parts->mask & E_INTL_LOC_REGION)
e_intl_locale_parts_combine basic_language = e_intl_locale_parts_combine(locale_parts,
(locale_parts, E_INTL_LOC_LANG | E_INTL_LOC_REGION); E_INTL_LOC_LANG | E_INTL_LOC_REGION);
else if (locale_parts->lang)
basic_language = strdup(locale_parts->lang);
if (basic_language) if (basic_language)
{ {
int i = 0; int i = 0;