remove debug print; add import to Config; gettextify tables

This commit is contained in:
steffen123 2010-08-15 21:09:18 +02:00
parent b4317bba2a
commit b08cb18c0e
15 changed files with 31 additions and 20 deletions

View File

@ -25,7 +25,6 @@ import sys
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -24,7 +24,6 @@ from HandHistoryConverter import *
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -17,7 +17,6 @@
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -36,6 +36,18 @@ import re
import xml.dom.minidom import xml.dom.minidom
from xml.dom.minidom import Node from xml.dom.minidom import Node
import locale
lang=locale.getdefaultlocale()[0][0:2]
if lang=="en":
def _(string): return string
else:
import gettext
try:
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
trans.install()
except IOError:
def _(string): return string
import logging, logging.config import logging, logging.config
import ConfigParser import ConfigParser

View File

@ -35,7 +35,6 @@ import Exceptions
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -37,7 +37,6 @@ import SQL
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -32,7 +32,6 @@ log = logging.getLogger("logview")
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -43,7 +43,6 @@ import Configuration
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -24,7 +24,6 @@ import PokerStarsSummary
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -21,7 +21,6 @@ from optparse import OptionParser
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -29,8 +29,19 @@ import os
import sys import sys
import re import re
# Win32 modules import locale
lang=locale.getdefaultlocale()[0][0:2]
if lang=="en":
def _(string): return string
else:
import gettext
try:
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
trans.install()
except IOError:
def _(string): return string
# Win32 modules
if os.name == 'nt': if os.name == 'nt':
import win32gui import win32gui
import win32process import win32process
@ -220,7 +231,7 @@ def discover_nt(c):
tw.site = "Full Tilt" tw.site = "Full Tilt"
else: else:
tw.site = "Unknown" tw.site = "Unknown"
sys.stderr.write("Found unknown table = %s" % tw.title) sys.stderr.write(_("Found unknown table = %s") % tw.title)
if tw.site != "Unknown": if tw.site != "Unknown":
eval("%s(tw)" % c.supported_sites[tw.site].decoder) eval("%s(tw)" % c.supported_sites[tw.site].decoder)
else: else:
@ -247,7 +258,7 @@ def discover_nt_by_name(c, tablename):
if 'Chat:' in titles[hwnd]: continue # Some sites (FTP? PS? Others?) have seperable or seperately constructed chat windows if 'Chat:' in titles[hwnd]: continue # Some sites (FTP? PS? Others?) have seperable or seperately constructed chat windows
if ' - Table ' in titles[hwnd]: continue # Absolute table Chat window.. sigh. TODO: Can we tell what site we're trying to discover for somehow in here, so i can limit this check just to AP searches? if ' - Table ' in titles[hwnd]: continue # Absolute table Chat window.. sigh. TODO: Can we tell what site we're trying to discover for somehow in here, so i can limit this check just to AP searches?
temp = decode_windows(c, titles[hwnd], hwnd) temp = decode_windows(c, titles[hwnd], hwnd)
print "attach to window", temp print _("attach to window"), temp
return temp return temp
return None return None
@ -434,5 +445,5 @@ if __name__=="__main__":
for t in tables.keys(): for t in tables.keys():
print tables[t] print tables[t]
print "press enter to continue" print _("press enter to continue")
sys.stdin.readline() sys.stdin.readline()

View File

@ -38,7 +38,6 @@ from HandHistoryConverter import getTableTitleRe
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -45,9 +45,9 @@ class TourneyFilters(Filters.Filters):
self.conf = db.config self.conf = db.config
self.display = display self.display = display
self.filterText = {'playerstitle':'Hero:', 'sitestitle':'Sites:', 'seatstitle':'Number of Players:', self.filterText = {'playerstitle':_('Hero:'), 'sitestitle':_('Sites:'), 'seatstitle':_('Number of Players:'),
'seatsbetween':'Between:', 'seatsand':'And:', 'datestitle':'Date:', 'seatsbetween':_('Between:'), 'seatsand':_('And:'), 'datestitle':_('Date:'),
'tourneyTypesTitle':'Tourney Type'} 'tourneyTypesTitle':_('Tourney Type')}
gen = self.conf.get_general_params() gen = self.conf.get_general_params()
self.day_start = 0 self.day_start = 0
@ -102,7 +102,7 @@ class TourneyFilters(Filters.Filters):
if len(result) == 1: if len(result) == 1:
self.siteid[site] = result[0][0] self.siteid[site] = result[0][0]
else: else:
print "Either 0 or more than one site matched (%s) - EEK" % site print _("Either 0 or more than one site matched (%s) - EEK") % site
# For use in date ranges. # For use in date ranges.
self.start_date = gtk.Entry(max=12) self.start_date = gtk.Entry(max=12)

View File

@ -22,7 +22,6 @@ import Queue
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else:

View File

@ -19,7 +19,6 @@
import locale import locale
lang=locale.getdefaultlocale()[0][0:2] lang=locale.getdefaultlocale()[0][0:2]
print "lang:", lang
if lang=="en": if lang=="en":
def _(string): return string def _(string): return string
else: else: