fix translations in core.py
This commit is contained in:
parent
240d3de894
commit
e46c75ecff
39
src/core.py
39
src/core.py
|
@ -56,9 +56,10 @@ import shutil
|
||||||
import statvfs
|
import statvfs
|
||||||
import time
|
import time
|
||||||
import gettext
|
import gettext
|
||||||
from common import N_, PRIORITY_NORMAL
|
|
||||||
import deluge_core
|
import deluge_core
|
||||||
import pref
|
import pref
|
||||||
|
import common
|
||||||
|
import locale
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
|
|
||||||
|
@ -81,15 +82,23 @@ PREF_FUNCTIONS = {
|
||||||
"use_natpmp" : deluge_core.use_natpmp,
|
"use_natpmp" : deluge_core.use_natpmp,
|
||||||
"use_utpex" : deluge_core.use_utpex,
|
"use_utpex" : deluge_core.use_utpex,
|
||||||
}
|
}
|
||||||
|
APP = 'deluge'
|
||||||
|
DIR = os.path.join(common.INSTALL_PREFIX, 'share', 'locale')
|
||||||
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
locale.bindtextdomain(APP, DIR)
|
||||||
|
locale.textdomain(APP)
|
||||||
|
gettext.bindtextdomain(APP, DIR)
|
||||||
|
gettext.textdomain(APP)
|
||||||
|
gettext.install(APP, DIR)
|
||||||
|
|
||||||
STATE_MESSAGES = (N_("Queued"),
|
STATE_MESSAGES = (_("Queued"),
|
||||||
N_("Checking"),
|
_("Checking"),
|
||||||
N_("Connecting"),
|
_("Connecting"),
|
||||||
N_("Downloading Metadata"),
|
_("Downloading Metadata"),
|
||||||
N_("Downloading"),
|
_("Downloading"),
|
||||||
N_("Finished"),
|
_("Finished"),
|
||||||
N_("Seeding"),
|
_("Seeding"),
|
||||||
N_("Allocating"))
|
_("Allocating"))
|
||||||
# Exceptions
|
# Exceptions
|
||||||
|
|
||||||
class DelugeError(Exception):
|
class DelugeError(Exception):
|
||||||
|
@ -588,26 +597,26 @@ class Manager:
|
||||||
elif event['event_type'] is self.constants['EVENT_TRACKER_ANNOUNCE']:
|
elif event['event_type'] is self.constants['EVENT_TRACKER_ANNOUNCE']:
|
||||||
self.set_supp_torrent_state_val(event['unique_ID'],
|
self.set_supp_torrent_state_val(event['unique_ID'],
|
||||||
"tracker_status",
|
"tracker_status",
|
||||||
N_("Announce sent"))
|
_("Announce sent"))
|
||||||
elif event['event_type'] is self.constants['EVENT_TRACKER_REPLY']:
|
elif event['event_type'] is self.constants['EVENT_TRACKER_REPLY']:
|
||||||
self.set_supp_torrent_state_val(event['unique_ID'],
|
self.set_supp_torrent_state_val(event['unique_ID'],
|
||||||
"tracker_status",
|
"tracker_status",
|
||||||
N_("Announce OK"))
|
_("Announce OK"))
|
||||||
elif event['event_type'] is self.constants['EVENT_TRACKER_ALERT']:
|
elif event['event_type'] is self.constants['EVENT_TRACKER_ALERT']:
|
||||||
match = re.search('tracker:\s*".*"\s*(.*)', event["message"])
|
match = re.search('tracker:\s*".*"\s*(.*)', event["message"])
|
||||||
message = match and match.groups()[0] or ""
|
message = match and match.groups()[0] or ""
|
||||||
|
|
||||||
tracker_status = "%s: %s (%s=%s, %s=%s)" % \
|
tracker_status = "%s: %s (%s=%s, %s=%s)" % \
|
||||||
(N_("Alert"), message,
|
(_("Alert"), message,
|
||||||
N_("HTTP code"), event["status_code"],
|
_("HTTP code"), event["status_code"],
|
||||||
N_("times in a row"), event["times_in_row"])
|
_("times in a row"), event["times_in_row"])
|
||||||
|
|
||||||
self.set_supp_torrent_state_val(event['unique_ID'],
|
self.set_supp_torrent_state_val(event['unique_ID'],
|
||||||
"tracker_status",
|
"tracker_status",
|
||||||
tracker_status)
|
tracker_status)
|
||||||
elif event['event_type'] is self.constants['EVENT_TRACKER_WARNING']:
|
elif event['event_type'] is self.constants['EVENT_TRACKER_WARNING']:
|
||||||
# Probably will need proper formatting later, not tested yet
|
# Probably will need proper formatting later, not tested yet
|
||||||
tracker_status = '%s: %s' % (N_("Warning"), event["message"])
|
tracker_status = '%s: %s' % (_("Warning"), event["message"])
|
||||||
|
|
||||||
self.set_supp_torrent_state_val(event['unique_ID'],
|
self.set_supp_torrent_state_val(event['unique_ID'],
|
||||||
"tracker_status",
|
"tracker_status",
|
||||||
|
|
Loading…
Reference in New Issue