packages bittorrent-4.4.0-formatstrings.patch
      Pages: < 1 >  DOWNLOAD      
xgettext wants named parameters in format strings so that they can be
re-ordered in translations. This will break the existing translations but
they don't actually work since Fedora 6 and python 2.4 anyway
(http://bugzilla.redhat.com/237254)

--- BitTorrent-4.4.0/bittorrent.py	2006-01-31 20:16:42.000000000 +0000
+++ BitTorrent-4.4.0/bittorrent.py	2009-02-25 10:28:11.000000000 +0000
@@ -527,7 +527,7 @@
         self.label = gtk.Label()
         self.label.set_markup(
             (_("A newer version of %s is available.\n") % app_name) +
-            (_("You are using %s, and the new version is %s.\n") % (version, newversion)) +
+            (_("You are using %(version)s, and the new version is %(newversion)s.\n") % dict(version = version, newversion = newversion)) +
             (_("You can always get the latest version from \n%s") % self.download_url)
             ) 
         self.label.set_selectable(True)
@@ -2198,18 +2198,18 @@
             self.share_ratio = FancyLabel(_("Share ratio: %0.02f%%"), 0)
             self.extrabox.pack_start(lalign(self.share_ratio))
 
-            self.peer_info = FancyLabel(_("%s peers, %s seeds. Totals from "
-                                          "tracker: %s"), 0, 0, 'NA')
+            self.peer_info = FancyLabel(_("%(peers)s peers, %(seeds)s seeds. Totals from "
+                                          "tracker: %(totals)s"), dict(peers = 0, seeds = 0, totals = 'NA'))
             self.extrabox.pack_start(lalign(self.peer_info))
 
-            self.dist_copies = FancyLabel(_("Distributed copies: %d; Next: %s"), 0, '')
+            self.dist_copies = FancyLabel(_("Distributed copies: %(copies)d; Next: %(next)s"), dict(copies = 0, next = ''))
             self.extrabox.pack_start(lalign(self.dist_copies))
 
-            self.piece_info = FancyLabel(_("Pieces: %d total, %d complete, "
-                                           "%d partial, %d active (%d empty)"), *(0,)*5)
+            self.piece_info = FancyLabel(_("Pieces: %(a)d total, %(b)d complete, "
+                                           "%(c)d partial, %(d)d active (%(e)d empty)"), dict(a = 0, b = 0, c = 0, d = 0, e = 0))
             self.extrabox.pack_start(lalign(self.piece_info))
 
-            self.bad_info = FancyLabel(_("%d bad pieces + %s in discarded requests"), 0, 0)
+            self.bad_info = FancyLabel(_("%(bad)d bad pieces + %(discard)s in discarded requests"), dict(bad = 0, discard = 0))
             self.extrabox.pack_start(lalign(self.bad_info))
 
             # extra info
@@ -2266,7 +2266,7 @@
     rate_label = ': %s'
     eta_label = '?'
     done_label = _("Done")
-    progress_bar_label = _("%.1f%% done, %s remaining")
+    progress_bar_label = _("%(pcdone).1f%% done, %(pcrem)s remaining")
     down_rate_label = _("Download rate")
     up_rate_label = _("Upload rate"  )
     
@@ -2306,7 +2306,7 @@
         else:
             self.progressbar.set_fraction(fractionDone)
             progress_bar_label = self.progress_bar_label % \
-                                 (int(fractionDone*1000)/10, eta_label) 
+                                 dict(pcdone = int(fractionDone*1000)/10, pcrem = eta_label) 
             self.progressbar.set_text(progress_bar_label)
             
 
@@ -3162,8 +3162,8 @@
     def confirm_install_new_version(self):
         MessageDialog(self.mainwindow,
                       _("Install new %s now?")%app_name,
-                      _("Do you want to quit %s and install the new version, "
-                        "%s, now?")%(app_name,self.updater.version),
+                      _("Do you want to quit %(app)s and install the new version, "
+                        "%(vers)s, now?")%dict(app = app_name, vers = self.updater.version),
                       type=gtk.MESSAGE_QUESTION,
                       buttons=gtk.BUTTONS_YES_NO,
                       yesfunc=self.install_new_version,
@@ -3178,8 +3178,8 @@
 
     def open_help(self,widget):
         if self.helpwindow is None:
-            msg = (_("%s help is at \n%s\nWould you like to go there now?")%
-                  (app_name, HELP_URL))
+            msg = (_("%(app)s help is at \n%(url)s\nWould you like to go there now?")%
+                  dict(app = app_name, url = HELP_URL))
             self.helpwindow = MessageDialog(self.mainwindow,
                                             _("Visit help web page?"),
                                             msg,
--- BitTorrent-4.4.0/maketorrent.py	2006-01-31 20:16:52.000000000 +0000
+++ BitTorrent-4.4.0/maketorrent.py	2009-02-25 10:42:28.000000000 +0000
@@ -57,7 +57,7 @@
         self.mainwindow = self # temp hack to make modal win32 file choosers work
         self.tooltips = gtk.Tooltips()
         self.connect('destroy', self.quit)
-        self.set_title(_("%s torrent file creator %s")%(app_name, version))
+        self.set_title(_("%(app)s torrent file creator %(ver)s")%dict(app = app_name, ver = version))
         self.set_border_width(SPACING)
 
         self.config = config
--- BitTorrent-4.4.0/BitTorrent/GUI.py	2009-02-25 10:40:14.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/GUI.py	2009-02-25 10:46:49.000000000 +0000
@@ -203,9 +203,9 @@
         elif self >= 86400:
             return _("1 day %d hours") % ((self-86400)//3600) # 1-2 days
         elif self >= 3600:
-            return _("%d:%02d hours") % (self//3600, (self%3600)//60) # 1 h - 1 day
+            return _("%(hour)d:%(min)02d hours") % dict(hour = self//3600, min = (self%3600)//60) # 1 h - 1 day
         elif self >= 60:
-            return _("%d:%02d minutes") % (self//60, self%60) # 1 minute to 1 hour
+            return _("%(min)d:%(sec)02d minutes") % dict(min = self//60, sec = self%60) # 1 minute to 1 hour
         elif self >= 0:
             return _("%d seconds") % int(self)
         else:
--- BitTorrent-4.4.0/BitTorrent/TorrentQueue.py	2006-01-31 20:16:32.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/TorrentQueue.py	2009-02-25 10:49:00.000000000 +0000
@@ -672,11 +672,11 @@
                'max_running_torrents'] or self.config['def_running_torrents']):
                 if force_running:
                     self.global_error(ERROR,
-                                      _("Can't run more than %d torrents " 
+                                      _("Can't run more than %(maxt)d torrents " 
                                         "simultaneously. For more info see the"
-                                        " FAQ at %s.")%
-                                      (self.config['max_running_torrents'],
-                                       FAQ_URL))
+                                        " FAQ at %(url)s.")%
+                                      dict(maxt = self.config['max_running_torrents'],
+                                       url = FAQ_URL))
                 newstate = QUEUED
                 pos = 0
         l = self._get_list(newstate)
--- BitTorrent-4.4.0/BitTorrent/NewVersion.py	2009-02-25 10:40:14.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/NewVersion.py	2009-02-25 10:52:16.000000000 +0000
@@ -242,7 +242,7 @@
         else:
             self.errorfunc(WARNING,
                            _("Could not find a suitable temporary location to "
-                             "save the %s %s installer.") % (app_name, self.version))
+                             "save the %(app)s %(ver)s installer.") % dict(app = app_name, ver = self.version))
 
     def installer_downloaded(self):
         if self.installer_path() and os.access(self.installer_path(), os.F_OK):
@@ -260,8 +260,8 @@
         if self.torrentfile is not None:
             self.startfunc(self.torrentfile, self.installer_path())
         else:
-            self.errorfunc(WARNING, _("No torrent file available for %s %s "
-                                      "installer.")%(app_name, self.version))
+            self.errorfunc(WARNING, _("No torrent file available for %(app)s %(ver)s "
+                                      "installer.")%dict(app = app_name, ver = self.version))
 
     def start_install(self):
         if not self.asked_for_install:
@@ -270,9 +270,9 @@
                 self.installfunc()
             else:
                 self.errorfunc(WARNING,
-                               _("%s %s installer appears to be incomplete, "
-                                 "missing, or corrupt.")%(app_name,
-                                                          self.version))
+                               _("%(app)s %(ver)s installer appears to be incomplete, "
+                                 "missing, or corrupt.")%dict(app = app_name,
+                                                          ver = self.version))
 
     def launch_installer(self, torrentqueue):
         if os.name == 'nt':
--- BitTorrent-4.4.0/bittorrent-console.py	2006-01-31 20:16:36.000000000 +0000
+++ BitTorrent-4.4.0/bittorrent-console.py	2009-02-25 11:06:26.000000000 +0000
@@ -46,7 +46,7 @@
         return _("<unknown>")
     m, s = divmod(n, 60)
     h, m = divmod(m, 60)
-    return _("finishing in %d:%02d:%02d") % (h, m, s)
+    return _("finishing in %(h)d:%(m)02d:%(s)02d") % dict(h = h, m = m, s = s)
 
 def fmtsize(n):
     s = str(n)
@@ -127,22 +127,22 @@
         if downTotal is not None:
             upTotal = statistics['upTotal']
             if downTotal <= upTotal / 100:
-                self.shareRating = _("oo  (%.1f MB up / %.1f MB down)") % (
-                    upTotal / (1<<20), downTotal / (1<<20))
+                self.shareRating = _("oo  (%(up).1f MB up / %(down).1f MB down)") % dict(
+                    up = upTotal / (1<<20), down = downTotal / (1<<20))
             else:
-                self.shareRating = _("%.3f  (%.1f MB up / %.1f MB down)") % (
-                   upTotal / downTotal, upTotal / (1<<20), downTotal / (1<<20))
+                self.shareRating = _("%(ratio).3f  (%(up).1f MB up / %(down).1f MB down)") % dict(
+                   ratio = upTotal / downTotal, up = upTotal / (1<<20), down = downTotal / (1<<20))
             numCopies = statistics['numCopies']
             nextCopies = ', '.join(["%d:%.1f%%" % (a,int(b*1000)/10) for a,b in
                     zip(xrange(numCopies+1, 1000), statistics['numCopyList'])])
             if not self.done:
-                self.seedStatus = _("%d seen now, plus %d distributed copies "
-                                    "(%s)") % (statistics['numSeeds' ],
-                                               statistics['numCopies'],
-                                               nextCopies)
+                self.seedStatus = _("%(s)d seen now, plus %(d)d distributed copies "
+                                    "(%(n)s)") % dict(s = statistics['numSeeds' ],
+                                               d = statistics['numCopies'],
+                                               n = nextCopies)
             else:
-                self.seedStatus = _("%d distributed copies (next: %s)") % (
-                    statistics['numCopies'], nextCopies)
+                self.seedStatus = _("%(d)d distributed copies (next: %(n)s)") % dict(
+                    d = statistics['numCopies'], n = nextCopies)
             self.peerStatus = _("%d seen now") % statistics['numPeers']
 
         for err in self.errors[-4:]:
--- BitTorrent-4.4.0/bittorrent-curses.py	2006-01-31 20:16:36.000000000 +0000
+++ BitTorrent-4.4.0/bittorrent-curses.py	2009-02-25 11:13:24.000000000 +0000
@@ -65,7 +65,7 @@
         return _("<unknown>")
     m, s = divmod(n, 60)
     h, m = divmod(m, 60)
-    return _("finishing in %d:%02d:%02d") % (h, m, s)
+    return _("finishing in %(h)d:%(m)02d:%(s)02d") % dict(h = h, m = m, s = s)
 
 def fmtsize(n):
     s = str(n)
@@ -228,22 +228,22 @@
         if downTotal is not None:
             upTotal = statistics['upTotal']
             if downTotal <= upTotal / 100:
-                self.shareRating = _("oo  (%.1f MB up / %.1f MB down)") % (
-                    upTotal / (1<<20), downTotal / (1<<20))
+                self.shareRating = _("oo  (%(up).1f MB up / %(down).1f MB down)") % dict(
+                    up = upTotal / (1<<20), down = downTotal / (1<<20))
             else:
-                self.shareRating = _("%.3f  (%.1f MB up / %.1f MB down)") % (
-                   upTotal / downTotal, upTotal / (1<<20), downTotal / (1<<20))
+                self.shareRating = _("%(ratio).3f  (%(up).1f MB up / %(down).1f MB down)") % dict(
+                   ratio = upTotal / downTotal, up = upTotal / (1<<20), down = downTotal / (1<<20))
             numCopies = statistics['numCopies']
             nextCopies = ', '.join(["%d:%.1f%%" % (a,int(b*1000)/10) for a,b in
                     zip(xrange(numCopies+1, 1000), statistics['numCopyList'])])
             if not self.done:
-                self.seedStatus = _("%d seen now, plus %d distributed copies"
-                                    "(%s)") % (statistics['numSeeds' ],
-                                               statistics['numCopies'],
-                                               nextCopies)
+                self.seedStatus = _("%(s)d seen now, plus %(d)d distributed copies"
+                                    "(%(n)s)") % dict(s = statistics['numSeeds' ],
+                                               d = statistics['numCopies'],
+                                               n = nextCopies)
             else:
-                self.seedStatus = _("%d distributed copies (next: %s)") % (
-                    statistics['numCopies'], nextCopies)
+                self.seedStatus = _("%(d)d distributed copies (next: %(n)s)") % dict(
+                    d = statistics['numCopies'], n = nextCopies)
             self.peerStatus = _("%d seen now") % statistics['numPeers']
 
         self.fieldwin.erase()
@@ -321,10 +321,10 @@
                     self.spewwin.addnstr(i+3, 64, '%5.0f KB/s' % (spew[i]['speed']/1000), 10)
 
             self.spewwin.addnstr(self.spewh-1, 0,
-                    _("downloading %d pieces, have %d fragments, "
-                      "%d of %d pieces completed") %
-                    (statistics['storage_active'], statistics['storage_dirty'],
-                     statistics['storage_numcomplete'], self.numpieces),
+                    _("downloading %(p)d pieces, have %(f)d fragments, "
+                      "%(c)d of %(n)d pieces completed") %
+                    dict(p = statistics['storage_active'], f = statistics['storage_dirty'],
+                     c = statistics['storage_numcomplete'], n = self.numpieces),
                     self.speww-1)
 
         curses.panel.update_panels()
--- BitTorrent-4.4.0/changetracker-console.py	2006-01-31 20:16:42.000000000 +0000
+++ BitTorrent-4.4.0/changetracker-console.py	2009-02-25 13:27:33.000000000 +0000
@@ -29,7 +29,7 @@
     metainfo = bdecode(h.read())
     h.close()
     if metainfo['announce'] != argv[1]:
-        print _("old announce for %s: %s") % (f, metainfo['announce'])
+        print _("old announce for %(f)s: %(a)s") % dict(f = f, a = metainfo['announce'])
         metainfo['announce'] = argv[1]
         h = open(f, 'wb')
         h.write(bencode(metainfo))
--- BitTorrent-4.4.0/launchmany-curses.py	2006-01-31 20:16:51.000000000 +0000
+++ BitTorrent-4.4.0/launchmany-curses.py	2009-02-25 13:31:36.000000000 +0000
@@ -57,7 +57,7 @@
     h, m = divmod(m, 60)
     if h > 1000000:
         return _("connecting to peers")
-    return _("ETA in %d:%02d:%02d") % (h, m, s)
+    return _("ETA in %(h)d:%(m)02d:%(s)02d") % dict(h = h, m = m, s = s)
 
 def fmtsize(n):
     n = long(n)
@@ -211,9 +211,9 @@
             line = "%3d %s%s%s%s" % (ii+1, name, size, dnrate, uprate)
             self._display_line(line, True)
             if peers + seeds:
-                datastr = _("    (%s) %s - %s peers %s seeds %s dist copies - %s dn %s up") % (
-                    progress, status, peers, seeds, dist,
-                    fmtsize(dnamt), fmtsize(upamt) )
+                datastr = _("    (%(progress)s) %(status)s - %(peers)s peers %(seeds)s seeds %(dist)s dist copies - %(down)s dn %(up)s up") % dict(
+                    progress = progress, status = status, peers = peers, seeds = seeds, dist = dist,
+                    down = fmtsize(dnamt), up = fmtsize(upamt) )
             else:
                 datastr = '    '+status+' ('+progress+')'
             self._display_line(datastr)
--- BitTorrent-4.4.0/torrentinfo-console.py	2006-01-31 20:17:46.000000000 +0000
+++ BitTorrent-4.4.0/torrentinfo-console.py	2009-02-25 13:33:29.000000000 +0000
@@ -23,7 +23,7 @@
 
 NAME, EXT = splitext(basename(argv[0]))
 
-print _("%s %s - decode %s metainfo files") % (NAME, version, app_name)
+print _("%(n)s %(v)s - decode %(a)s metainfo files") % dict(n = NAME, v = version, a = app_name)
 print 
 
 if len(argv) == 1:
--- BitTorrent-4.4.0/BitTorrent/makemetafile.py	2009-02-25 10:40:14.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/makemetafile.py	2009-02-25 13:36:16.000000000 +0000
@@ -180,10 +180,10 @@
         try:
             u = name.decode(encoding)
         except Exception, e:
-            raise BTFailure(_('Could not convert file/directory name "%s" to '
-                              'utf-8 (%s). Either the assumed filesystem '
-                              'encoding "%s" is wrong or the filename contains '
-                              'illegal bytes.') % (name, str(e), encoding))
+            raise BTFailure(_('Could not convert file/directory name "%(n)s" to '
+                              'utf-8 (%(e)s). Either the assumed filesystem '
+                              'encoding "%(f)s" is wrong or the filename contains '
+                              'illegal bytes.') % dict(n = name, e = str(e), f = encoding))
         if u.translate(noncharacter_translate) != u:
             raise BTFailure(_('File/directory name "%s" contains reserved '
                               'unicode values that do not correspond to '
--- BitTorrent-4.4.0/BitTorrent/parsedir.py	2006-01-31 20:16:35.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/parsedir.py	2009-02-25 13:38:30.000000000 +0000
@@ -81,8 +81,8 @@
         v = new_file[0]
         if new_file[1] in new_parsed:  # duplicate
             if p not in blocked or files[p][0] != v:
-                errfunc(_("**warning** %s is a duplicate torrent for %s") %
-                        (p, new_parsed[new_file[1]]['path']))
+                errfunc(_("**warning** %(a)s is a duplicate torrent for %(b)s") %
+                        dict(a = p, b = new_parsed[new_file[1]]['path']))
             new_blocked[p] = None
             continue
 
@@ -95,8 +95,8 @@
             h = sha(bencode(d['info'])).digest()
             new_file[1] = h
             if new_parsed.has_key(h):
-                errfunc(_("**warning** %s is a duplicate torrent for %s") %
-                        (p, new_parsed[h]['path']))
+                errfunc(_("**warning** %(a)s is a duplicate torrent for %(b)s") %
+                        dict(a = p, b = new_parsed[h]['path']))
                 new_blocked[p] = None
                 continue
 
--- BitTorrent-4.4.0/BitTorrent/HTTPHandler.py	2006-01-31 20:16:30.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/HTTPHandler.py	2009-02-25 13:51:04.000000000 +0000
@@ -123,7 +123,7 @@
                 self.encoding = 'identity'
             else:
                 if DEBUG:
-                   print _("Compressed: %i  Uncompressed: %i\n") % (len(cdata),len(data))
+                   print _("Compressed: %(c)i  Uncompressed: %(u)i\n") % dict(c = len(cdata), d = len(data))
                 data = cdata
                 headers['Content-Encoding'] = 'gzip'
 
--- BitTorrent-4.4.0/BitTorrent/configfile.py	2006-01-31 20:16:34.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/configfile.py	2009-02-25 13:55:25.000000000 +0000
@@ -130,7 +130,7 @@
         else:
             err_str = _("Configuration option mismatch: '%s'") % name
             if is_frozen_exe:
-                err_str = _("You must quit %s and reinstall it. (%s)") % (app_name, err_str)
+                err_str = _("You must quit %(app)s and reinstall it. (%(err)s)") % dict(app = app_name, err = err_str)
             error_callback(ERROR, err_str)
     _write_config(error_callback, filename, p)
 
--- BitTorrent-4.4.0/BitTorrent/parseargs.py	2006-01-31 20:16:35.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/parseargs.py	2009-02-25 13:57:00.000000000 +0000
@@ -183,5 +183,5 @@
                 raise TypeError, str(t)
 
         except ValueError, e:
-            raise BTFailure(_("wrong format of %s - %s") % (format_key(key), str(e)))
+            raise BTFailure(_("wrong format of %(k)s - %(e)s") % dict(k = format_key(key), e = str(e)))
 
--- BitTorrent-4.4.0/BitTorrent/IPC.py	2006-01-31 20:16:30.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/IPC.py	2009-02-25 14:28:20.000000000 +0000
@@ -130,7 +130,7 @@
     def handle_command(self, command, *args):
         if callable(self.callback):
             return self.callback(command, *args)
-        self.log(WARNING, _("Unhandled command: %s %s"  % (str(command), str(args))))
+        self.log(WARNING, _("Unhandled command: %(c)s %(a)s"  % dict(c = str(command), a = str(args))))
 
     def set_rawserver(self, rawserver):
         self.rawserver = rawserver
@@ -439,4 +439,4 @@
     ipc_interface = IPCWin32DDE
 else:
     ipc_interface = IPCUnixSocket
-    
\ No newline at end of file
+