Remove torrent_status translations from Daemon and move to UI clients

This commit is contained in:
Calum Lind 2014-01-16 16:48:32 +00:00
parent 0a41b86e47
commit 8eb2155eac
5 changed files with 30 additions and 7 deletions

View File

@ -111,10 +111,9 @@ def tracker_error_filter(torrent_ids, values):
filtered_torrent_ids.append(torrent_id)
return filtered_torrent_ids
error_str = _("Error") + ":"
# Check torrent's tracker_status for 'Error:' and return those torrent_ids
for torrent_id in torrent_ids:
if error_str in tm[torrent_id].get_status(["tracker_status"])["tracker_status"]:
if "Error:" in tm[torrent_id].get_status(["tracker_status"])["tracker_status"]:
filtered_torrent_ids.append(torrent_id)
return filtered_torrent_ids

View File

@ -972,7 +972,7 @@ class TorrentManager(component.Component):
return
# Set the tracker status for the torrent
torrent.set_tracker_status(_("Announce OK"))
torrent.set_tracker_status("Announce OK")
# Check to see if we got any peer information from the tracker
if alert.handle.status().num_complete == -1 or \
@ -990,7 +990,7 @@ class TorrentManager(component.Component):
return
# Set the tracker status for the torrent
torrent.set_tracker_status(_("Announce Sent"))
torrent.set_tracker_status("Announce Sent")
def on_alert_tracker_warning(self, alert):
"""Alert handler for libtorrent tracker_warning_alert"""
@ -999,7 +999,7 @@ class TorrentManager(component.Component):
torrent = self.torrents[str(alert.handle.info_hash())]
except RuntimeError:
return
tracker_status = '%s: %s' % (_("Warning"), decode_string(alert.message()))
tracker_status = 'Warning: %s' % decode_string(alert.message())
# Set the tracker status for the torrent
torrent.set_tracker_status(tracker_status)
@ -1010,7 +1010,7 @@ class TorrentManager(component.Component):
torrent = self.torrents[str(alert.handle.info_hash())]
except RuntimeError:
return
tracker_status = "%s: %s" % (_("Error"), decode_string(alert.msg))
tracker_status = "Error: %s" % decode_string(alert.msg)
torrent.set_tracker_status(tracker_status)
def on_alert_storage_moved(self, alert):

View File

@ -140,7 +140,6 @@ def start_ui():
def start_daemon():
"""Entry point for daemon script"""
deluge.common.setup_translations()
if 'dev' not in deluge.common.get_version():
import warnings

View File

@ -147,6 +147,18 @@ class StatusTab(Tab):
else:
status["is_auto_managed"]=_("Off")
translate_tracker_status = {
"Error" : _("Error"),
"Warning" : _("Warning"),
"Announce OK" : _("Announce OK"),
"Announce Sent" : _("Announce Sent")
}
for key, value in translate_tracker_status.iteritems():
if key in status["tracker_status"]:
status["tracker_status"] = status["tracker_status"].replace(key, value, 1)
log.error(status["tracker_status"])
break
# Update all the label widgets
for widget in self.label_widgets:
if widget[1] != None:

View File

@ -115,6 +115,19 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
}
data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False');
var translate_tracker_status = {
'Error' : _('Error'),
'Warning' : _('Warning'),
'Announce OK' : _('Announce OK'),
'Announce Sent' : _('Announce Sent')
};
for (var key in translate_tracker_status) {
if (data.tracker_status.indexOf(key) != -1) {
data.tracker_status = data.tracker_status.replace(key, translate_tracker_status[key]);
break;
}
}
data.downloaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download) : '0.0 KiB') + ')';
data.uploaded += ' (' + ((status.total_payload_upload) ? fsize(status.total_payload_upload): '0.0 KiB') + ')';