add i18n support for the utilities.
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Dec 2007 15:12:55 +0000 (15:12 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 17 Dec 2007 15:12:55 +0000 (15:12 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1598 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-ui/avahi-ui.c
avahi-ui/bssh.c
avahi-utils/avahi-browse.c
avahi-utils/avahi-publish.c
avahi-utils/avahi-resolve.c
avahi-utils/avahi-set-host-name.c
po/de.po

index 537ca5b..a54cbe9 100644 (file)
@@ -681,7 +681,7 @@ static const gchar *get_domain_name(AuiServiceDialog *d) {
                                               GTK_DIALOG_DESTROY_WITH_PARENT,
                                               GTK_MESSAGE_ERROR,
                                               GTK_BUTTONS_CLOSE,
-                                              _("Failed to read Avahi domain : %s"),
+                                              _("Failed to read Avahi domain: %s"),
                                               avahi_strerror(avahi_client_errno(d->priv->client)));
         gtk_dialog_run(GTK_DIALOG(m));
         gtk_widget_destroy(m);
index d5bec12..3c06420 100644 (file)
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <locale.h>
 
 #include <gtk/gtk.h>
 
@@ -42,6 +43,7 @@ int main(int argc, char*argv[]) {
     GtkWidget *d;
 
     avahi_init_i18n();
+    setlocale(LC_ALL, "");
 
     gtk_init(&argc, &argv);
 
index d75d1a9..e9af2d0 100644 (file)
@@ -2,17 +2,17 @@
 
 /***
   This file is part of avahi.
+
   avahi is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
+
   avahi is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
   Public License for more details.
+
   You should have received a copy of the GNU Lesser General Public
   License along with avahi; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,6 +38,7 @@
 #include <avahi-common/malloc.h>
 #include <avahi-common/domain.h>
 #include <avahi-common/llist.h>
+#include <avahi-common/i18n.h>
 #include <avahi-client/client.h>
 #include <avahi-client/lookup.h>
 
@@ -100,25 +101,25 @@ static void check_terminate(Config *c) {
     assert(n_all_for_now >= 0);
     assert(n_cache_exhausted >= 0);
     assert(n_resolving >= 0);
-    
+
     if (n_all_for_now <= 0 && n_resolving <= 0) {
 
         if (c->verbose && !c->parsable) {
-            printf(": All for now\n");
+            printf(_(": All for now\n"));
             n_all_for_now++; /* Make sure that this event is not repeated */
         }
-        
+
         if (c->terminate_on_all_for_now)
             avahi_simple_poll_quit(simple_poll);
     }
-    
+
     if (n_cache_exhausted <= 0 && n_resolving <= 0) {
 
         if (c->verbose && !c->parsable) {
-            printf(": Cache exhausted\n");
+            printf(_(": Cache exhausted\n"));
             n_cache_exhausted++; /* Make sure that this event is not repeated */
         }
-        
+
         if (c->terminate_on_cache_exhausted)
             avahi_simple_poll_quit(simple_poll);
     }
@@ -150,18 +151,18 @@ static void print_service_line(Config *config, char c, AvahiIfIndex interface, A
     if (config->parsable) {
         char sn[AVAHI_DOMAIN_NAME_MAX], *e = sn;
         size_t l = sizeof(sn);
-        
+
         printf("%c;%s;%s;%s;%s;%s%s",
                c,
-               interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
-               protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a", 
+               interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : _("n/a"),
+               protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : _("n/a"),
                avahi_escape_label(name, strlen(name), &e, &l), type, domain, nl ? "\n" : "");
 
     } else
         printf("%c %4s %4s %-*s %-20s %s\n",
                c,
-               interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
-               protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a", 
+               interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : _("n/a"),
+               protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : _("n/a"),
                n_columns-35, name, type, domain);
     fflush(stdout);
 }
@@ -180,9 +181,9 @@ static void service_resolver_callback(
     AvahiStringList *txt,
     AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     void *userdata) {
-    
+
     ServiceInfo *i = userdata;
-    
+
     assert(r);
     assert(i);
 
@@ -211,19 +212,19 @@ static void service_resolver_callback(
                        address,
                        port,
                        t);
-                
+
             avahi_free(t);
 
             break;
         }
 
         case AVAHI_RESOLVER_FAILURE:
-            
-            fprintf(stderr, "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(client)));
+
+            fprintf(stderr, _("Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"), name, type, domain, avahi_strerror(avahi_client_errno(client)));
             break;
     }
 
-    
+
     avahi_service_resolver_free(i->resolver);
     i->resolver = NULL;
 
@@ -241,7 +242,7 @@ static ServiceInfo *add_service(Config *c, AvahiIfIndex interface, AvahiProtocol
     if (c->resolve) {
         if (!(i->resolver = avahi_service_resolver_new(client, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, i))) {
             avahi_free(i);
-            fprintf(stderr, "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"), name, type, domain, avahi_strerror(avahi_client_errno(client)));
             return NULL;
         }
 
@@ -269,7 +270,7 @@ static void remove_service(Config *c, ServiceInfo *i) {
 
     if (i->resolver)
         avahi_service_resolver_free(i->resolver);
-    
+
     avahi_free(i->name);
     avahi_free(i->type);
     avahi_free(i->domain);
@@ -288,7 +289,7 @@ static void service_browser_callback(
     void *userdata) {
 
     Config *c = userdata;
-    
+
     assert(b);
     assert(c);
 
@@ -309,18 +310,18 @@ static void service_browser_callback(
 
         case AVAHI_BROWSER_REMOVE: {
             ServiceInfo *info;
-            
+
             if (!(info = find_service(interface, protocol, name, type, domain)))
                 return;
 
             remove_service(c, info);
-            
+
             print_service_line(c, '-', interface, protocol, name, type, domain, 1);
             break;
         }
-            
+
         case AVAHI_BROWSER_FAILURE:
-            fprintf(stderr, "service_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("service_browser failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
             avahi_simple_poll_quit(simple_poll);
             break;
 
@@ -328,7 +329,7 @@ static void service_browser_callback(
             n_cache_exhausted --;
             check_terminate(c);
             break;
-            
+
         case AVAHI_BROWSER_ALL_FOR_NOW:
             n_all_for_now --;
             check_terminate(c);
@@ -339,7 +340,7 @@ static void service_browser_callback(
 static void browse_service_type(Config *c, const char *stype, const char *domain) {
     AvahiServiceBrowser *b;
     AvahiStringList *i;
-    
+
     assert(c);
     assert(client);
     assert(stype);
@@ -358,7 +359,7 @@ static void browse_service_type(Config *c, const char *stype, const char *domain
               service_browser_callback,
               c))) {
 
-        fprintf(stderr, "avahi_service_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
+        fprintf(stderr, _("avahi_service_browser_new() failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
         avahi_simple_poll_quit(simple_poll);
     }
 
@@ -382,9 +383,9 @@ static void service_type_browser_callback(
 
     assert(b);
     assert(c);
-    
+
     switch (event) {
-        
+
         case AVAHI_BROWSER_NEW:
             browse_service_type(c, type, domain);
             break;
@@ -394,15 +395,15 @@ static void service_type_browser_callback(
             break;
 
         case AVAHI_BROWSER_FAILURE:
-            fprintf(stderr, "service_type_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("service_type_browser failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
             avahi_simple_poll_quit(simple_poll);
             break;
-            
+
         case AVAHI_BROWSER_CACHE_EXHAUSTED:
             n_cache_exhausted --;
             check_terminate(c);
             break;
-            
+
         case AVAHI_BROWSER_ALL_FOR_NOW:
             n_all_for_now --;
             check_terminate(c);
@@ -412,7 +413,7 @@ static void service_type_browser_callback(
 
 static void browse_all(Config *c) {
     AvahiServiceTypeBrowser *b;
-    
+
     assert(c);
 
     if (!(b = avahi_service_type_browser_new(
@@ -423,8 +424,8 @@ static void browse_all(Config *c) {
               0,
               service_type_browser_callback,
               c))) {
-        
-        fprintf(stderr, "avahi_service_type_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
+
+        fprintf(stderr, _("avahi_service_type_browser_new() failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
         avahi_simple_poll_quit(simple_poll);
     }
 
@@ -445,9 +446,9 @@ static void domain_browser_callback(
 
     assert(b);
     assert(c);
-    
+
     switch (event) {
-        
+
         case AVAHI_BROWSER_NEW:
         case AVAHI_BROWSER_REMOVE: {
             char ifname[IF_NAMESIZE];
@@ -456,27 +457,27 @@ static void domain_browser_callback(
                 printf("%c;%s;%s;%s\n",
                        event == AVAHI_BROWSER_NEW ? '+' : '-',
                        interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "",
-                       protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "", 
+                       protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "",
                        domain);
             else
                 printf("%c %4s %4s %s\n",
                        event == AVAHI_BROWSER_NEW ? '+' : '-',
                        interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
-                       protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a", 
+                       protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a",
                        domain);
             break;
         }
 
         case AVAHI_BROWSER_FAILURE:
-            fprintf(stderr, "domain_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, ("domain_browser failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
             avahi_simple_poll_quit(simple_poll);
             break;
-            
+
         case AVAHI_BROWSER_CACHE_EXHAUSTED:
             n_cache_exhausted --;
             check_terminate(c);
             break;
-            
+
         case AVAHI_BROWSER_ALL_FOR_NOW:
             n_all_for_now --;
             check_terminate(c);
@@ -499,7 +500,7 @@ static void browse_domains(Config *c) {
               domain_browser_callback,
               c))) {
 
-        fprintf(stderr, "avahi_domain_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
+        fprintf(stderr, _("avahi_domain_browser_new() failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
         avahi_simple_poll_quit(simple_poll);
     }
 
@@ -510,28 +511,28 @@ static void browse_domains(Config *c) {
 static int start(Config *config) {
 
     assert(!browsing);
-    
+
     if (config->verbose && !config->parsable) {
         const char *version, *hn;
-        
+
         if (!(version = avahi_client_get_version_string(client))) {
-            fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("Failed to query version string: %s\n"), avahi_strerror(avahi_client_errno(client)));
             return -1;
         }
-        
+
         if (!(hn = avahi_client_get_host_name_fqdn(client))) {
-            fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("Failed to query host name: %s\n"), avahi_strerror(avahi_client_errno(client)));
             return -1;
         }
-        
-        fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
-        
+
+        fprintf(stderr, _("Server version: %s; Host name: %s\n"), version, hn);
+
         if (config->command == COMMAND_BROWSE_DOMAINS)
-            fprintf(stderr, "E Ifce Prot Domain\n");
+            fprintf(stderr, _("E Ifce Prot Domain\n"));
         else
-            fprintf(stderr, "E Ifce Prot %-*s %-20s Domain\n", n_columns-35, "Name", "Type");
+            fprintf(stderr, _("E Ifce Prot %-*s %-20s Domain\n"), n_columns-35, _("Name"), _("Type"));
     }
-    
+
     if (config->command == COMMAND_BROWSE_SERVICES)
         browse_service_type(config, config->stype, config->domain);
     else if (config->command == COMMAND_BROWSE_ALL_SERVICES)
@@ -544,47 +545,47 @@ static int start(Config *config) {
     browsing = 1;
     return 0;
 }
-    
+
 static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
     Config *config = userdata;
 
     /* This function might be called when avahi_client_new() has not
      * returned yet.*/
     client = c;
-    
+
     switch (state) {
         case AVAHI_CLIENT_FAILURE:
-            
+
             if (config->no_fail && avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED) {
                 int error;
 
                 /* We have been disconnected, so let reconnect */
 
-                fprintf(stderr, "Disconnected, reconnecting ...\n");
+                fprintf(stderr, _("Disconnected, reconnecting ...\n"));
 
                 avahi_client_free(client);
                 client = NULL;
 
                 avahi_string_list_free(browsed_types);
                 browsed_types = NULL;
-                
+
                 while (services)
                     remove_service(config, services);
 
                 browsing = 0;
 
                 if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), AVAHI_CLIENT_NO_FAIL, client_callback, config, &error))) {
-                    fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
+                    fprintf(stderr, _("Failed to create client object: %s\n"), avahi_strerror(error));
                     avahi_simple_poll_quit(simple_poll);
                 }
 
             } else {
-                fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
+                fprintf(stderr, _("Client failure, exiting: %s\n"), avahi_strerror(avahi_client_errno(c)));
                 avahi_simple_poll_quit(simple_poll);
             }
-            
+
             break;
-            
+
         case AVAHI_CLIENT_S_REGISTERING:
         case AVAHI_CLIENT_S_RUNNING:
         case AVAHI_CLIENT_S_COLLISION:
@@ -594,11 +595,11 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
                     avahi_simple_poll_quit(simple_poll);
 
             break;
-            
+
         case AVAHI_CLIENT_CONNECTING:
-            
+
             if (config->verbose && !config->parsable)
-                fprintf(stderr, "Waiting for daemon ...\n");
+                fprintf(stderr, _("Waiting for daemon ...\n"));
 
             break;
     }
@@ -621,22 +622,24 @@ static void help(FILE *f, const char *argv0) {
 #endif
                 argv0, argv0, argv0);
 
-            fprintf(f, 
-            "    -h --help            Show this help\n"
-            "    -V --version         Show version\n"
-            "    -D --browse-domains  Browse for browsing domains instead of services\n"
-            "    -a --all             Show all services, regardless of the type\n"
-            "    -d --domain=DOMAIN   The domain to browse in\n"
-            "    -v --verbose         Enable verbose mode\n"
-            "    -t --terminate       Terminate after dumping a more or less complete list\n"
-            "    -c --cache           Terminate after dumping all entries from the cache\n"
-            "    -l --ignore-local    Ignore local services\n"
-            "    -r --resolve         Resolve services found\n"
-            "    -f --no-fail         Don't fail if the daemon is not available\n"
-            "    -p --parsable        Output in parsable format\n"        
+    fprintf(f, "%s%s",
+            _("    -h --help            Show this help\n"
+              "    -V --version         Show version\n"
+              "    -D --browse-domains  Browse for browsing domains instead of services\n"
+              "    -a --all             Show all services, regardless of the type\n"
+              "    -d --domain=DOMAIN   The domain to browse in\n"
+              "    -v --verbose         Enable verbose mode\n"
+              "    -t --terminate       Terminate after dumping a more or less complete list\n"
+              "    -c --cache           Terminate after dumping all entries from the cache\n"
+              "    -l --ignore-local    Ignore local services\n"
+              "    -r --resolve         Resolve services found\n"
+              "    -f --no-fail         Don't fail if the daemon is not available\n"
+              "    -p --parsable        Output in parsable format\n"),
 #if defined(HAVE_GDBM) || defined(HAVE_DBM)
-            "    -k --no-db-lookup    Don't lookup service types\n"
-            "    -b --dump-db         Dump service type database\n"        
+            _("    -k --no-db-lookup    Don't lookup service types\n"
+              "    -b --dump-db         Dump service type database\n")
+#else
+            ""
 #endif
             );
 }
@@ -679,7 +682,7 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
 #if defined(HAVE_GDBM) || defined(HAVE_DBM)
     c->no_db_lookup = 0;
 #endif
-    
+
     while ((o = getopt_long(argc, argv, "hVd:avtclrDfp"
 #if defined(HAVE_GDBM) || defined(HAVE_DBM)
                             "kb"
@@ -739,19 +742,19 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
 
     if (c->command == COMMAND_BROWSE_SERVICES) {
         if (optind >= argc) {
-            fprintf(stderr, "Too few arguments\n");
+            fprintf(stderr, _("Too few arguments\n"));
             return -1;
         }
 
         c->stype = avahi_strdup(argv[optind]);
         optind++;
     }
-    
+
     if (optind < argc) {
-        fprintf(stderr, "Too many arguments\n");
+        fprintf(stderr, _("Too many arguments\n"));
         return -1;
     }
-        
+
     return 0;
 }
 
@@ -761,6 +764,7 @@ int main(int argc, char *argv[]) {
     const char *argv0;
     char *ec;
 
+    avahi_init_i18n();
     setlocale(LC_ALL, "");
 
     if ((argv0 = strrchr(argv[0], '/')))
@@ -773,7 +777,7 @@ int main(int argc, char *argv[]) {
 
     if (n_columns < 40)
         n_columns = 40;
-    
+
     if (parse_command_line(&config, argv0, argc, argv) < 0)
         goto fail;
 
@@ -782,7 +786,7 @@ int main(int argc, char *argv[]) {
             help(stdout, argv0);
             ret = 0;
             break;
-            
+
         case COMMAND_VERSION:
             printf("%s "PACKAGE_VERSION"\n", argv0);
             ret = 0;
@@ -791,20 +795,20 @@ int main(int argc, char *argv[]) {
         case COMMAND_BROWSE_SERVICES:
         case COMMAND_BROWSE_ALL_SERVICES:
         case COMMAND_BROWSE_DOMAINS:
-            
+
             if (!(simple_poll = avahi_simple_poll_new())) {
-                fprintf(stderr, "Failed to create simple poll object.\n");
+                fprintf(stderr, _("Failed to create simple poll object.\n"));
                 goto fail;
             }
-            
+
             if (sigint_install(simple_poll) < 0)
                 goto fail;
-            
+
             if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), config.no_fail ? AVAHI_CLIENT_NO_FAIL : 0, client_callback, &config, &error))) {
-                fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
+                fprintf(stderr, _("Failed to create client object: %s\n"), avahi_strerror(error));
                 goto fail;
             }
-            
+
             avahi_simple_poll_loop(simple_poll);
             ret = 0;
             break;
@@ -820,14 +824,14 @@ int main(int argc, char *argv[]) {
                 else
                     printf("%s\n", stdb_lookup(t));
             }
-            
+
             ret = 0;
             break;
         }
 #endif
     }
-    
-    
+
+
 fail:
 
     while (services)
@@ -837,7 +841,7 @@ fail:
         avahi_client_free(client);
 
     sigint_uninstall();
-    
+
     if (simple_poll)
         avahi_simple_poll_free(simple_poll);
 
@@ -848,7 +852,7 @@ fail:
 
 #if defined(HAVE_GDBM) || defined(HAVE_DBM)
     stdb_shutdown();
-#endif    
+#endif
 
     return ret;
 }
index 4e75176..9c9a93c 100644 (file)
@@ -2,17 +2,17 @@
 
 /***
   This file is part of avahi.
+
   avahi is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
+
   avahi is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
   Public License for more details.
+
   You should have received a copy of the GNU Lesser General Public
   License along with avahi; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 #include <string.h>
 #include <sys/types.h>
 #include <errno.h>
+#include <locale.h>
 
 #include <avahi-common/simple-watch.h>
 #include <avahi-common/error.h>
 #include <avahi-common/malloc.h>
 #include <avahi-common/alternative.h>
+#include <avahi-common/i18n.h>
 #include <avahi-client/client.h>
 #include <avahi-client/publish.h>
 
 #include "sigint.h"
 
 typedef enum {
-    COMMAND_UNSPEC, 
+    COMMAND_UNSPEC,
     COMMAND_HELP,
     COMMAND_VERSION,
     COMMAND_PUBLISH_SERVICE,
@@ -73,12 +75,12 @@ static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state,
 
         case AVAHI_ENTRY_GROUP_ESTABLISHED:
 
-            fprintf(stderr, "Established under name '%s'\n", config->name);
+            fprintf(stderr, _("Established under name '%s'\n"), config->name);
             break;
 
         case AVAHI_ENTRY_GROUP_FAILURE:
-            
-            fprintf(stderr, "Failed to register: %s\n", avahi_strerror(avahi_client_errno(client)));
+
+            fprintf(stderr, _("Failed to register: %s\n"), avahi_strerror(avahi_client_errno(client)));
             break;
 
         case AVAHI_ENTRY_GROUP_COLLISION: {
@@ -91,15 +93,15 @@ static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state,
                 n = avahi_alternative_host_name(config->name);
             }
 
-            fprintf(stderr, "Name collision, picking new name '%s'.\n", n);
+            fprintf(stderr, _("Name collision, picking new name '%s'.\n"), n);
             avahi_free(config->name);
             config->name = n;
-            
+
             register_stuff(config);
-                
+
             break;
         }
-            
+
         case AVAHI_ENTRY_GROUP_UNCOMMITED:
         case AVAHI_ENTRY_GROUP_REGISTERING:
             ;
@@ -111,7 +113,7 @@ static int register_stuff(Config *config) {
 
     if (!entry_group) {
         if (!(entry_group = avahi_entry_group_new(client, entry_group_callback, config))) {
-            fprintf(stderr, "Failed to create entry group: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("Failed to create entry group: %s\n"), avahi_strerror(avahi_client_errno(client)));
             return -1;
         }
     }
@@ -121,23 +123,23 @@ static int register_stuff(Config *config) {
     if (config->command == COMMAND_PUBLISH_ADDRESS) {
 
         if (avahi_entry_group_add_address(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, &config->address) < 0) {
-            fprintf(stderr, "Failed to add address: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("Failed to add address: %s\n"), avahi_strerror(avahi_client_errno(client)));
             return -1;
         }
-        
+
     } else {
         AvahiStringList *i;
-        
+
         assert(config->command == COMMAND_PUBLISH_SERVICE);
 
         if (avahi_entry_group_add_service_strlst(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, config->host, config->port, config->txt) < 0) {
-            fprintf(stderr, "Failed to add service: %s\n", avahi_strerror(avahi_client_errno(client)));
+            fprintf(stderr, _("Failed to add service: %s\n"), avahi_strerror(avahi_client_errno(client)));
             return -1;
         }
 
         for (i = config->subtypes; i; i = i->next)
             if (avahi_entry_group_add_service_subtype(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, (char*) i->text) < 0) {
-                fprintf(stderr, "Failed to add subtype '%s': %s\n", i->text, avahi_strerror(avahi_client_errno(client)));
+                fprintf(stderr, _("Failed to add subtype '%s': %s\n"), i->text, avahi_strerror(avahi_client_errno(client)));
                 return -1;
             }
     }
@@ -149,9 +151,9 @@ static int register_stuff(Config *config) {
 
 static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
     Config *config = userdata;
-    
+
     client = c;
-    
+
     switch (state) {
         case AVAHI_CLIENT_FAILURE:
 
@@ -160,38 +162,38 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
 
                 /* We have been disconnected, so let reconnect */
 
-                fprintf(stderr, "Disconnected, reconnecting ...\n");
+                fprintf(stderr, _("Disconnected, reconnecting ...\n"));
 
                 avahi_client_free(client);
                 client = NULL;
                 entry_group = NULL;
 
                 if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), AVAHI_CLIENT_NO_FAIL, client_callback, config, &error))) {
-                    fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
+                    fprintf(stderr, _("Failed to create client object: %s\n"), avahi_strerror(error));
                     avahi_simple_poll_quit(simple_poll);
                 }
 
             } else {
-                fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
+                fprintf(stderr, _("Client failure, exiting: %s\n"), avahi_strerror(avahi_client_errno(c)));
                 avahi_simple_poll_quit(simple_poll);
             }
 
             break;
-            
+
         case AVAHI_CLIENT_S_RUNNING:
 
             if (register_stuff(config) < 0)
                 avahi_simple_poll_quit(simple_poll);
-            
+
             break;
 
         case AVAHI_CLIENT_S_COLLISION:
 
             if (config->verbose)
-                fprintf(stderr, "Host name conflict\n");
+                fprintf(stderr, _("Host name conflict\n"));
 
             /* Fall through */
-            
+
         case AVAHI_CLIENT_S_REGISTERING:
 
             if (entry_group) {
@@ -199,33 +201,33 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
                 entry_group = NULL;
             }
             break;
-            
+
         case AVAHI_CLIENT_CONNECTING:
-            
+
             if (config->verbose)
-                fprintf(stderr, "Waiting for daemon ...\n");
-            
+                fprintf(stderr, _("Waiting for daemon ...\n"));
+
             break;
-            
+
             ;
     }
 }
 
 static void help(FILE *f, const char *argv0) {
     fprintf(f,
-            "%s [options] %s <name> <type> <port> [<txt ...>]\n"
-            "%s [options] %s <host-name> <address>\n\n"
-            "    -h --help            Show this help\n"
-            "    -V --version         Show version\n"
-            "    -s --service         Publish service\n"
-            "    -a --address         Publish address\n"
-            "    -v --verbose         Enable verbose mode\n"
-            "    -d --domain=DOMAIN   Domain to publish service in\n"
-            "    -H --host=DOMAIN     Host where service resides\n"
-            "       --subtype=SUBTYPE An additional subtype to register this service with\n"
-            "    -f --no-fail         Don't fail if the daemon is not available\n",
-            argv0, strstr(argv0, "service") ? "[-s]" : "-s",
-            argv0, strstr(argv0, "address") ? "[-a]" : "-a");
+            _("%s [options] %s <name> <type> <port> [<txt ...>]\n"
+              "%s [options] %s <host-name> <address>\n\n"
+              "    -h --help            Show this help\n"
+              "    -V --version         Show version\n"
+              "    -s --service         Publish service\n"
+              "    -a --address         Publish address\n"
+              "    -v --verbose         Enable verbose mode\n"
+              "    -d --domain=DOMAIN   Domain to publish service in\n"
+              "    -H --host=DOMAIN     Host where service resides\n"
+              "       --subtype=SUBTYPE An additional subtype to register this service with\n"
+              "    -f --no-fail         Don't fail if the daemon is not available\n"),
+              argv0, strstr(argv0, "service") ? "[-s]" : "-s",
+              argv0, strstr(argv0, "address") ? "[-a]" : "-a");
 }
 
 static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
@@ -234,7 +236,7 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
     enum {
         ARG_SUBTYPE = 256
     };
-    
+
     static const struct option long_options[] = {
         { "help",           no_argument,       NULL, 'h' },
         { "version",        no_argument,       NULL, 'V' },
@@ -295,22 +297,22 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
 
     if (c->command == COMMAND_PUBLISH_ADDRESS) {
         if (optind+2 !=  argc) {
-            fprintf(stderr, "Bad number of arguments\n");
+            fprintf(stderr, _("Bad number of arguments\n"));
             return -1;
         }
 
         avahi_free(c->name);
         c->name = avahi_strdup(argv[optind]);
         avahi_address_parse(argv[optind+1], AVAHI_PROTO_UNSPEC, &c->address);
-        
+
     } else if (c->command == COMMAND_PUBLISH_SERVICE) {
 
         char *e;
         long int p;
         int i;
-        
+
         if (optind+3 > argc) {
-            fprintf(stderr, "Bad number of arguments\n");
+            fprintf(stderr, _("Bad number of arguments\n"));
             return -1;
         }
 
@@ -321,16 +323,16 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
         p = strtol(argv[optind+2], &e, 0);
 
         if (errno != 0 || *e || p < 0 || p > 0xFFFF) {
-            fprintf(stderr, "Failed to parse port number: %s\n", argv[optind+2]);
+            fprintf(stderr, _("Failed to parse port number: %s\n"), argv[optind+2]);
             return -1;
         }
 
         c->port = p;
-            
+
         for (i = optind+3; i < argc; i++)
             c->txt = avahi_string_list_add(c->txt, argv[i]);
     }
-        
+
     return 0;
 }
 
@@ -339,6 +341,9 @@ int main(int argc, char *argv[]) {
     Config config;
     const char *argv0;
 
+    avahi_init_i18n();
+    setlocale(LC_ALL, "");
+
     if ((argv0 = strrchr(argv[0], '/')))
         argv0++;
     else
@@ -350,14 +355,14 @@ int main(int argc, char *argv[]) {
     switch (config.command) {
         case COMMAND_UNSPEC:
             ret = 1;
-            fprintf(stderr, "No command specified.\n");
+            fprintf(stderr, _("No command specified.\n"));
             break;
-            
+
         case COMMAND_HELP:
             help(stdout, argv0);
             ret = 0;
             break;
-            
+
         case COMMAND_VERSION:
             printf("%s "PACKAGE_VERSION"\n", argv0);
             ret = 0;
@@ -365,17 +370,17 @@ int main(int argc, char *argv[]) {
 
         case COMMAND_PUBLISH_SERVICE:
         case COMMAND_PUBLISH_ADDRESS:
-            
+
             if (!(simple_poll = avahi_simple_poll_new())) {
-                fprintf(stderr, "Failed to create simple poll object.\n");
+                fprintf(stderr, _("Failed to create simple poll object.\n"));
                 goto fail;
             }
-            
+
             if (sigint_install(simple_poll) < 0)
                 goto fail;
-            
+
             if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), config.no_fail ? AVAHI_CLIENT_NO_FAIL : 0, client_callback, &config, &error))) {
-                fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
+                fprintf(stderr, _("Failed to create client object: %s\n"), avahi_strerror(error));
                 goto fail;
             }
 
@@ -383,30 +388,30 @@ int main(int argc, char *argv[]) {
                 const char *version, *hn;
 
                 if (!(version = avahi_client_get_version_string(client))) {
-                    fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query version string: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
 
                 if (!(hn = avahi_client_get_host_name_fqdn(client))) {
-                    fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query host name: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
-                
-                fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
+
+                fprintf(stderr, _("Server version: %s; Host name: %s\n"), version, hn);
             }
 
             avahi_simple_poll_loop(simple_poll);
             ret = 0;
             break;
     }
-    
+
 fail:
 
     if (client)
         avahi_client_free(client);
 
     sigint_uninstall();
-    
+
     if (simple_poll)
         avahi_simple_poll_free(simple_poll);
 
index 16bb1b5..0077248 100644 (file)
@@ -2,17 +2,17 @@
 
 /***
   This file is part of avahi.
+
   avahi is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
+
   avahi is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
   Public License for more details.
+
   You should have received a copy of the GNU Lesser General Public
   License along with avahi; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 #include <avahi-common/malloc.h>
 #include <avahi-common/domain.h>
 #include <avahi-common/llist.h>
+#include <avahi-common/i18n.h>
 #include <avahi-client/client.h>
 #include <avahi-client/lookup.h>
 
 #include "sigint.h"
 
 typedef enum {
-    COMMAND_UNSPEC, 
+    COMMAND_UNSPEC,
     COMMAND_HELP,
     COMMAND_VERSION,
     COMMAND_RESOLVE_HOST_NAME,
@@ -71,7 +72,7 @@ static void host_name_resolver_callback(
     const AvahiAddress *a,
     AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     AVAHI_GCC_UNUSED void *userdata) {
-    
+
     assert(r);
 
     switch (event) {
@@ -81,17 +82,17 @@ static void host_name_resolver_callback(
             avahi_address_snprint(address, sizeof(address), a);
 
             printf("%s\t%s\n", name, address);
-            
+
             break;
         }
 
         case AVAHI_RESOLVER_FAILURE:
-            
-            fprintf(stderr, "Failed to resolve host name '%s': %s\n", name, avahi_strerror(avahi_client_errno(client)));
+
+            fprintf(stderr, _("Failed to resolve host name '%s': %s\n"), name, avahi_strerror(avahi_client_errno(client)));
             break;
     }
 
-    
+
     avahi_host_name_resolver_free(r);
 
     assert(n_resolving > 0);
@@ -110,7 +111,7 @@ static void address_resolver_callback(
     const char *name,
     AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     AVAHI_GCC_UNUSED void *userdata) {
-    
+
     char address[AVAHI_ADDRESS_STR_MAX];
     assert(r);
 
@@ -123,12 +124,12 @@ static void address_resolver_callback(
             break;
 
         case AVAHI_RESOLVER_FAILURE:
-            
-            fprintf(stderr, "Failed to resolve address '%s': %s\n", address, avahi_strerror(avahi_client_errno(client)));
+
+            fprintf(stderr, _("Failed to resolve address '%s': %s\n"), address, avahi_strerror(avahi_client_errno(client)));
             break;
     }
 
-    
+
     avahi_address_resolver_free(r);
 
     assert(n_resolving > 0);
@@ -141,10 +142,10 @@ static void address_resolver_callback(
 static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
     switch (state) {
         case AVAHI_CLIENT_FAILURE:
-            fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
+            fprintf(stderr, _("Client failure, exiting: %s\n"), avahi_strerror(avahi_client_errno(c)));
             avahi_simple_poll_quit(simple_poll);
             break;
-            
+
         case AVAHI_CLIENT_S_REGISTERING:
         case AVAHI_CLIENT_S_RUNNING:
         case AVAHI_CLIENT_S_COLLISION:
@@ -155,15 +156,15 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
 
 static void help(FILE *f, const char *argv0) {
     fprintf(f,
-            "%s [options] %s <host name ...>\n"
-            "%s [options] %s <address ... >\n\n"
-            "    -h --help            Show this help\n"
-            "    -V --version         Show version\n"
-            "    -n --name            Resolve host name\n"
-            "    -a --address         Resolve address\n"
-            "    -v --verbose         Enable verbose mode\n"
-            "    -6                   Lookup IPv6 address\n"
-            "    -4                   Lookup IPv4 address\n",
+            _("%s [options] %s <host name ...>\n"
+              "%s [options] %s <address ... >\n\n"
+              "    -h --help            Show this help\n"
+              "    -V --version         Show version\n"
+              "    -n --name            Resolve host name\n"
+              "    -a --address         Resolve address\n"
+              "    -v --verbose         Enable verbose mode\n"
+              "    -6                   Lookup IPv6 address\n"
+              "    -4                   Lookup IPv4 address\n"),
             argv0, strstr(argv0, "host-name") ? "[-n]" : "-n",
             argv0, strstr(argv0, "address") ? "[-a]" : "-a");
 }
@@ -217,11 +218,11 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
 
     if (c->command == COMMAND_RESOLVE_ADDRESS || c->command == COMMAND_RESOLVE_HOST_NAME) {
         if (optind >= argc) {
-            fprintf(stderr, "Too few arguments\n");
+            fprintf(stderr, _("Too few arguments\n"));
             return -1;
         }
     }
-        
+
     return 0;
 }
 
@@ -230,6 +231,9 @@ int main(int argc, char *argv[]) {
     Config config;
     const char *argv0;
 
+    avahi_init_i18n();
+    setlocale(LC_ALL, "");
+
     if ((argv0 = strrchr(argv[0], '/')))
         argv0++;
     else
@@ -241,14 +245,14 @@ int main(int argc, char *argv[]) {
     switch (config.command) {
         case COMMAND_UNSPEC:
             ret = 1;
-            fprintf(stderr, "No command specified.\n");
+            fprintf(stderr, _("No command specified.\n"));
             break;
-            
+
         case COMMAND_HELP:
             help(stdout, argv0);
             ret = 0;
             break;
-            
+
         case COMMAND_VERSION:
             printf("%s "PACKAGE_VERSION"\n", argv0);
             ret = 0;
@@ -257,17 +261,17 @@ int main(int argc, char *argv[]) {
         case COMMAND_RESOLVE_HOST_NAME:
         case COMMAND_RESOLVE_ADDRESS: {
             int i;
-            
+
             if (!(simple_poll = avahi_simple_poll_new())) {
-                fprintf(stderr, "Failed to create simple poll object.\n");
+                fprintf(stderr, _("Failed to create simple poll object.\n"));
                 goto fail;
             }
-            
+
             if (sigint_install(simple_poll) < 0)
                 goto fail;
-            
+
             if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error))) {
-                fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
+                fprintf(stderr, _("Failed to create client object: %s\n"), avahi_strerror(error));
                 goto fail;
             }
 
@@ -275,61 +279,61 @@ int main(int argc, char *argv[]) {
                 const char *version, *hn;
 
                 if (!(version = avahi_client_get_version_string(client))) {
-                    fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query version string: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
 
                 if (!(hn = avahi_client_get_host_name_fqdn(client))) {
-                    fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query host name: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
-                
-                fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
+
+                fprintf(stderr, _("Server version: %s; Host name: %s\n"), version, hn);
             }
 
             n_resolving = 0;
-            
+
             for (i = optind; i < argc; i++) {
 
                 if (config.command == COMMAND_RESOLVE_HOST_NAME) {
 
                     if (!(avahi_host_name_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, argv[i], config.proto, 0, host_name_resolver_callback, NULL))) {
-                        fprintf(stderr, "Failed to create host name resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
+                        fprintf(stderr, _("Failed to create host name resolver: %s\n"), avahi_strerror(avahi_client_errno(client)));
                         goto fail;
                     }
-                        
+
                 } else {
                     AvahiAddress a;
-                    
+
                     assert(config.command == COMMAND_RESOLVE_ADDRESS);
 
                     if (!avahi_address_parse(argv[i], AVAHI_PROTO_UNSPEC, &a)) {
-                        fprintf(stderr, "Failed to parse address '%s'\n", argv[i]);
+                        fprintf(stderr, _("Failed to parse address '%s'\n"), argv[i]);
                         goto fail;
                     }
 
                     if (!(avahi_address_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, &a, 0, address_resolver_callback, NULL))) {
-                        fprintf(stderr, "Failed to create address resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
+                        fprintf(stderr, _("Failed to create address resolver: %s\n"), avahi_strerror(avahi_client_errno(client)));
                         goto fail;
                     }
                 }
 
                 n_resolving++;
             }
-            
+
             avahi_simple_poll_loop(simple_poll);
             ret = 0;
             break;
         }
     }
-    
+
 fail:
 
     if (client)
         avahi_client_free(client);
 
     sigint_uninstall();
-    
+
     if (simple_poll)
         avahi_simple_poll_free(simple_poll);
 
index d4566c6..737ca3b 100644 (file)
@@ -2,17 +2,17 @@
 
 /***
   This file is part of avahi.
+
   avahi is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
+
   avahi is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
   Public License for more details.
+
   You should have received a copy of the GNU Lesser General Public
   License along with avahi; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 #include <avahi-common/error.h>
 #include <avahi-common/malloc.h>
 #include <avahi-common/domain.h>
+#include <avahi-common/i18n.h>
 #include <avahi-client/client.h>
 
 #include "sigint.h"
 
 typedef enum {
-    COMMAND_UNSPEC, 
+    COMMAND_UNSPEC,
     COMMAND_HELP,
     COMMAND_VERSION
 } Command;
@@ -57,10 +58,10 @@ static AvahiClient *client = NULL;
 static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
     switch (state) {
         case AVAHI_CLIENT_FAILURE:
-            fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
+            fprintf(stderr, _("Client failure, exiting: %s\n"), avahi_strerror(avahi_client_errno(c)));
             avahi_simple_poll_quit(simple_poll);
             break;
-            
+
         case AVAHI_CLIENT_S_REGISTERING:
         case AVAHI_CLIENT_S_RUNNING:
         case AVAHI_CLIENT_S_COLLISION:
@@ -71,10 +72,10 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
 
 static void help(FILE *f, const char *argv0) {
     fprintf(f,
-            "%s [options] <new host name>\n\n"
-            "    -h --help            Show this help\n"
-            "    -V --version         Show version\n"
-            "    -v --verbose         Enable verbose mode\n",
+            _("%s [options] <new host name>\n\n"
+              "    -h --help            Show this help\n"
+              "    -V --version         Show version\n"
+              "    -v --verbose         Enable verbose mode\n"),
             argv0);
 }
 
@@ -112,11 +113,11 @@ static int parse_command_line(Config *c, int argc, char *argv[]) {
 
     if (c->command == COMMAND_UNSPEC) {
         if (optind != argc-1) {
-            fprintf(stderr, "Invalid number of arguments, expecting exactly one.\n");
+            fprintf(stderr, _("Invalid number of arguments, expecting exactly one.\n"));
             return -1;
         }
     }
-        
+
     return 0;
 }
 
@@ -125,6 +126,9 @@ int main(int argc, char *argv[]) {
     Config config;
     const char *argv0;
 
+    avahi_init_i18n();
+    setlocale(LC_ALL, "");
+
     if ((argv0 = strrchr(argv[0], '/')))
         argv0++;
     else
@@ -138,24 +142,24 @@ int main(int argc, char *argv[]) {
             help(stdout, argv0);
             ret = 0;
             break;
-            
+
         case COMMAND_VERSION:
             printf("%s "PACKAGE_VERSION"\n", argv0);
             ret = 0;
             break;
 
-        case COMMAND_UNSPEC: 
-            
+        case COMMAND_UNSPEC:
+
             if (!(simple_poll = avahi_simple_poll_new())) {
-                fprintf(stderr, "Failed to create simple poll object.\n");
+                fprintf(stderr, _("Failed to create simple poll object.\n"));
                 goto fail;
             }
-            
+
             if (sigint_install(simple_poll) < 0)
                 goto fail;
-            
+
             if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error))) {
-                fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
+                fprintf(stderr, _("Failed to create client object: %s\n"), avahi_strerror(error));
                 goto fail;
             }
 
@@ -163,45 +167,45 @@ int main(int argc, char *argv[]) {
                 const char *version, *hn;
 
                 if (!(version = avahi_client_get_version_string(client))) {
-                    fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query version string: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
 
                 if (!(hn = avahi_client_get_host_name_fqdn(client))) {
-                    fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query host name: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
-                
-                fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
+
+                fprintf(stderr, _("Server version: %s; Host name: %s\n"), version, hn);
             }
 
             if (avahi_client_set_host_name(client, argv[optind]) < 0) {
-                fprintf(stderr, "Failed to create host name resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
+                fprintf(stderr, _("Failed to create host name resolver: %s\n"), avahi_strerror(avahi_client_errno(client)));
                 goto fail;
             }
 
             if (config.verbose) {
                 const char *hn;
-                
+
                 if (!(hn = avahi_client_get_host_name_fqdn(client))) {
-                    fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
+                    fprintf(stderr, _("Failed to query host name: %s\n"), avahi_strerror(avahi_client_errno(client)));
                     goto fail;
                 }
-                
-                fprintf(stderr, "Host name successfully changed to %s\n", hn);
+
+                fprintf(stderr, _("Host name successfully changed to %s\n"), hn);
             }
-            
+
             ret = 0;
             break;
     }
-    
+
 fail:
 
     if (client)
         avahi_client_free(client);
 
     sigint_uninstall();
-    
+
     if (simple_poll)
         avahi_simple_poll_free(simple_poll);
 
index 960819b..7d8fdc8 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Avahi\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-12-17 13:17+0100\n"
-"PO-Revision-Date: 2007-12-17 13:26+0100\n"
+"POT-Creation-Date: 2007-12-17 15:52+0100\n"
+"PO-Revision-Date: 2007-12-17 16:11+0100\n"
 "Last-Translator: \n"
 "Language-Team: de\n"
 "MIME-Version: 1.0\n"
@@ -253,6 +253,10 @@ msgid "Browsing for service type %s in domain %s failed: %s"
 msgstr ""
 
 #: ../avahi-ui/avahi-ui.c:519
+#: ../avahi-utils/avahi-browse.c:157
+#: ../avahi-utils/avahi-browse.c:158
+#: ../avahi-utils/avahi-browse.c:164
+#: ../avahi-utils/avahi-browse.c:165
 msgid "n/a"
 msgstr "n/a"
 
@@ -263,7 +267,7 @@ msgstr ""
 
 #: ../avahi-ui/avahi-ui.c:684
 #, c-format
-msgid "Failed to read Avahi domain : %s"
+msgid "Failed to read Avahi domain: %s"
 msgstr ""
 
 #: ../avahi-ui/avahi-ui.c:717
@@ -316,38 +320,329 @@ msgstr "Initialisieren..."
 msgid "_Domain..."
 msgstr "_Domäne..."
 
-#: ../avahi-ui/bssh.c:49
+#: ../avahi-ui/bssh.c:50
 msgid "Choose Shell Server"
 msgstr "Shell-Dienst Auswählen"
 
-#: ../avahi-ui/bssh.c:51
+#: ../avahi-ui/bssh.c:52
 msgid "Desktop"
 msgstr "Arbeitsplatz"
 
-#: ../avahi-ui/bssh.c:52
+#: ../avahi-ui/bssh.c:53
 msgid "Terminal"
 msgstr "Terminal"
 
-#: ../avahi-ui/bssh.c:54
+#: ../avahi-ui/bssh.c:55
 msgid "Choose VNC server"
 msgstr "VNC-Dienst Auswählen"
 
-#: ../avahi-ui/bssh.c:57
+#: ../avahi-ui/bssh.c:58
 msgid "Choose SSH server"
 msgstr "SSH-Dienst Auswählen"
 
-#: ../avahi-ui/bssh.c:79
+#: ../avahi-ui/bssh.c:80
 #, c-format
 msgid "Connecting to '%s' ...\n"
 msgstr "Verbinde zu '%s' ...\n"
 
-#: ../avahi-ui/bssh.c:133
+#: ../avahi-ui/bssh.c:134
 #, c-format
 msgid "execlp() failed: %s\n"
 msgstr "execlp() fehlgeschlagen: %s\n"
 
-#: ../avahi-ui/bssh.c:143
+#: ../avahi-ui/bssh.c:144
 #, c-format
 msgid "Canceled.\n"
 msgstr "Abgebrochen.\n"
 
+#: ../avahi-utils/avahi-browse.c:108
+#, c-format
+msgid ": All for now\n"
+msgstr ": Alle Einträge für jetzt\n"
+
+#: ../avahi-utils/avahi-browse.c:119
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Datencache erschöpft\n"
+
+#: ../avahi-utils/avahi-browse.c:223
+#: ../avahi-utils/avahi-browse.c:245
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:324
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:362
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:398
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:428
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:503
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#: ../avahi-utils/avahi-publish.c:391
+#: ../avahi-utils/avahi-resolve.c:282
+#: ../avahi-utils/avahi-set-host-name.c:170
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:524
+#: ../avahi-utils/avahi-publish.c:396
+#: ../avahi-utils/avahi-resolve.c:287
+#: ../avahi-utils/avahi-set-host-name.c:175
+#: ../avahi-utils/avahi-set-host-name.c:191
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:528
+#: ../avahi-utils/avahi-publish.c:400
+#: ../avahi-utils/avahi-resolve.c:291
+#: ../avahi-utils/avahi-set-host-name.c:179
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Server-Version: %s; Rechnername: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:531
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:533
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:533
+msgid "Name"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:533
+msgid "Type"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:564
+#: ../avahi-utils/avahi-publish.c:165
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:578
+#: ../avahi-utils/avahi-browse.c:808
+#: ../avahi-utils/avahi-publish.c:172
+#: ../avahi-utils/avahi-publish.c:383
+#: ../avahi-utils/avahi-resolve.c:274
+#: ../avahi-utils/avahi-set-host-name.c:162
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:583
+#: ../avahi-utils/avahi-publish.c:177
+#: ../avahi-utils/avahi-resolve.c:145
+#: ../avahi-utils/avahi-set-host-name.c:61
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:602
+#: ../avahi-utils/avahi-publish.c:208
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:626
+msgid ""
+"    -h --help            Show this help\n"
+"    -V --version         Show version\n"
+"    -D --browse-domains  Browse for browsing domains instead of services\n"
+"    -a --all             Show all services, regardless of the type\n"
+"    -d --domain=DOMAIN   The domain to browse in\n"
+"    -v --verbose         Enable verbose mode\n"
+"    -t --terminate       Terminate after dumping a more or less complete list\n"
+"    -c --cache           Terminate after dumping all entries from the cache\n"
+"    -l --ignore-local    Ignore local services\n"
+"    -r --resolve         Resolve services found\n"
+"    -f --no-fail         Don't fail if the daemon is not available\n"
+"    -p --parsable        Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:639
+msgid ""
+"    -k --no-db-lookup    Don't lookup service types\n"
+"    -b --dump-db         Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:745
+#: ../avahi-utils/avahi-resolve.c:221
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Zu viele Argumente\n"
+
+#: ../avahi-utils/avahi-browse.c:754
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Zu viele Argumente\n"
+
+#: ../avahi-utils/avahi-browse.c:800
+#: ../avahi-utils/avahi-publish.c:375
+#: ../avahi-utils/avahi-resolve.c:266
+#: ../avahi-utils/avahi-set-host-name.c:154
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:78
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Eingerichtet unter dem Namen '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:83
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:96
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:116
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:126
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:136
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:142
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:193
+#, c-format
+msgid "Host name conflict\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:218
+#, c-format
+msgid ""
+"%s [options] %s <name> <type> <port> [<txt ...>]\n"
+"%s [options] %s <host-name> <address>\n"
+"\n"
+"    -h --help            Show this help\n"
+"    -V --version         Show version\n"
+"    -s --service         Publish service\n"
+"    -a --address         Publish address\n"
+"    -v --verbose         Enable verbose mode\n"
+"    -d --domain=DOMAIN   Domain to publish service in\n"
+"    -H --host=DOMAIN     Host where service resides\n"
+"       --subtype=SUBTYPE An additional subtype to register this service with\n"
+"    -f --no-fail         Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:300
+#: ../avahi-utils/avahi-publish.c:315
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Ungültige Anzahl von Argumenten\n"
+
+#: ../avahi-utils/avahi-publish.c:326
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:358
+#: ../avahi-utils/avahi-resolve.c:248
+#, c-format
+msgid "No command specified.\n"
+msgstr "Kein Befehl angegeben.\n"
+
+#: ../avahi-utils/avahi-resolve.c:91
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:128
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:159
+#, c-format
+msgid ""
+"%s [options] %s <host name ...>\n"
+"%s [options] %s <address ... >\n"
+"\n"
+"    -h --help            Show this help\n"
+"    -V --version         Show version\n"
+"    -n --name            Resolve host name\n"
+"    -a --address         Resolve address\n"
+"    -v --verbose         Enable verbose mode\n"
+"    -6                   Lookup IPv6 address\n"
+"    -4                   Lookup IPv4 address\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:301
+#: ../avahi-utils/avahi-set-host-name.c:183
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:311
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:316
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:75
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+"    -h --help            Show this help\n"
+"    -V --version         Show version\n"
+"    -v --verbose         Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:116
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ungültige Anzahl von Argumented, erwartet wird genau eines.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:195
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr ""
+