File feature-wizard-auto-lang.patch of Package enlightenment
commit ef1b8cb6f8830cee2cfc4f371e8a0d2d894d48a7
Author: Simon Lees <sflees@suse.de>
Date: Wed Jun 28 12:58:55 2017 +0930
auto set language to system lang
If the system language is set this is likely because a user has
already selected it in a distro's installer and doesn't want to
set it again so rather then telling a user which language they
selected as there default just set the language without showing
the wizard page.
diff --git a/src/modules/wizard/page_010.c b/src/modules/wizard/page_010.c
index 120953be1..337215bca 100644
--- a/src/modules/wizard/page_010.c
+++ b/src/modules/wizard/page_010.c
@@ -171,17 +171,11 @@ _lang_content_get(E_Intl_Pair *pair, Evas_Object *obj, const char *part)
static char *
_lang_text_get(E_Intl_Pair *pair, Evas_Object *obj EINA_UNUSED, const char *part)
{
- char buf[4096];
-
if (!eina_streq(part, "elm.text")) return NULL;
if (!pair)
return strdup(_("System Default"));
- if ((!e_intl_language_get()) || (!eina_streq(pair->locale_key, e_intl_language_get())))
- return strdup(_(pair->locale_translation));
-
- snprintf(buf, sizeof(buf), "System Default [%s]", pair->locale_translation);
- return strdup(buf);
+ return strdup(_(pair->locale_translation));
}
static void
@@ -210,6 +204,24 @@ wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
.version = ELM_GENLIST_ITEM_CLASS_VERSION
};
+ /* If we can determine the system language just use it and don't show the page */
+ if (e_intl_language_get())
+ {
+ int i = 0;
+ while (basic_language_predefined_pairs[i].locale_key)
+ {
+ if (eina_streq(basic_language_predefined_pairs[i].locale_key, e_intl_language_get()))
+ {
+ lang = basic_language_predefined_pairs[i].locale_key;
+ eina_stringshare_replace(&e_config->language, lang);
+ e_intl_language_set(e_config->language);
+ e_wizard_labels_update();
+ return 0;
+ }
+ i++;
+ }
+ }
+
e_wizard_title_set(_("Language"));
of = elm_frame_add(e_comp->elm);
elm_object_text_set(of, _("Select one"));