aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-06-05 18:51:26 +0000
committerKalle Wallin <kaw@linux.se>2004-06-05 18:51:26 +0000
commit9b2d077c7f5dca6e4013f04318f7b83531fac387 (patch)
treefa6ea3f9e8ba86e744cfe53ea1a6d58a9e63ecf9 /src/main.c
parent225e70a38b68cba219aeb7cb239f426ca739ed7d (diff)
downloadmpd-9b2d077c7f5dca6e4013f04318f7b83531fac387.tar.gz
mpd-9b2d077c7f5dca6e4013f04318f7b83531fac387.tar.xz
mpd-9b2d077c7f5dca6e4013f04318f7b83531fac387.zip
Added initial i18n support
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1346 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main.c b/src/main.c
index bb3740b62..15ecf4532 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,6 +23,7 @@
#include <glib.h>
#include "config.h"
+#include "ncmpc.h"
#include "libmpdclient.h"
#include "support.h"
#include "mpc.h"
@@ -31,13 +32,6 @@
#include "screen.h"
#include "conf.h"
-/* time in seconds between mpd updates (double) */
-#define MPD_UPDATE_TIME 0.5
-
-/* timout in seconds before trying to reconnect (int) */
-#define MPD_RECONNECT_TIMEOUT 3
-
-
static mpd_client_t *mpc = NULL;
static GTimer *timer = NULL;
@@ -62,7 +56,7 @@ exit_and_cleanup(void)
void
catch_sigint( int sig )
{
- printf( "\nExiting...\n");
+ printf( _("\nExiting...\n"));
exit(EXIT_SUCCESS);
}
@@ -73,6 +67,13 @@ main(int argc, const char *argv[])
struct sigaction act;
gboolean connected;
+ /* initialize i18n support */
+#ifdef ENABLE_NLS
+ setlocale(LC_MESSAGES, "");
+ bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
+ textdomain(GETTEXT_PACKAGE);
+#endif
+
/* initialize options */
options = options_init();
@@ -85,7 +86,7 @@ main(int argc, const char *argv[])
/* check key bindings */
if( check_key_bindings() )
{
- fprintf(stderr, "Confusing key bindings - exiting!\n");
+ fprintf(stderr, _("Confusing key bindings - exiting!\n"));
exit(EXIT_FAILURE);
}
@@ -149,7 +150,7 @@ main(int argc, const char *argv[])
}
else if( mpc_error(mpc) )
{
- screen_status_printf("Lost connection to %s", options->host);
+ screen_status_printf(_("Lost connection to %s"), options->host);
connected = FALSE;
doupdate();
mpd_clearError(mpc->connection);
@@ -179,14 +180,14 @@ main(int argc, const char *argv[])
else if( options->reconnect )
{
sleep(MPD_RECONNECT_TIMEOUT);
- screen_status_printf("Connecting to %s... [Press Ctrl-C to abort]",
+ screen_status_printf(_("Connecting to %s... [Press Ctrl-C to abort]"),
options->host);
if( mpc_reconnect(mpc,
options->host,
options->port,
options->password) == 0 )
{
- screen_status_printf("Connected to %s!", options->host);
+ screen_status_printf(_("Connected to %s!"), options->host);
connected = TRUE;
}
doupdate();