diff --git a/plugins/BlocklistImport/__init__.py b/plugins/BlocklistImport/__init__.py index c3793296c..bd5b290c6 100644 --- a/plugins/BlocklistImport/__init__.py +++ b/plugins/BlocklistImport/__init__.py @@ -3,10 +3,10 @@ # Distributed under the same terms as Deluge ## -plugin_name = "Blocklist Importer" +plugin_name = _("Blocklist Importer") plugin_author = "Steve 'Tarka' Smith" plugin_version = "0.4" -plugin_description = """ +plugin_description = _(""" Download and import various IP blocklists. Currently this plugin can handle PeerGuardian (binary and text), @@ -18,7 +18,7 @@ A page with pointer to blocklist download sites is available on the wiki: http://dev.deluge-torrent.org/wiki/BlocklistPlugin -""" +""") def deluge_init(deluge_path): global path @@ -37,10 +37,10 @@ from ui import GTKConfig, GTKProgress # List of formats supported. This is used to generate the UI list and # specify the reader class. The last entry is for storage by the UI. -readers = {'p2bgz':["PeerGuardian P2B (GZip)", PGReader, None], - 'pgtext':["PeerGuardian Text (Uncompressed)", TextReader, None], - 'gzmule':["Emule IP list (GZip)", GZMuleReader, None], - 'spzip':["SafePeer Text (Zipped)", PGZip, None]} +readers = {'p2bgz':[_("PeerGuardian P2B (GZip)"), PGReader, None], + 'pgtext':[_("PeerGuardian Text (Uncompressed)"), TextReader, None], + 'gzmule':[_("Emule IP list (GZip)"), GZMuleReader, None], + 'spzip':[_("SafePeer Text (Zipped)"), PGZip, None]} class BlocklistImport: @@ -87,7 +87,7 @@ class BlocklistImport: filename=self.blockfile, reporthook=self._download_update) except IOError, (errno, strerr): - err = ui.GTKError("Couldn't download URL: %s"%strerr) + err = ui.GTKError(_("Couldn't download URL") + ": %s"%strerr) self.gtkprog.stop() return @@ -100,7 +100,7 @@ class BlocklistImport: try: reader = readers[ltype][1](self.blockfile) except IOError, (errno, strerr): - err = ui.GTKError("Couldn't open blocklist file: %s"%strerr) + err = ui.GTKError(_("Couldn't open blocklist file") + ": %s"%strerr) self.gtkprog.stop() return @@ -118,7 +118,7 @@ class BlocklistImport: self.gtkprog.import_prog() except FormatException, (ex): - err = ui.GTKError("Format error in blocklist: %s"%ex) + err = ui.GTKError(_("Format error in blocklist") + ": %s"%ex) self.gtkprog.stop() reader.close() return @@ -154,4 +154,3 @@ class BlocklistImport: def update(self): msg = "[Blocklist: %s entries]" % self.nimported self.interface.statusbar_temp_msg += ' ' + msg - diff --git a/plugins/BlocklistImport/peerguardian.py b/plugins/BlocklistImport/peerguardian.py index 8fea503f0..8f7c887dd 100644 --- a/plugins/BlocklistImport/peerguardian.py +++ b/plugins/BlocklistImport/peerguardian.py @@ -25,16 +25,16 @@ class PGReader: hdr = unpack("l", buf)[0] if hdr != -1: print "LEADER IS",hdr - raise PGException("Invalid leader %d"%hdr) + raise PGException(_("Invalid leader") + " %d"%hdr) magic = self.fd.read(3) if magic != "P2B": - raise PGException("Invalid magic code") + raise PGException(_("Invalid magic code")) buf = self.fd.read(1) ver = ord(buf) if ver != 1 and ver != 2: - raise PGException("Invalid version %d" % ver) + raise PGException(_("Invalid version") + " %d" % ver) def next(self): @@ -57,4 +57,3 @@ class PGReader: def close(self): self.fd.close() - diff --git a/plugins/BlocklistImport/text.py b/plugins/BlocklistImport/text.py index 90cd38c9e..10c9c685f 100644 --- a/plugins/BlocklistImport/text.py +++ b/plugins/BlocklistImport/text.py @@ -34,7 +34,7 @@ class TextBase: match = self.re.search(txt) if not match: - raise FormatException("Couldn't match on line %d: %s (%s)"%(self.count,txt,txt)) + raise FormatException(_("Couldn't match on line") + " %d: %s (%s)"%(self.count,txt,txt)) g = match.groups() start = ".".join(g[0:4]) @@ -123,4 +123,3 @@ class PGZip(TextBase): def close(self): self.zfd.close() - diff --git a/plugins/BlocklistImport/ui.py b/plugins/BlocklistImport/ui.py index 2a4782c53..6998d08d8 100644 --- a/plugins/BlocklistImport/ui.py +++ b/plugins/BlocklistImport/ui.py @@ -21,7 +21,7 @@ class GTKConfig(gtk.Dialog): # List source label = gtk.Label() - label.set_markup('Blocklist URL') + label.set_markup('' + _("Blocklist URL") + '') self.url = gtk.Entry() ls = gtk.ListStore(gobject.TYPE_STRING, # Long name @@ -46,7 +46,7 @@ class GTKConfig(gtk.Dialog): self.vbox.pack_start(hbox) # Load on start - self.load_on_start = gtk.CheckButton("Download on start") + self.load_on_start = gtk.CheckButton(_("Download on start")) self.vbox.pack_start(self.load_on_start) self.connect('response', self.ok) @@ -100,7 +100,7 @@ class GTKProgress(gtk.Dialog): self.vbox.set_spacing(6) label = gtk.Label() - label.set_markup('Loading and installing blocklist') + label.set_markup('' + _("Loading and installing blocklist") + '') self.vbox.pack_start(label) self.progress = gtk.ProgressBar() @@ -112,7 +112,7 @@ class GTKProgress(gtk.Dialog): self.hide_all() def start_download(self): - self.progress.set_text("Downloading") + self.progress.set_text(_("Downloading")) self.progress.set_fraction(0.0) self.update() @@ -123,7 +123,7 @@ class GTKProgress(gtk.Dialog): self.update() def start_import(self): - self.progress.set_text("Importing") + self.progress.set_text(_("Importing")) self.progress.set_fraction(0.0) self.progress.set_pulse_step(0.0075) self.update() @@ -134,7 +134,7 @@ class GTKProgress(gtk.Dialog): self.update() def end_import(self): - self.progress.set_text("Complete") + self.progress.set_text(_("Complete")) self.progress.set_fraction(1.0) self.update()