From: Enlightenment S. <no-...@en...> - 2008-10-28 13:32:27
|
Log: try and make intl more forgiving of encoding-free locales (assume encoding works?) Author: raster Date: 2008-10-28 06:32:21 -0700 (Tue, 28 Oct 2008) New Revision: 37272 Modified: trunk/e/src/bin/e_intl.c Modified: trunk/e/src/bin/e_intl.c =================================================================== --- trunk/e/src/bin/e_intl.c 2008-10-28 13:30:39 UTC (rev 37271) +++ trunk/e/src/bin/e_intl.c 2008-10-28 13:32:21 UTC (rev 37272) @@ -143,6 +143,7 @@ e_intl_language_set(const char *lang) { int set_envars; + int ok; set_envars = 1; /* NULL lang means set everything back to the original environment @@ -172,12 +173,27 @@ else _e_intl_language = NULL; - if ((!_e_intl_locale_validate(_e_intl_language_alias)) && - (strcmp(_e_intl_language_alias, "C"))) + ok = 1; + if (strcmp(_e_intl_language_alias, "C")) { + ok = _e_intl_locale_validate(_e_intl_language_alias); + if (!ok) + { + char *p, *new_lang; + + new_lang = _e_intl_language_alias; + p = strchr(new_lang, '.'); + if (p) *p = 0; + _e_intl_language_alias = strdup(new_lang); + E_FREE(new_lang); + ok = _e_intl_locale_validate(_e_intl_language_alias); + } + } + if (!ok) + { fprintf(stderr, "The locale '%s' cannot be found on your " - "system. Please install this locale or try " - "something else.", _e_intl_language_alias); + "system. Please install this locale or try " + "something else.", _e_intl_language_alias); } else { @@ -563,6 +579,7 @@ Evas_Hash *alias_hash; char *alias; char *lower_language; + char *noenc_language; int i; if ((language == NULL) || (!strncmp(language, "POSIX", strlen("POSIX")))) @@ -900,7 +917,6 @@ locale_lr = e_intl_locale_parts_combine(locale_parts, E_INTL_LOC_LANG | E_INTL_LOC_REGION); - if (locale_lr == NULL) { /* Not valid locale, maybe its an alias */ |