File feature-wizard-auto-lang.patch of Package enlightenment.openSUSE_Leap_42.2_Update
commit 92c5d6600449be6646ec746d3845fc1917141308
Author: Simon Lees (SUSE) <sflees@suse.de>
Date: Tue Nov 29 14:12:14 2016 +1030
feature-wizard-auto-lang
diff --git a/src/modules/wizard/page_010.c b/src/modules/wizard/page_010.c
index 120953b..a9549d6 100644
--- a/src/modules/wizard/page_010.c
+++ b/src/modules/wizard/page_010.c
@@ -1,6 +1,6 @@
/* Language chooser */
#include "e_wizard.h"
-
+#include <eina_log.h>
typedef struct _E_Intl_Pair E_Intl_Pair;
static int _basic_lang_list_sort(const void *data1, const void *data2);
@@ -209,6 +209,41 @@ wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
},
.version = ELM_GENLIST_ITEM_CLASS_VERSION
};
+ FILE *locale_inf;
+ char line[32];
+ char layout[128];
+ int i = 0;
+
+ locale_inf = popen("locale", "r");
+ if (locale_inf)
+ {
+ while (fscanf(locale_inf, "%[^\n]\n", line) == 1)
+ {
+ if (sscanf (line, "LC_CTYPE=%127s", layout))
+ {
+ if (layout)
+ {
+ i = 0;
+ while (basic_language_predefined_pairs[i].locale_key)
+ {
+ if (!strncmp
+ (basic_language_predefined_pairs[i].locale_key,
+ layout,
+ strlen(basic_language_predefined_pairs[i].locale_key)))
+ {
+ 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++;
+ }
+ }
+ }
+ }
+ pclose(locale_inf);
+ }
e_wizard_title_set(_("Language"));
of = elm_frame_add(e_comp->elm);