Tidy up location of gettext setup_translations

This commit is contained in:
Calum Lind 2011-07-10 02:08:39 +01:00
parent 9eb85cb6eb
commit f7ce07c68f
5 changed files with 7 additions and 12 deletions

View File

@ -97,9 +97,6 @@ class Daemon(object):
"directory!"
)
# Initialize gettext
deluge.common.setup_translations()
# Twisted catches signals to terminate, so just have it call the shutdown
# method.
reactor.addSystemEventTrigger("after", "shutdown", self.shutdown)

View File

@ -56,6 +56,7 @@ except ImportError:
def start_ui():
"""Entry point for ui script"""
import deluge.common
deluge.common.setup_translations()
# Setup the argument parser
parser = OptionParser(usage="%prog [options] [actions]",
@ -94,7 +95,6 @@ def start_ui():
# Setup the logger
deluge.log.setupLogger(level=options.loglevel, filename=options.logfile,
filemode=logfile_mode)
deluge.common.setup_translations()
if options.config:
if not os.path.exists(options.config):
@ -137,6 +137,7 @@ def start_ui():
def start_daemon():
"""Entry point for daemon script"""
import deluge.common
deluge.common.setup_translations()
if 'dev' not in deluge.common.get_version():
import warnings
@ -190,7 +191,6 @@ this should be an IP address", metavar="IFACE",
# Setup the logger
deluge.log.setupLogger(level=options.loglevel, filename=options.logfile,
filemode=logfile_mode)
deluge.common.setup_translations()
import deluge.configmanager
if options.config:

View File

@ -82,7 +82,6 @@ class Gtk(_UI):
def start(self):
super(Gtk, self).start()
deluge.common.setup_translations(setup_pygtk=True)
GtkUI(self.args)
def start():

View File

@ -58,10 +58,14 @@ class _UI(object):
def __init__(self, name="gtk"):
self.__name = name
if name == "gtk":
deluge.common.setup_translations(setup_pygtk=True)
else:
deluge.common.setup_translations()
self.__parser = OptionParser(version="%prog: " + deluge.common.get_version() + lt_version)
group = OptionGroup(self.__parser, "Common Options")
group = OptionGroup(self.__parser, _("Common Options"))
group.add_option("-c", "--config", dest="config",
help="Set the config folder location", action="store", type="str")
group.add_option("-l", "--logfile", dest="logfile",
@ -106,8 +110,6 @@ class _UI(object):
filename=self.__options.logfile,
filemode=logfile_mode)
deluge.common.setup_translations()
log = logging.getLogger(__name__)
if self.__options.config:

View File

@ -41,9 +41,6 @@ from optparse import OptionGroup
class WebUI(UI):
def __init__(self, args):
# Setup translations
deluge.common.setup_translations()
import server
deluge_web = server.DelugeWeb()
deluge_web.start()