gettextify options

This commit is contained in:
steffen123 2010-08-15 05:38:00 +02:00
parent b360628583
commit fd03cb6560

View File

@ -19,35 +19,39 @@ import sys
from optparse import OptionParser from optparse import OptionParser
# http://docs.python.org/library/optparse.html # http://docs.python.org/library/optparse.html
import gettext
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
trans.install()
def fpdb_options(): def fpdb_options():
"""Process command line options for fpdb and HUD_main.""" """Process command line options for fpdb and HUD_main."""
parser = OptionParser() parser = OptionParser()
parser.add_option("-x", "--errorsToConsole", parser.add_option("-x", "--errorsToConsole",
action="store_true", action="store_true",
help="If passed error output will go to the console rather than .") help=_("If passed error output will go to the console rather than ."))
parser.add_option("-d", "--databaseName", parser.add_option("-d", "--databaseName",
dest="dbname", dest="dbname",
help="Overrides the default database name") help=_("Overrides the default database name"))
parser.add_option("-c", "--configFile", parser.add_option("-c", "--configFile",
dest="config", default=None, dest="config", default=None,
help="Specifies a configuration file.") help=_("Specifies a configuration file."))
parser.add_option("-r", "--rerunPython", parser.add_option("-r", "--rerunPython",
action="store_true", action="store_true",
help="Indicates program was restarted with a different path (only allowed once).") help=_("Indicates program was restarted with a different path (only allowed once)."))
parser.add_option("-i", "--infile", parser.add_option("-i", "--infile",
dest="infile", default="Slartibartfast", dest="infile", default="Slartibartfast",
help="Input file") help=_("Input file"))
parser.add_option("-k", "--konverter", parser.add_option("-k", "--konverter",
dest="hhc", default="PokerStarsToFpdb", dest="hhc", default="PokerStarsToFpdb",
help="Module name for Hand History Converter") help=_("Module name for Hand History Converter"))
parser.add_option("-l", "--logging", parser.add_option("-l", "--logging",
dest = "log_level", dest = "log_level",
choices = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'EMPTY'), choices = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'EMPTY'),
help = "Error logging level. (DEBUG, INFO, WARNING, ERROR, CRITICAL, EMPTY)", help = _("Error logging level:")+" (DEBUG, INFO, WARNING, ERROR, CRITICAL, EMPTY)",
default = 'EMPTY') default = 'EMPTY')
parser.add_option("-v", "--version", action = "store_true", parser.add_option("-v", "--version", action = "store_true",
help = "Print version information and exit.") help = _("Print version information and exit."))
(options, argv) = parser.parse_args() (options, argv) = parser.parse_args()
return (options, argv) return (options, argv)
@ -58,5 +62,5 @@ if __name__== "__main__":
print "database name =", options.dbname print "database name =", options.dbname
print "config file =", options.config print "config file =", options.config
print "press enter to end" print _("press enter to end")
sys.stdin.readline() sys.stdin.readline()