core: display a warning on startup if the locale can not be set (closes #373)

This commit is contained in:
Sébastien Helleu 2015-03-30 19:16:28 +02:00
parent 7d59c0523e
commit 6d8f2d3e97
14 changed files with 109 additions and 14 deletions

View File

@ -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

View File

@ -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 <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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..."

View File

@ -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 <weechatter@arcor.de>\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..."

View File

@ -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 <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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..."

View File

@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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..."

View File

@ -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 <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 ""

View File

@ -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 <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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..."

View File

@ -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 <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\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 の終了中..."

View File

@ -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 <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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..."

View File

@ -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 <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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..."

View File

@ -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 <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 ""

View File

@ -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 <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 ""

View File

@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 ""

View File

@ -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);