From d65a31ce300db68c303b9ff72c52b78dbf1ba598 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 28 Jun 2010 22:48:53 +0200 Subject: [PATCH] i18n: make avahi-discover translatable. Original patch from "fujiwara" http://avahi.org/ticket/122 --- avahi-python/avahi-discover/Makefile.am | 6 +++--- .../{avahi-discover.in => avahi-discover.py} | 17 ++++++++++++----- po/POTFILES.in | 1 + po/POTFILES.skip | 1 - 4 files changed, 16 insertions(+), 9 deletions(-) rename avahi-python/avahi-discover/{avahi-discover.in => avahi-discover.py} (94%) diff --git a/avahi-python/avahi-discover/Makefile.am b/avahi-python/avahi-discover/Makefile.am index 454fd57..d16bd11 100644 --- a/avahi-python/avahi-discover/Makefile.am +++ b/avahi-python/avahi-discover/Makefile.am @@ -19,7 +19,7 @@ AM_CFLAGS=-I$(top_srcdir) EXTRA_DIST = \ __init__.py \ - avahi-discover.in \ + avahi-discover.py \ avahi-discover.desktop.in.in if HAVE_PYTHON @@ -53,10 +53,10 @@ endif avahi-discover.desktop.in: avahi-discover.desktop.in.in $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@ -avahi-discover: avahi-discover.in +avahi-discover: avahi-discover.py $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ -e 's,@GETTEXT_PACKAGE\@,"$(GETTEXT_PACKAGE)",g' \ - -e 's,@LOCALEDIR\@,"$(datadir)/locale",g' \ + -e 's,@LOCALEDIR\@,"$(avahilocaledir)",g' \ -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@ && \ chmod +x $@ diff --git a/avahi-python/avahi-discover/avahi-discover.in b/avahi-python/avahi-discover/avahi-discover.py similarity index 94% rename from avahi-python/avahi-discover/avahi-discover.in rename to avahi-python/avahi-discover/avahi-discover.py index ac6b657..cea1ff9 100755 --- a/avahi-python/avahi-discover/avahi-discover.in +++ b/avahi-python/avahi-discover/avahi-discover.py @@ -21,6 +21,8 @@ import os, sys try: import avahi, gettext, gtk, gobject, dbus, avahi.ServiceTypeDatabase + gettext.bindtextdomain(@GETTEXT_PACKAGE@, @LOCALEDIR@) + gettext.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 @@ -71,7 +73,7 @@ class Main_window: if iter is not None: (name,interface,protocol,stype,domain) = self.treemodel.get(iter,1,2,3,4,5) if stype == None: - self.info_label.set_markup("No service currently selected.") + self.info_label.set_markup(_("No service currently selected.")) return #Asynchronous resolving self.server.ResolveService( int(interface), int(protocol), name, stype, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0), reply_handler=self.service_resolved, error_handler=self.print_error) @@ -219,11 +221,16 @@ class Main_window: txts = "" txtd = self.pair_to_dict(txt) for k,v in txtd.items(): - txts+="TXT %s = %s\n" % (k,v) + txts+="" + _("TXT") + " %s = %s\n" % (k,v) else: - txts = "TXT Data: empty" - - infos = "Service Type: %s\nService Name: %s\nDomain Name: %s\nInterface: %s %s\nAddress: %s/%s:%i\n%s" % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, txts.strip()) + txts = "" + _("TXT Data:") + " " + _("empty") + "" + + infos = "" + _("Service Type:") + " %s\n" + infos += "" + _("Service Name:") + " %s\n" + infos += "" + _("Domain Name:") + " %s\n" + infos += "" + _("Interface:") + " %s %s\n" + infos += "" + _("Address:") + " %s/%s:%i\n%s" + infos = infos % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, txts.strip()) self.info_label.set_markup(infos) def insert_row(self, model,parent, diff --git a/po/POTFILES.in b/po/POTFILES.in index 9e9a0cc..ea5f64d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,6 +2,7 @@ avahi-common/error.c [type: gettext/glade]avahi-discover-standalone/avahi-discover.ui avahi-python/avahi-discover/avahi-discover.desktop.in.in +avahi-python/avahi-discover/avahi-discover.py avahi-ui/avahi-ui.c avahi-ui/bssh.c avahi-ui/bssh.desktop.in.in diff --git a/po/POTFILES.skip b/po/POTFILES.skip index ce6337d..7ee0ef4 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -2,4 +2,3 @@ avahi-ui/bssh.desktop.in avahi-ui/bvnc.desktop.in tests/c-plus-plus-test-gen.py avahi-python/avahi-discover/avahi-discover.desktop.in -avahi-python/avahi-discover/avahi-discover.desktop.in -- 2.39.5