Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_int_menus.c e_intl.c e_intl.h
Log Message:
more intl support
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- e_int_menus.c 11 Apr 2005 20:25:52 -0000 1.43
+++ e_int_menus.c 11 Apr 2005 23:32:24 -0000 1.44
@@ -114,7 +114,7 @@
e_menu_item_callback_set(mi, _e_int_menus_main_restart, NULL);
mi = e_menu_item_new(m);
- e_menu_item_label_set(mi, _("Exit Enlightement"));
+ e_menu_item_label_set(mi, _("Exit Enlightenment"));
e_menu_item_icon_edje_set(mi, e_path_find(path_icons, "default.edj"),
"power");
e_menu_item_callback_set(mi, _e_int_menus_main_exit, NULL);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_intl.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_intl.c 11 Apr 2005 20:25:52 -0000 1.1
+++ e_intl.c 11 Apr 2005 23:32:24 -0000 1.2
@@ -7,20 +7,127 @@
/* TODO List:
*/
+static char *_e_intl_language = NULL;
+static Evas_List *_e_intl_languages = NULL;
+
+#define ADD_LANG(lang) _e_intl_languages = evas_list_append(_e_intl_languages,
lang)
+
int
e_intl_init(void)
{
+ if (_e_intl_languages) return 1;
+
+ /* supporeted languages - as we get translations - add them here */
+ ADD_LANG("C");
+ ADD_LANG("en");
+ ADD_LANG("jp");
+
+ /* FIXME: NULL == use LANG. make this read a config value if it exists */
+ e_intl_language_set(NULL);
+ return 1;
+}
+
+int
+e_intl_shutdown(void)
+{
+ return 1;
+}
+
+void
+e_intl_language_set(const char *lang)
+{
+ char buf[4096];
+
+ if (_e_intl_language) free(_e_intl_language);
+ if (!lang) lang = getenv("LANG");
+ _e_intl_language = strdup(lang);
+ snprintf(buf, sizeof(buf), "LANG=%s", _e_intl_language);
+ putenv(buf);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALE_DIR);
textdomain(PACKAGE);
// XSetLocaleModifiers("");
bind_textdomain_codeset(PACKAGE, "UTF-8");
+}
+
+const char *
+e_intl_language_get(void)
+{
+ return _e_intl_language;
+}
+
+#define IFL(l) if (!strcmp(lang, l)) return
+const char *
+e_intl_language_name_get(const char *lang)
+{
+ if (!lang) return "None";
+ /* FIXME: add as many as we can to this */
+ IFL("C") "None";
+ IFL("bg") "Bulgarian";
+ IFL("bs") "Bosnian";
+ IFL("ca") "Catalan";
+ IFL("cs") "Czech";
+ IFL("cy") "Welsh";
+ IFL("da") "Danish";
+ IFL("de") "German";
+ IFL("el") "Greek";
+ IFL("en") "English";
+ IFL("eu") "Basque";
+ IFL("fa") "Persian";
+ IFL("fr") "French";
+ IFL("fi") "Finnish";
+ IFL("gl") "Galician";
+ IFL("hi") "Hindi";
+ IFL("hr") "Croatian";
+ IFL("hu") "Hungarian";
+ IFL("id") "Indonesian";
+ IFL("it") "Italian";
+ IFL("jp") "Japanese";
+ IFL("kr") "Korean";
+ IFL("lt") "Lithuanian";
+ IFL("lv") "Latvian";
+ IFL("nl") "Dutch";
+ IFL("nn") "Norwegian Bokmall";
+ IFL("no") "Norwegian Nynorsk";
+ IFL("pl") "Polish";
+ IFL("pt") "Portuguese";
+ IFL("pt_BR") "Portuguese (Brazil)";
+ IFL("ro") "Romanian";
+ IFL("ru") "Russian";
+ IFL("sk") "Slovak";
+ IFL("sl") "Slovenian";
+ IFL("sq") "Albanian";
+ IFL("sr") "Serbian";
+ IFL("sv") "Swedish";
+ IFL("tr") "Tuirkish";
+ IFL("uk") "Ukrainian";
+ IFL("vi") "Vietnamese";
+ IFL("zh") "Chinese (Simplified)";
+ IFL("zh_TW") "Chinese (Traditional)";
+ return "Unknown";
+}
+
+#define ISL(l) (!strcasecmp(buf, l))
+const char *
+e_intl_language_simple_get(const char *lang)
+{
+ char buf[4096], *p;
- return 1;
+ if (!lang) return "C";
+ strncpy(buf, lang, sizeof(buf) - 1);
+ p = strchr(buf, '.');
+ if (p) *p = 0;
+ if (ISL("en") || ISL("en_US") || ISL("en_GB") || ISL("en_CA") ||
+ ISL("en_AU") || ISL("en_NZ") || ISL("en_RN"))
+ return "en";
+ if (ISL("ja") || ISL("ja_JP") || ISL("JP") || ISL("en_CA"))
+ return "ja";
+ /* FIXME: add all sorts of fuzzy matching here */
+ return lang;
}
-int
-e_intl_shutdown(void)
+const Evas_List *
+e_intl_language_list(void)
{
- return 1;
+ return _e_intl_languages;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_intl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_intl.h 11 Apr 2005 20:25:52 -0000 1.1
+++ e_intl.h 11 Apr 2005 23:32:24 -0000 1.2
@@ -15,6 +15,11 @@
EAPI int e_intl_init(void);
EAPI int e_intl_shutdown(void);
+EAPI void e_intl_language_set(const char *lang);
+EAPI const char *e_intl_language_get(void);
+EAPI const char *e_intl_language_name_get(const char *lang);
+EAPI const char *e_intl_language_simple_get(const char *lang);
+EAPI const Evas_List *e_intl_language_list(void);
#endif
#endif
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs