diff options
| author | Michael Biebl <biebl@debian.org> | 2012-08-07 14:23:24 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2012-08-07 14:23:24 +0200 |
| commit | 7f1d08cf21e97f5e60d4636bb1e6c287c34ee2df (patch) | |
| tree | 25da3ad8d884f15bde3c263281680a5fc3ea80e0 /test/nm-online.c | |
| parent | 867254ea7c2b193fecf8cd36cc6e5dc53c290d92 (diff) | |
Imported Upstream version 0.9.5.96 upstream/0.9.5.96
Diffstat (limited to 'test/nm-online.c')
| -rw-r--r-- | test/nm-online.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/test/nm-online.c b/test/nm-online.c index 985cc774..77f74638 100644 --- a/test/nm-online.c +++ b/test/nm-online.c @@ -30,14 +30,16 @@ * Robert Love <rml@novell.com> */ -#define PROGRESS_STEPS 15 +#include <config.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <getopt.h> +#include <locale.h> #include <glib.h> +#include <glib/gi18n.h> #include <dbus/dbus.h> #include <dbus/dbus-glib-lowlevel.h> #include <dbus/dbus-glib.h> @@ -45,6 +47,8 @@ #include "NetworkManager.h" #include "nm-glib-compat.h" +#define PROGRESS_STEPS 15 + typedef struct { int value; @@ -105,7 +109,7 @@ static gboolean handle_timeout (gpointer data) Timeout *timeout = (Timeout *) data; if (!timeout->quiet) { - g_print ("\rConnecting"); + g_print (_("\rConnecting")); for (; i > 0; i--) putchar ((timeout->value >= (i * timeout->norm)) ? ' ' : '.'); if (timeout->value) @@ -136,26 +140,33 @@ int main (int argc, char *argv[]) gboolean success; GOptionEntry options[] = { - {"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, "Time to wait for a connection, in seconds (default is 30)", NULL}, - {"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, "Exit immediately if NetworkManager is not running or connecting", NULL}, - {"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Don't print anything", NULL}, + {"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (default is 30)"), NULL}, + {"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL}, + {"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL}, {NULL} }; - opt_ctx = g_option_context_new (""); - g_option_context_set_translation_domain (opt_ctx, "UTF-8"); + /* Set locale to be able to use environment variables */ + setlocale (LC_ALL, ""); + + bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + opt_ctx = g_option_context_new (NULL); + g_option_context_set_translation_domain (opt_ctx, GETTEXT_PACKAGE); g_option_context_set_ignore_unknown_options (opt_ctx, FALSE); g_option_context_set_help_enabled (opt_ctx, TRUE); g_option_context_add_main_entries (opt_ctx, options, NULL); g_option_context_set_summary (opt_ctx, - "Waits for a successful connection in NetworkManager."); + _("Waits for a successful connection in NetworkManager.")); success = g_option_context_parse (opt_ctx, &argc, &argv, NULL); g_option_context_free (opt_ctx); if (!success) { - g_warning ("Invalid option. Please use --help to see a list of valid options."); + g_warning (_("Invalid option. Please use --help to see a list of valid options.")); return 2; } @@ -164,7 +175,7 @@ int main (int argc, char *argv[]) else timeout.value = 30; if (timeout.value < 0 || timeout.value > 3600) { - g_warning ("Invalid option. Please use --help to see a list of valid options."); + g_warning (_("Invalid option. Please use --help to see a list of valid options.")); return 2; } |