diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 77cb2c32b..706609465 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -19,6 +19,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] === New features +* core: display a warning on startup if the locale can not be set (closes #373) * core: allow "*" as plugin name in command /plugin reload to reload all plugins with options * core: add option "-s" in command /eval to split expression before evaluating diff --git a/po/cs.po b/po/cs.po index 10ef66e3a..88e0142be 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -201,6 +201,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Obdržen signál %s, ukončuji WeeChat..." diff --git a/po/de.po b/po/de.po index 1c2db0360..b3f94b4d3 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-26 22:58+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German <>\n" @@ -209,6 +209,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "%sEs sollte folgende Zeile in Datei %s eingefügt werden: %s" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Signal %s empfangen, beende WeeChat..." diff --git a/po/es.po b/po/es.po index be33162e0..ab1632b8c 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -207,6 +207,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Señal %s recibida, cerrando WeeChat..." diff --git a/po/fr.po b/po/fr.po index 536024322..42f1bacc5 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" -"PO-Revision-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" +"PO-Revision-Date: 2015-03-30 19:14+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -200,6 +200,14 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "%sVous devriez ajouter cette ligne dans le fichier %s: %s" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" +"%sAttention : impossible de définir la locale ; vérifiez que les variables " +"$LANG et $LC_* sont correctes" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Signal %s reçu, sortie de WeeChat..." diff --git a/po/hu.po b/po/hu.po index 0e22a5c5d..b94e191fa 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -202,6 +202,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "" diff --git a/po/it.po b/po/it.po index d4eb19aba..7468cb430 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -198,6 +198,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Ricevuto segnale %s, chiusura di WeeChat..." diff --git a/po/ja.po b/po/ja.po index afce8fa8d..53190c70b 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-23 22:34+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -197,6 +197,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "%sファイル %s にこの行を追加してください: %s" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "シグナル %s を受け取りました、WeeChat の終了中..." diff --git a/po/pl.po b/po/pl.po index 01cb29f37..abee24d59 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -199,6 +199,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "%sPowinieneś dodać tą linię w pliku %s: %s" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Otrzymano sygnał %s, wychodzę z WeeChat..." diff --git a/po/pt_BR.po b/po/pt_BR.po index 6250c1682..b82be378f 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -230,6 +230,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "Sinal %s recebido, saindo do WeeChat..." diff --git a/po/ru.po b/po/ru.po index a1c6497f3..3b899ec2b 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -211,6 +211,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "" diff --git a/po/tr.po b/po/tr.po index 81325bf34..ffebdc6aa 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2015-03-10 21:33+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -173,6 +173,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index ec16df120..3e1427eea 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-03-24 06:54+0100\n" +"POT-Creation-Date: 2015-03-30 19:14+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -170,6 +170,12 @@ msgstr "" msgid "%sYou should add this line in the file %s: %s" msgstr "" +#, c-format +msgid "" +"%sWarning: cannot set the locale; make sure $LANG and $LC_* variables are " +"correct" +msgstr "" + #, c-format msgid "Signal %s received, exiting WeeChat..." msgstr "" diff --git a/src/core/weechat.c b/src/core/weechat.c index fd387b30c..ffdab2511 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -89,6 +89,7 @@ struct timeval weechat_current_start_timeval; /* start time used to display */ int weechat_quit = 0; /* = 1 if quit request from user */ int weechat_sigsegv = 0; /* SIGSEGV received? */ char *weechat_home = NULL; /* home dir. (default: ~/.weechat) */ +int weechat_locale_ok = 0; /* is locale OK? */ char *weechat_local_charset = NULL; /* example: ISO-8859-1, UTF-8 */ int weechat_server_cmd_line = 0; /* at least 1 server on cmd line */ int weechat_auto_load_plugins = 1; /* auto load plugins */ @@ -428,6 +429,24 @@ weechat_term_check () } } +/* + * Displays warning about wrong locale ($LANG and $LC_*) if they are detected + * as wrong. + */ + +void +weechat_locale_check () +{ + if (!weechat_locale_ok) + { + gui_chat_printf ( + NULL, + _("%sWarning: cannot set the locale; make sure $LANG and $LC_* " + "variables are correct"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + } +} + /* * Callback for system signal SIGHUP: quits WeeChat. */ @@ -501,7 +520,7 @@ weechat_init (int argc, char *argv[], void (*gui_init_cb)()) weechat_first_start_time = time (NULL); /* initialize start time */ gettimeofday (&weechat_current_start_timeval, NULL); - setlocale (LC_ALL, ""); /* initialize gettext */ + weechat_locale_ok = (setlocale (LC_ALL, "") != NULL); /* init gettext */ #ifdef ENABLE_NLS bindtextdomain (PACKAGE, LOCALEDIR); bind_textdomain_codeset (PACKAGE, "UTF-8"); @@ -556,6 +575,7 @@ weechat_init (int argc, char *argv[], void (*gui_init_cb)()) weechat_welcome_message (); /* display WeeChat welcome message */ gui_chat_print_lines_waiting_buffer (NULL); /* display lines waiting */ weechat_term_check (); /* warnings about $TERM (if wrong) */ + weechat_locale_check (); /* warning about wrong locale */ command_startup (0); /* command executed before plugins */ plugin_init (weechat_auto_load_plugins, /* init plugin interface(s) */ argc, argv);