]> git.meshlink.io Git - catta/commitdiff
Add localization support to avahi-ui and avahi-discover
authorTakao Fujiwara <takao.fujiwara@sun.com>
Sun, 7 Sep 2008 05:54:20 +0000 (15:54 +1000)
committerLennart Poettering <lennart@poettering.net>
Fri, 12 Dec 2008 20:46:48 +0000 (21:46 +0100)
Closes #122

Signed-off-by: Ted Percival <ted@midg3t.net>
Signed-off-by: Lennart Poettering <lennart@poettering.net>
avahi-python/avahi-discover/Makefile.am
avahi-python/avahi-discover/avahi-discover.desktop.in [deleted file]
avahi-python/avahi-discover/avahi-discover.desktop.in.in [new file with mode: 0644]
avahi-python/avahi-discover/avahi-discover.in
avahi-ui/Makefile.am
avahi-ui/avahi-ui.c
avahi-ui/bssh.c
po/POTFILES.in

index c1d6cabc6dffd93a40f6ebb77da6ecc0d4b9e4ab..e9c558384685f3fd2ed14dcb2db3623515b82337 100644 (file)
@@ -23,7 +23,7 @@ EXTRA_DIST = \
        __init__.py \
        SimpleGladeApp.py \
        avahi-discover.in \
-       avahi-discover.desktop.in
+       avahi-discover.desktop.in.in
 
 if HAVE_PYTHON
 if HAVE_PYTHON_DBUS
@@ -41,6 +41,7 @@ if HAVE_GDBM
 pythonscripts += \
        avahi-discover
 desktop_DATA += avahi-discover.desktop
+@INTLTOOL_DESKTOP_RULE@
 avahi_discover_PYTHON += __init__.py SimpleGladeApp.py
 endif
 
@@ -48,14 +49,17 @@ if HAVE_DBM
 pythonscripts += \
        avahi-discover
 desktop_DATA += avahi-discover.desktop
+@INTLTOOL_DESKTOP_RULE@
 avahi_discover_PYTHON += __init__.py SimpleGladeApp.py
 endif
 
-avahi-discover.desktop: avahi-discover.desktop.in
+avahi-discover.desktop.in: avahi-discover.desktop.in.in
        sed -e 's,@bindir\@,$(bindir),g' $< > $@
 
 avahi-discover: avahi-discover.in
        sed -e 's,@PYTHON\@,$(PYTHON),g' \
+               -e 's,@GETTEXT_PACKAGE\@,"$(GETTEXT_PACKAGE)",g' \
+               -e 's,@LOCALEDIR\@,"$(datadir)/locale",g' \
                -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@
        chmod +x $@
 
diff --git a/avahi-python/avahi-discover/avahi-discover.desktop.in b/avahi-python/avahi-discover/avahi-discover.desktop.in
deleted file mode 100644 (file)
index e896192..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-Name=Avahi Zeroconf Browser
-Comment=Browse for Zeroconf services available on your network
-Exec=@bindir@/avahi-discover
-Terminal=false
-Type=Application
-Icon=network-wired
-Categories=GNOME;Application;System;
-StartupNotify=false
-GenericName=
diff --git a/avahi-python/avahi-discover/avahi-discover.desktop.in.in b/avahi-python/avahi-discover/avahi-discover.desktop.in.in
new file mode 100644 (file)
index 0000000..031024c
--- /dev/null
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+_Name=Avahi Zeroconf Browser
+_Comment=Browse for Zeroconf services available on your network
+Exec=@bindir@/avahi-discover
+Terminal=false
+Type=Application
+Icon=network-wired
+Categories=GNOME;Application;System;
+StartupNotify=false
+GenericName=
index be8c08bc8b97171fdae991318a29bf67a7d07ee4..055842476f006ccb7e2eee8da21731a02af6e27e 100755 (executable)
 import os, sys
 
 try:
-    import avahi, gtk, gobject, dbus, avahi.ServiceTypeDatabase
+    import avahi, gettext, gtk, gobject, dbus, avahi.ServiceTypeDatabase
     from avahi_discover.SimpleGladeApp import SimpleGladeApp
+    gtk.glade.bindtextdomain(@GETTEXT_PACKAGE@, @LOCALEDIR@)
+    gtk.glade.textdomain(@GETTEXT_PACKAGE@)
+    _ = gettext.gettext
 except ImportError, e:
     print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus.\n Error: %s" % e
     sys.exit(1)
index 910dc6b1c5738194baaccd46ba7bb1c1e9a01451..6dbbd24ae41e1bea20ee95691ea79166c2721d1e 100644 (file)
@@ -29,8 +29,8 @@ desktop_DATA_in_in = bssh.desktop.in.in bvnc.desktop.in.in
 
 EXTRA_DIST = $(desktop_DATA_in_in)
 
-
 if HAVE_GTK
+AM_CFLAGS += -DGNOMELOCALEDIR=\"$(datadir)/locale\"
 if HAVE_DBUS
 if HAVE_GLIB
 
@@ -61,6 +61,7 @@ endif
 
 bin_PROGRAMS = bssh
 desktop_DATA += bssh.desktop bvnc.desktop
+@INTLTOOL_DESKTOP_RULE@
 
 bssh_SOURCES = bssh.c
 bssh_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
index a54cbe9ba2d8f52c74a46d252d3de1e1fc056c1c..bd2b3cc1a9fe460049dc77dbf4a0b8f550803e5c 100644 (file)
@@ -30,6 +30,7 @@
 #include <net/if.h>
 
 #include <gtk/gtk.h>
+#include <glib/gi18n.h>
 
 #include <avahi-glib/glib-watch.h>
 #include <avahi-client/client.h>
@@ -184,64 +185,64 @@ static void aui_service_dialog_class_init(AuiServiceDialogClass *klass) {
     g_object_class_install_property(
             object_class,
             PROP_BROWSE_SERVICE_TYPES,
-            g_param_spec_pointer("browse_service_types", "Browse Service Types", "A NULL terminated list of service types to browse for",
+            g_param_spec_pointer("browse_service_types", _("Browse Service Types"), _("A NULL terminated list of service types to browse for"),
                                 G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_DOMAIN,
-            g_param_spec_string("domain", "Domain", "The domain to browse in, or NULL for the default domain",
+            g_param_spec_string("domain", _("Domain"), _("The domain to browse in, or NULL for the default domain"),
                                 NULL,
                                 G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_SERVICE_TYPE,
-            g_param_spec_string("service_type", "Service Type", "The service type of the selected service",
+            g_param_spec_string("service_type", _("Service Type"), _("The service type of the selected service"),
                                 NULL,
                                 G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_SERVICE_NAME,
-            g_param_spec_string("service_name", "Service Name", "The service name of the selected service",
+            g_param_spec_string("service_name", _("Service Name"), _("The service name of the selected service"),
                                 NULL,
                                 G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_ADDRESS,
-            g_param_spec_pointer("address", "Address", "The address of the resolved service",
+            g_param_spec_pointer("address", _("Address"), _("The address of the resolved service"),
                                 G_PARAM_READABLE));
     g_object_class_install_property(
             object_class,
             PROP_PORT,
-            g_param_spec_uint("port", "Port", "The IP port number of the resolved service",
+            g_param_spec_uint("port", _("Port"), _("The IP port number of the resolved service"),
                              0, 0xFFFF, 0,
                              G_PARAM_READABLE));
     g_object_class_install_property(
             object_class,
             PROP_HOST_NAME,
-            g_param_spec_string("host_name", "Host Name", "The host name of the resolved service",
+            g_param_spec_string("host_name", _("Host Name"), _("The host name of the resolved service"),
                                 NULL,
                                 G_PARAM_READABLE));
     g_object_class_install_property(
             object_class,
             PROP_TXT_DATA,
-            g_param_spec_pointer("txt_data", "TXT Data", "The TXT data of the resolved service",
+            g_param_spec_pointer("txt_data", _("TXT Data"), _("The TXT data of the resolved service"),
                                 G_PARAM_READABLE));
     g_object_class_install_property(
             object_class,
             PROP_RESOLVE_SERVICE,
-            g_param_spec_boolean("resolve_service", "Resolve service", "Resolve service",
+            g_param_spec_boolean("resolve_service", _("Resolve service"), _("Resolve service"),
                                  TRUE,
                                  G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_RESOLVE_HOST_NAME,
-            g_param_spec_boolean("resolve_host_name", "Resolve service host name", "Resolve service host name",
+            g_param_spec_boolean("resolve_host_name", _("Resolve service host name"), _("Resolve service host name"),
                                  TRUE,
                                  G_PARAM_READABLE | G_PARAM_WRITABLE));
     g_object_class_install_property(
             object_class,
             PROP_ADDRESS_FAMILY,
-            g_param_spec_int("address_family", "Address family", "The address family for host name resolution",
+            g_param_spec_int("address_family", _("Address family"), _("The address family for host name resolution"),
                              AVAHI_PROTO_UNSPEC, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC,
                              G_PARAM_READABLE | G_PARAM_WRITABLE));
 }
@@ -703,7 +704,7 @@ static gboolean start_callback(gpointer data) {
     d->priv->start_idle = 0;
 
     if (!d->priv->browse_service_types || !*d->priv->browse_service_types) {
-        g_warning("Browse service type list is empty!");
+        g_warning(_("Browse service type list is empty!"));
         return FALSE;
     }
 
@@ -1026,7 +1027,7 @@ static void domain_button_clicked(GtkButton *button G_GNUC_UNUSED, gpointer user
     gtk_container_add(GTK_CONTAINER(scrolled_window), p->domain_tree_view);
 
     p->domain_progress_bar = gtk_progress_bar_new();
-    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(p->domain_progress_bar), _("Browsing ..."));
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(p->domain_progress_bar), _("Browsing..."));
     gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(p->domain_progress_bar), 0.1);
     gtk_box_pack_end(GTK_BOX(vbox2), p->domain_progress_bar, FALSE, FALSE, 0);
 
@@ -1139,17 +1140,17 @@ static void aui_service_dialog_init(AuiServiceDialog *d) {
     g_signal_connect(selection, "changed", G_CALLBACK(service_selection_changed_callback), d);
 
     renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes("Location", renderer, "text", SERVICE_COLUMN_PRETTY_IFACE, NULL);
+    column = gtk_tree_view_column_new_with_attributes(_("Location"), renderer, "text", SERVICE_COLUMN_PRETTY_IFACE, NULL);
     gtk_tree_view_column_set_visible(column, FALSE);
     gtk_tree_view_append_column(GTK_TREE_VIEW(p->service_tree_view), column);
 
     renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", SERVICE_COLUMN_NAME, NULL);
+    column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, "text", SERVICE_COLUMN_NAME, NULL);
     gtk_tree_view_column_set_expand(column, TRUE);
     gtk_tree_view_append_column(GTK_TREE_VIEW(p->service_tree_view), column);
 
     renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes("Type", renderer, "text", SERVICE_COLUMN_PRETTY_TYPE, NULL);
+    column = gtk_tree_view_column_new_with_attributes(_("Type"), renderer, "text", SERVICE_COLUMN_PRETTY_TYPE, NULL);
     gtk_tree_view_column_set_visible(column, FALSE);
     gtk_tree_view_append_column(GTK_TREE_VIEW(p->service_tree_view), column);
 
@@ -1157,7 +1158,7 @@ static void aui_service_dialog_init(AuiServiceDialog *d) {
     gtk_container_add(GTK_CONTAINER(scrolled_window), p->service_tree_view);
 
     p->service_progress_bar = gtk_progress_bar_new();
-    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(p->service_progress_bar), _("Browsing ..."));
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(p->service_progress_bar), _("Browsing..."));
     gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(p->service_progress_bar), 0.1);
     gtk_box_pack_end(GTK_BOX(vbox2), p->service_progress_bar, FALSE, FALSE, 0);
 
index fea1071e95dc60f02c42837339f594b7502c5111..e4a190ba7b02bacdf6978f5727e083e27b447b5e 100644 (file)
@@ -31,6 +31,7 @@
 #include <getopt.h>
 
 #include <gtk/gtk.h>
+#include <glib/gi18n.h>
 
 #include <avahi-client/client.h>
 #include <avahi-common/strlst.h>
@@ -135,6 +136,10 @@ int main(int argc, char*argv[]) {
         return 1;
     }
 
+    bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+    textdomain (GETTEXT_PACKAGE);
+
     gtk_init(&argc, &argv);
 
     switch (config.command) {
index 80b5a298e97d354472bf4acaff4ff28c67998c99..f3e48ded501971814f83d909d887ea8a859ea22e 100644 (file)
@@ -1,5 +1,7 @@
 # List of source files which contain translatable strings.
 avahi-common/error.c
+avahi-discover-standalone/avahi-discover.glade
+avahi-python/avahi-discover/avahi-discover.desktop.in.in
 avahi-ui/avahi-ui.c
 avahi-ui/bssh.c
 avahi-ui/bssh.desktop.in.in
@@ -8,4 +10,3 @@ avahi-utils/avahi-browse.c
 avahi-utils/avahi-publish.c
 avahi-utils/avahi-resolve.c
 avahi-utils/avahi-set-host-name.c
-