diff --git a/po/POTFILES b/po/POTFILES index 3285180..887c305 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -24,5 +24,6 @@ ../src/panelctl.c ../src/run.c ../src/window.c +../tools/message.c ../tools/notify.c ../tools/test.c diff --git a/tools/message.c b/tools/message.c index 08e9702..4bfe5e1 100644 --- a/tools/message.c +++ b/tools/message.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2012 Pierre Pronchery */ +/* Copyright (c) 2012-2013 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Panel */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,8 +19,26 @@ #include #include #include +#include +#include #include #include "../include/Panel.h" +#include "../config.h" +#define _(string) gettext(string) + +/* constants */ +#ifndef PROGNAME +# define PROGNAME "panel-message" +#endif +#ifndef PREFIX +# define PREFIX "/usr/local" +#endif +#ifndef DATADIR +# define DATADIR PREFIX "/share" +#endif +#ifndef LOCALEDIR +# define LOCALEDIR DATADIR "/locale" +#endif /* private */ @@ -55,23 +73,23 @@ static int _message(unsigned int timeout, GtkMessageType type, case GTK_MESSAGE_ERROR: stock = GTK_STOCK_DIALOG_ERROR; if(title == NULL) - title = "Error"; + title = _("Error"); break; case GTK_MESSAGE_QUESTION: stock = GTK_STOCK_DIALOG_QUESTION; if(title == NULL) - title = "Question"; + title = _("Question"); break; case GTK_MESSAGE_WARNING: stock = GTK_STOCK_DIALOG_WARNING; if(title == NULL) - title = "Warning"; + title = _("Warning"); break; case GTK_MESSAGE_INFO: default: stock = GTK_STOCK_DIALOG_INFO; if(title == NULL) - title = "Information"; + title = _("Information"); break; } plug = gtk_plug_new(0); @@ -123,8 +141,8 @@ static gboolean _message_on_timeout(gpointer data) /* usage */ static int _usage(void) { - fputs("Usage: panel-message [-EIQW][-T title][-t timeout] message\n", - stderr); + fprintf(stderr, _("Usage: %s [-EIQW][-T title][-t timeout] message\n"), + PROGNAME); return 1; } @@ -140,6 +158,9 @@ int main(int argc, char * argv[]) int o; char * p; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); gtk_init(&argc, &argv); while((o = getopt(argc, argv, "EIQT:Wt:")) != -1) switch(o)