mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
[GTKUI] [WEBUI] Add tracker_status translation to UIs
This commit is contained in:
parent
0b4627be8a
commit
48cedf635f
@ -56,6 +56,21 @@ from deluge.common import utf8_encoded, path_join
|
|||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
import deluge.configmanager
|
import deluge.configmanager
|
||||||
|
|
||||||
|
|
||||||
|
# Dummy translation list so tracker status is translatable.
|
||||||
|
def _(message):
|
||||||
|
return message
|
||||||
|
|
||||||
|
|
||||||
|
TRACKER_STATUS_TRANSLATION = [
|
||||||
|
_('Error'),
|
||||||
|
_('Warning'),
|
||||||
|
_('Announce OK'),
|
||||||
|
_('Announce Sent')
|
||||||
|
]
|
||||||
|
del _
|
||||||
|
|
||||||
|
|
||||||
class TorrentInfo(object):
|
class TorrentInfo(object):
|
||||||
"""
|
"""
|
||||||
Collects information about a torrent file.
|
Collects information about a torrent file.
|
||||||
|
@ -40,9 +40,11 @@ import gtk, gtk.glade
|
|||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
from deluge.ui.common import TRACKER_STATUS_TRANSLATION
|
||||||
from deluge.ui.gtkui.torrentdetails import Tab
|
from deluge.ui.gtkui.torrentdetails import Tab
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
|
||||||
|
|
||||||
def fpeer_sized(first, second):
|
def fpeer_sized(first, second):
|
||||||
return "%s (%s)" % (deluge.common.fsize(first), deluge.common.fsize(second))
|
return "%s (%s)" % (deluge.common.fsize(first), deluge.common.fsize(second))
|
||||||
|
|
||||||
@ -63,6 +65,17 @@ def fspeed(value, max_value=-1):
|
|||||||
else:
|
else:
|
||||||
return deluge.common.fspeed(value)
|
return deluge.common.fspeed(value)
|
||||||
|
|
||||||
|
def ftranslate(text):
|
||||||
|
if text in TRACKER_STATUS_TRANSLATION:
|
||||||
|
text = _(text)
|
||||||
|
elif text:
|
||||||
|
for status in TRACKER_STATUS_TRANSLATION:
|
||||||
|
if status in text:
|
||||||
|
text = text.replace(status, _(status))
|
||||||
|
break
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
class StatusTab(Tab):
|
class StatusTab(Tab):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Tab.__init__(self)
|
Tab.__init__(self)
|
||||||
@ -85,7 +98,7 @@ class StatusTab(Tab):
|
|||||||
(glade.get_widget("summary_peers"), deluge.common.fpeer, ("num_peers", "total_peers")),
|
(glade.get_widget("summary_peers"), deluge.common.fpeer, ("num_peers", "total_peers")),
|
||||||
(glade.get_widget("summary_eta"), deluge.common.ftime, ("eta",)),
|
(glade.get_widget("summary_eta"), deluge.common.ftime, ("eta",)),
|
||||||
(glade.get_widget("summary_share_ratio"), fratio, ("ratio",)),
|
(glade.get_widget("summary_share_ratio"), fratio, ("ratio",)),
|
||||||
(glade.get_widget("summary_tracker_status"), None, ("tracker_status",)),
|
(glade.get_widget("summary_tracker_status"), ftranslate, ("tracker_status",)),
|
||||||
(glade.get_widget("summary_next_announce"), deluge.common.ftime, ("next_announce",)),
|
(glade.get_widget("summary_next_announce"), deluge.common.ftime, ("next_announce",)),
|
||||||
(glade.get_widget("summary_active_time"), deluge.common.ftime, ("active_time",)),
|
(glade.get_widget("summary_active_time"), deluge.common.ftime, ("active_time",)),
|
||||||
(glade.get_widget("summary_seed_time"), deluge.common.ftime, ("seeding_time",)),
|
(glade.get_widget("summary_seed_time"), deluge.common.ftime, ("seeding_time",)),
|
||||||
|
@ -119,6 +119,12 @@ GetText.add('Allow Remote Connections', '${escape(_("Allow Remote Connections"))
|
|||||||
// InterfacePage.js:78
|
// InterfacePage.js:78
|
||||||
GetText.add('Allow the use of multiple filters at once', '${escape(_("Allow the use of multiple filters at once"))}')
|
GetText.add('Allow the use of multiple filters at once', '${escape(_("Allow the use of multiple filters at once"))}')
|
||||||
|
|
||||||
|
// StatusTab.js:119
|
||||||
|
GetText.add('Announce OK', '${escape(_("Announce OK"))}')
|
||||||
|
|
||||||
|
// StatusTab.js:120
|
||||||
|
GetText.add('Announce Sent', '${escape(_("Announce Sent"))}')
|
||||||
|
|
||||||
// OptionsTab.js:347, PreferencesWindow.js:107
|
// OptionsTab.js:347, PreferencesWindow.js:107
|
||||||
GetText.add('Apply', '${escape(_("Apply"))}')
|
GetText.add('Apply', '${escape(_("Apply"))}')
|
||||||
|
|
||||||
@ -296,7 +302,7 @@ GetText.add('Encrypt entire stream', '${escape(_("Encrypt entire stream"))}')
|
|||||||
// EncryptionPage.js:41
|
// EncryptionPage.js:41
|
||||||
GetText.add('Encryption', '${escape(_("Encryption"))}')
|
GetText.add('Encryption', '${escape(_("Encryption"))}')
|
||||||
|
|
||||||
// ConnectionManager.js:316, ConnectionManager.js:372, AddConnectionWindow.js:103, UrlWindow.js:116, FileWindow.js:103, AddWindow.js:211
|
// ConnectionManager.js:316, ConnectionManager.js:372, AddConnectionWindow.js:103, StatusTab.js:117, UrlWindow.js:116, FileWindow.js:103, AddWindow.js:211
|
||||||
GetText.add('Error', '${escape(_("Error"))}')
|
GetText.add('Error', '${escape(_("Error"))}')
|
||||||
|
|
||||||
// Menus.js:323
|
// Menus.js:323
|
||||||
@ -830,6 +836,9 @@ GetText.add('Username', '${escape(_("Username"))}')
|
|||||||
// ConnectionManager.js:90
|
// ConnectionManager.js:90
|
||||||
GetText.add('Version', '${escape(_("Version"))}')
|
GetText.add('Version', '${escape(_("Version"))}')
|
||||||
|
|
||||||
|
// StatusTab.js:118
|
||||||
|
GetText.add('Warning', '${escape(_("Warning"))}')
|
||||||
|
|
||||||
// ConnectionManager.js:285
|
// ConnectionManager.js:285
|
||||||
GetText.add('We recommend changing the default password.<br><br>Would you like to change it now?', '${escape(_("We recommend changing the default password.<br><br>Would you like to change it now?"))}')
|
GetText.add('We recommend changing the default password.<br><br>Would you like to change it now?', '${escape(_("We recommend changing the default password.<br><br>Would you like to change it now?"))}')
|
||||||
|
|
||||||
|
@ -113,6 +113,19 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
|
|||||||
}
|
}
|
||||||
data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False');
|
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.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') + ')';
|
data.uploaded += ' (' + ((status.total_payload_upload) ? fsize(status.total_payload_upload): '0.0 KiB') + ')';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user