gettext-ify betfair2fpdb

This commit is contained in:
steffen123 2010-08-14 02:10:13 +02:00
parent 5e91c6037b
commit bd1729d5df

View File

@ -22,6 +22,10 @@ import sys
import logging import logging
from HandHistoryConverter import * from HandHistoryConverter import *
import gettext
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
trans.install()
# Betfair HH format # Betfair HH format
class Betfair(HandHistoryConverter): class Betfair(HandHistoryConverter):
@ -68,7 +72,7 @@ class Betfair(HandHistoryConverter):
m = self.re_GameInfo.search(handText) m = self.re_GameInfo.search(handText)
if not m: if not m:
logging.info('GameInfo regex did not match') logging.info(_('GameInfo regex did not match'))
return None return None
mg = m.groupdict() mg = m.groupdict()
@ -99,7 +103,7 @@ class Betfair(HandHistoryConverter):
def readHandInfo(self, hand): def readHandInfo(self, hand):
m = self.re_HandInfo.search(hand.handText) m = self.re_HandInfo.search(hand.handText)
if(m == None): if(m == None):
logging.info("Didn't match re_HandInfo") logging.info(_("Didn't match re_HandInfo"))
logging.info(hand.handText) logging.info(hand.handText)
return None return None
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE'))) logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
@ -155,7 +159,7 @@ class Betfair(HandHistoryConverter):
logging.debug("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN'))) logging.debug("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN')))
hand.addBringIn(m.group('PNAME'), m.group('BRINGIN')) hand.addBringIn(m.group('PNAME'), m.group('BRINGIN'))
else: else:
logging.warning("No bringin found") logging.warning(_("No bringin found"))
def readButton(self, hand): def readButton(self, hand):
hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON')) hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON'))
@ -191,7 +195,7 @@ class Betfair(HandHistoryConverter):
elif action.group('ATYPE') == 'checks': elif action.group('ATYPE') == 'checks':
hand.addCheck( street, action.group('PNAME')) hand.addCheck( street, action.group('PNAME'))
else: else:
sys.stderr.write( "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)) sys.stderr.write( _("DEBUG: unimplemented readAction: '%s' '%s'") %(action.group('PNAME'),action.group('ATYPE'),))
def readShowdownActions(self, hand): def readShowdownActions(self, hand):
@ -214,9 +218,9 @@ class Betfair(HandHistoryConverter):
if __name__ == "__main__": if __name__ == "__main__":
parser = OptionParser() parser = OptionParser()
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/betfair/befair.02.04.txt") parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="regression-test-files/betfair/befair.02.04.txt")
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-") parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False) parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
parser.add_option("-q", "--quiet", parser.add_option("-q", "--quiet",
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO) action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
parser.add_option("-v", "--verbose", parser.add_option("-v", "--verbose",