From bd1729d5df796c01ded5f64b092704935cd62a52 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 14 Aug 2010 02:10:13 +0200 Subject: [PATCH] gettext-ify betfair2fpdb --- pyfpdb/BetfairToFpdb.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py index 5305c1c1..34316de2 100755 --- a/pyfpdb/BetfairToFpdb.py +++ b/pyfpdb/BetfairToFpdb.py @@ -22,6 +22,10 @@ import sys import logging from HandHistoryConverter import * +import gettext +trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) +trans.install() + # Betfair HH format class Betfair(HandHistoryConverter): @@ -68,7 +72,7 @@ class Betfair(HandHistoryConverter): m = self.re_GameInfo.search(handText) if not m: - logging.info('GameInfo regex did not match') + logging.info(_('GameInfo regex did not match')) return None mg = m.groupdict() @@ -99,7 +103,7 @@ class Betfair(HandHistoryConverter): def readHandInfo(self, hand): m = self.re_HandInfo.search(hand.handText) if(m == None): - logging.info("Didn't match re_HandInfo") + logging.info(_("Didn't match re_HandInfo")) logging.info(hand.handText) return None 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'))) hand.addBringIn(m.group('PNAME'), m.group('BRINGIN')) else: - logging.warning("No bringin found") + logging.warning(_("No bringin found")) def readButton(self, hand): hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON')) @@ -191,7 +195,7 @@ class Betfair(HandHistoryConverter): elif action.group('ATYPE') == 'checks': hand.addCheck( street, action.group('PNAME')) 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): @@ -214,9 +218,9 @@ class Betfair(HandHistoryConverter): if __name__ == "__main__": 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("-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("-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("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False) parser.add_option("-q", "--quiet", action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO) parser.add_option("-v", "--verbose",