diff options
-rw-r--r-- | src/common/cfgfiles.c | 11 | ||||
-rw-r--r-- | src/common/xchat.c | 165 | ||||
-rw-r--r-- | src/common/xchat.h | 2 | ||||
-rw-r--r-- | src/fe-gtk/setup.c | 50 |
4 files changed, 207 insertions, 21 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 09b91423..c02395c9 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -452,7 +452,7 @@ const struct prefs vars[] = { {"gui_join_dialog", P_OFFINT (gui_join_dialog), TYPE_BOOL}, {"gui_lagometer", P_OFFINT (lagometer), TYPE_INT}, #ifdef WIN32 - {"gui_lang", P_OFFSET (gui_lang), TYPE_STR}, + {"gui_lang", P_OFFINT (gui_lang), TYPE_INT}, #endif {"gui_mode_buttons", P_OFFINT (chanmodebuttons), TYPE_BOOL}, #ifdef WIN32 @@ -677,7 +677,10 @@ load_config (void) prefs.indent_nicks = 1; prefs.thin_separator = 1; prefs._tabs_position = 2; /* 2 = left */ -#ifndef WIN32 +#ifdef WIN32 + prefs.identd = 1; + prefs.gui_lang = 12; +#else prefs.fastdccsend = 1; #endif prefs.wordwrap = 1; @@ -747,10 +750,6 @@ load_config (void) prefs.url_grabber_limit = 100; /* 0 means unlimited */ prefs.text_search_follow = 1; prefs.timestamp = 1; -#ifdef WIN32 - prefs.identd = 1; - strcpy (prefs.gui_lang, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); -#endif strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); strcpy (prefs.stamp_format, "[%H:%M:%S] "); strcpy (prefs.timestamp_log_format, "%b %d %H:%M:%S "); diff --git a/src/common/xchat.c b/src/common/xchat.c index 77650a03..5a0a7fa9 100644 --- a/src/common/xchat.c +++ b/src/common/xchat.c @@ -957,23 +957,150 @@ main (int argc, char *argv[]) srand (time (0)); /* CL: do this only once! */ -#ifdef SOCKS - SOCKSinit (argv[0]); -#endif - - ret = fe_args (argc, argv); - if (ret != -1) - return ret; - -#ifdef USE_DBUS - xchat_remote (); -#endif - load_config (); #ifdef WIN32 /* we MUST do this after load_config () otherwise it would fail */ - snprintf (hexchat_lang, 12, "LC_ALL=%s", prefs.gui_lang); + strcpy (hexchat_lang, "LC_ALL="); + switch (prefs.gui_lang) + { + case 0: + strcat (hexchat_lang, "sq"); + break; + case 1: + strcat (hexchat_lang, "am"); + break; + case 2: + strcat (hexchat_lang, "az"); + break; + case 3: + strcat (hexchat_lang, "eu"); + break; + case 4: + strcat (hexchat_lang, "be"); + break; + case 5: + strcat (hexchat_lang, "bg"); + break; + case 6: + strcat (hexchat_lang, "ca"); + break; + case 7: + strcat (hexchat_lang, "zh_CN"); + break; + case 8: + strcat (hexchat_lang, "zh_TW"); + break; + case 9: + strcat (hexchat_lang, "cs"); + break; + case 10: + strcat (hexchat_lang, "nl"); + break; + case 11: + strcat (hexchat_lang, "en_GB"); + break; + case 12: + strcat (hexchat_lang, "en_US"); + break; + case 13: + strcat (hexchat_lang, "et"); + break; + case 14: + strcat (hexchat_lang, "fi"); + break; + case 15: + strcat (hexchat_lang, "fr"); + break; + case 16: + strcat (hexchat_lang, "gl"); + break; + case 17: + strcat (hexchat_lang, "de"); + break; + case 18: + strcat (hexchat_lang, "el"); + break; + case 19: + strcat (hexchat_lang, "hi"); + break; + case 20: + strcat (hexchat_lang, "hu_HU"); + break; + case 21: + strcat (hexchat_lang, "it"); + break; + case 22: + strcat (hexchat_lang, "ja"); + break; + case 23: + strcat (hexchat_lang, "kn"); + break; + case 24: + strcat (hexchat_lang, "ko"); + break; + case 25: + strcat (hexchat_lang, "lv"); + break; + case 26: + strcat (hexchat_lang, "lt"); + break; + case 27: + strcat (hexchat_lang, "mk"); + break; + case 28: + strcat (hexchat_lang, "ms"); + break; + case 29: + strcat (hexchat_lang, "nb"); + break; + case 30: + strcat (hexchat_lang, "pl"); + break; + case 31: + strcat (hexchat_lang, "pt"); + break; + case 32: + strcat (hexchat_lang, "pt_BR"); + break; + case 33: + strcat (hexchat_lang, "pa"); + break; + case 34: + strcat (hexchat_lang, "ru"); + break; + case 35: + strcat (hexchat_lang, "sr"); + break; + case 36: + strcat (hexchat_lang, "sk"); + break; + case 37: + strcat (hexchat_lang, "sl"); + break; + case 38: + strcat (hexchat_lang, "es"); + break; + case 39: + strcat (hexchat_lang, "sv"); + break; + case 40: + strcat (hexchat_lang, "th"); + break; + case 41: + strcat (hexchat_lang, "uk"); + break; + case 42: + strcat (hexchat_lang, "vi"); + break; + case 43: + strcat (hexchat_lang, "wa"); + break; + default: + strcat (hexchat_lang, "en_US"); + break; + } + putenv (hexchat_lang); if (prefs.gui_one_instance && !portable_mode ()) @@ -1003,6 +1130,18 @@ main (int argc, char *argv[]) } #endif +#ifdef SOCKS + SOCKSinit (argv[0]); +#endif + + ret = fe_args (argc, argv); + if (ret != -1) + return ret; + +#ifdef USE_DBUS + xchat_remote (); +#endif + #ifdef USE_LIBPROXY libproxy_factory = px_proxy_factory_new(); #endif diff --git a/src/common/xchat.h b/src/common/xchat.h index 06b29494..cf3dc439 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -117,7 +117,6 @@ struct xchatprefs char font_normal[4 * FONTNAMELEN + 1]; char font_main[FONTNAMELEN + 1]; char font_alternative[3 * FONTNAMELEN + 1]; - char gui_lang[6]; /* Just enough for xx_YY plus trailing \0 */ #else char font_normal[FONTNAMELEN + 1]; #endif @@ -192,6 +191,7 @@ struct xchatprefs int gui_quit_dialog; #ifdef WIN32 int gui_one_instance; + int gui_lang; #endif int dialog_left; int dialog_top; diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index b664e008..2e167d5e 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -99,12 +99,60 @@ typedef struct int extra; } setting; +static const char *const langsmenu[] = +{ + N_("Albanian"), + N_("Amharic"), + N_("Azerbaijani"), + N_("Basque"), + N_("Belarusian"), + N_("Bulgarian"), + N_("Catalan"), + N_("Chinese (Simplified)"), + N_("Chinese (Traditional)"), + N_("Czech"), + N_("Dutch"), + N_("English (UK)"), + N_("English (US)"), + N_("Estonian"), + N_("Finnish"), + N_("French"), + N_("Galician"), + N_("German"), + N_("Greek"), + N_("Hindi"), + N_("Hungarian"), + N_("Italian"), + N_("Japanese"), + N_("Kannada"), + N_("Korean"), + N_("Latvian"), + N_("Lithuanian"), + N_("Macedonian"), + N_("Malay"), + N_("Norwegian"), + N_("Polish"), + N_("Portuguese"), + N_("Portuguese (Brazilian)"), + N_("Punjabi"), + N_("Russian"), + N_("Serbian"), + N_("Slovak"), + N_("Slovenian"), + N_("Spanish"), + N_("Swedish"), + N_("Thai"), + N_("Ukrainian"), + N_("Vietnamese"), + N_("Walloon"), + NULL +}; static const setting appearance_settings[] = { #ifdef WIN32 {ST_HEADER, N_("Localization"),0,0,0}, - {ST_ENTRY, N_("HexChat language:"), P_OFFSETNL(gui_lang), 0, 0, sizeof prefs.gui_lang}, + {ST_MENU, N_("Interface language:"), P_OFFINTNL(gui_lang), 0, langsmenu, 0}, #endif {ST_HEADER, N_("Text Box"),0,0,0}, #ifdef WIN32 |