Add translation markup to '--help' options

This commit is contained in:
Calum Lind 2016-04-24 22:51:46 +01:00
parent 2bad04848c
commit acdc19df1d
4 changed files with 30 additions and 33 deletions

View File

@ -21,28 +21,25 @@ from deluge.ui.util import lang
def add_daemon_options(parser):
group = parser.add_argument_group('Daemon Options')
group = parser.add_argument_group(_("Daemon Options"))
group.add_argument("-p", "--port", metavar="<port>", action="store", type=int,
help="The port the daemon will listen on")
group.add_argument("-i", "--interface", metavar="<iface>", dest="listen_interface",
help="Interface daemon will listen for bittorrent connections on, "
"this should be an IP address", action="store")
help=_("The port the daemon will listen on"))
group.add_argument("-i", "--interface", metavar="<iface>", dest="listen_interface", action="store",
help=_("Interface daemon will listen for bittorrent connections on, must be an IP address"))
group.add_argument("-u", "--ui-interface", metavar="<iface>", action="store",
help="Interface daemon will listen for UI connections on, "
"this should be an IP address")
help=_("Interface daemon will listen for UI connections on, must be an IP address"))
if not deluge.common.windows_check():
group.add_argument("-d", "--do-not-daemonize", dest="donot",
help="Do not daemonize", action="store_true", default=False)
group.add_argument("-P", "--pidfile", metavar="<pidfile>",
help="Use pidfile to store process id", action="store")
group.add_argument("-d", "--do-not-daemonize", dest="donot", action="store_true",
help=_("Do not fork or daemonize the daemon process"))
group.add_argument("-P", "--pidfile", metavar="<pidfile>", action="store",
help=_("Use a pidfile to store process id"))
if not deluge.common.windows_check():
group.add_argument("-U", "--user", metavar="<user>", action="store",
help="User to switch to. Only use it when starting as root")
help=_("User to switch to. Only use it when starting as root"))
group.add_argument("-g", "--group", metavar="<group>", action="store",
help="Group to switch to. Only use it when starting as root")
group.add_argument("--read-only-config-keys",
help="List of comma-separated config keys that will not be modified by set_config RPC.",
action="store", type=str, default="")
help=_("Group to switch to. Only use it when starting as root"))
group.add_argument("--read-only-config-keys", action="store", type=str, default="",
help=_("List of comma-separated config keys that will not be modified by set_config RPC."))
def start_daemon(skip_start=False):

View File

@ -104,13 +104,13 @@ class BaseArgParser(argparse.ArgumentParser):
self.group.add_argument("-L", "--loglevel", action="store", choices=deluge.log.levels, metavar="<level>",
help=_("Set the log level: %s" % ", ".join(deluge.log.levels)))
self.group.add_argument("--logrotate", action="store", nargs="?", const="2M", metavar="<max size>",
help=_("Enable logfile rotation, with optional maximum logfile size, \
default: %(const)s (Logfile rotation count is 5)"))
help=_("Enable logfile rotation, with optional maximum logfile size, "
"default: %(const)s (Logfile rotation count is 5)"))
self.group.add_argument("-q", "--quiet", action="store_true", default=False,
help=_("Quieten logging output, equal to `--loglevel none`"))
self.group.add_argument("--profile", metavar="<results file>", action="store", nargs="?", default=False,
help=_("Profile %(prog)s with cProfile. Prints results to stdout \
unless a filename is specified"))
help=_("Profile %(prog)s with cProfile. Prints results to stdout "
"unless a filename is specified"))
self.group.add_argument("-h", "--help", action=HelpAction, help=_("Show this help message and exit"))
def parse_args(self, *args):

View File

@ -142,10 +142,10 @@ class Gtk(UI):
def __init__(self, *args, **kwargs):
super(Gtk, self).__init__("gtk", *args, **kwargs)
group = self.parser.add_argument_group(_('GTK Options'))
group = self.parser.add_argument_group(_("GTK Options"))
group.add_argument("torrents", metavar="<torrent>", nargs="*", default=None,
help="Add one or more torrent files, torrent URLs or magnet URIs"
" to a currently running Deluge GTK instance")
help=_("Add one or more torrent files, torrent URLs or magnet URIs"
" to a currently running Deluge GTK instance"))
def start(self, args=None):
super(Gtk, self).start(args)

View File

@ -36,33 +36,33 @@ class Web(UI):
super(Web, self).__init__("web", *args, **kwargs)
self.__server = None
group = self.parser.add_argument_group(_('Web Options'))
group = self.parser.add_argument_group(_("Web Options"))
group.add_argument("-b", "--base", metavar="<path>", action="store", default=None,
help="Set the base path that the ui is running on (proxying)")
help=_("Set the base path that the ui is running on (proxying)"))
if not windows_check():
group.add_argument("-d", "--do-not-daemonize", dest="donotdaemonize", action="store_true", default=False,
help="Do not daemonize the web interface")
help=_("Do not daemonize the web interface"))
group.add_argument("-f", "--fork", dest="donotdaemonize", action="store_false", help=argparse.SUPPRESS)
group.add_argument("-P", "--pidfile", metavar="<pidfile>", action="store", default=None,
help="Use pidfile to store process id")
help=_("Use pidfile to store process id"))
if not windows_check():
group.add_argument("-U", "--user", metavar="<user>", action="store", default=None,
help="User to switch to. Only use it when starting as root")
help=_("User to switch to. Only use it when starting as root"))
group.add_argument("-g", "--group", metavar="<group>", action="store", default=None,
help="Group to switch to. Only use it when starting as root")
help=_("Group to switch to. Only use it when starting as root"))
group.add_argument("-i", "--interface", metavar="<interface>", action="store", default=None,
help="Binds the webserver to a specific IP address")
help=_("Binds the webserver to a specific IP address"))
group.add_argument("-p", "--port", metavar="<port>", type=int, action="store", default=None,
help="Sets the port to be used for the webserver")
help=_("Sets the port to be used for the webserver"))
try:
import OpenSSL
assert OpenSSL.__version__
except ImportError:
pass
else:
group.add_argument("--ssl", action="store_true", help="Forces the webserver to use ssl")
group.add_argument("--no-ssl", action="store_true", help="Forces the webserver to disable ssl")
group.add_argument("--ssl", action="store_true", help=_("Forces the webserver to use ssl"))
group.add_argument("--no-ssl", action="store_true", help=_("Forces the webserver to disable ssl"))
@property
def server(self):