From 235a8baa5f025fa8f38520f53e9c9dfc254f8284 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 23 Sep 2010 14:31:16 +0800 Subject: [PATCH] L10n: Remaining files --- pyfpdb/OnGameToFpdb.py | 15 +++------------ pyfpdb/Options.py | 15 +++------------ pyfpdb/PartyPokerToFpdb.py | 15 +++------------ pyfpdb/PkrToFpdb.py | 14 ++------------ pyfpdb/PokerStarsSummary.py | 15 +++------------ pyfpdb/PokerStarsToFpdb.py | 15 +++------------ pyfpdb/Stats.py | 15 +++------------ pyfpdb/Tables_Demo.py | 15 +++------------ pyfpdb/TournamentTracker.py | 15 +++------------ pyfpdb/TourneyFilters.py | 15 +++------------ pyfpdb/TourneySummary.py | 15 +++------------ pyfpdb/UltimateBetToFpdb.py | 3 +++ pyfpdb/Win2dayToFpdb.py | 15 +++------------ pyfpdb/WinTables.py | 15 +++------------ pyfpdb/XTables.py | 3 +++ 15 files changed, 44 insertions(+), 156 deletions(-) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index 62eb2d96..db7d99a2 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -18,6 +18,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() + import sys import exceptions @@ -30,18 +33,6 @@ import Configuration from HandHistoryConverter import * from decimal import Decimal -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 - # OnGame HH Format class OnGame(HandHistoryConverter): diff --git a/pyfpdb/Options.py b/pyfpdb/Options.py index 19139278..98034b50 100644 --- a/pyfpdb/Options.py +++ b/pyfpdb/Options.py @@ -15,22 +15,13 @@ #along with this program. If not, see . #In the "official" distribution you can find the license in agpl-3.0.txt. +import L10n +_ = L10n.get_translation() + import sys from optparse import OptionParser # http://docs.python.org/library/optparse.html -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 - def fpdb_options(): """Process command line options for fpdb and HUD_main.""" diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index b228e391..a96308c0 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -18,21 +18,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() + import sys from collections import defaultdict -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 - from Exceptions import FpdbParseError from HandHistoryConverter import * diff --git a/pyfpdb/PkrToFpdb.py b/pyfpdb/PkrToFpdb.py index 23b43a76..ecb43ae8 100755 --- a/pyfpdb/PkrToFpdb.py +++ b/pyfpdb/PkrToFpdb.py @@ -18,22 +18,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() import sys from HandHistoryConverter import * -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 - class Pkr(HandHistoryConverter): diff --git a/pyfpdb/PokerStarsSummary.py b/pyfpdb/PokerStarsSummary.py index c5f0926c..cfa33322 100644 --- a/pyfpdb/PokerStarsSummary.py +++ b/pyfpdb/PokerStarsSummary.py @@ -17,6 +17,9 @@ """pokerstars-specific summary parsing code""" +import L10n +_ = L10n.get_translation() + from decimal import Decimal import datetime @@ -25,18 +28,6 @@ from HandHistoryConverter import * import PokerStarsToFpdb from TourneySummary import * -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 - class PokerStarsSummary(TourneySummary): limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' } games = { # base, category diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index cc9724c3..8b35c525 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -18,24 +18,15 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() + # TODO: straighten out discards for draw games import sys from HandHistoryConverter import * from decimal import Decimal -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 - # PokerStars HH Format class PokerStars(HandHistoryConverter): diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index a9dd137f..bc0396dc 100644 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -47,6 +47,9 @@ # other stuff. # 6 For each stat you make add a line to the __main__ function to test it. +import L10n +_ = L10n.get_translation() + # Standard Library modules import sys @@ -55,18 +58,6 @@ import pygtk import gtk import re -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 - # FreePokerTools modules import Configuration import Database diff --git a/pyfpdb/Tables_Demo.py b/pyfpdb/Tables_Demo.py index bb81e2f1..3e633204 100755 --- a/pyfpdb/Tables_Demo.py +++ b/pyfpdb/Tables_Demo.py @@ -22,6 +22,9 @@ Main program module to test/demo the Tables subclasses. ######################################################################## +import L10n +_ = L10n.get_translation() + # Standard Library modules import sys import os @@ -33,18 +36,6 @@ import gobject # fpdb/free poker tools modules import Configuration -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 - # get the correct module for the current os if os.name == 'posix': import XTables as Tables diff --git a/pyfpdb/TournamentTracker.py b/pyfpdb/TournamentTracker.py index da7135b9..455626ec 100644 --- a/pyfpdb/TournamentTracker.py +++ b/pyfpdb/TournamentTracker.py @@ -21,6 +21,9 @@ ######################################################################## +import L10n +_ = L10n.get_translation() + # to do allow window resizing # to do hud to echo, but ignore non numbers # to do no stat window for hero @@ -34,18 +37,6 @@ import traceback (options, argv) = Options.fpdb_options() -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 - if not options.errorsToConsole: print _("Note: error output is being diverted to fpdb-error-log.txt and HUD-error.txt. Any major error will be reported there _only_.") errorFile = open('tourneyerror.txt', 'w', 0) diff --git a/pyfpdb/TourneyFilters.py b/pyfpdb/TourneyFilters.py index ddb98166..7b3f235a 100644 --- a/pyfpdb/TourneyFilters.py +++ b/pyfpdb/TourneyFilters.py @@ -15,6 +15,9 @@ #along with this program. If not, see . #In the "official" distribution you can find the license in agpl-3.0.txt. +import L10n +_ = L10n.get_translation() + import threading import pygtk pygtk.require('2.0') @@ -29,18 +32,6 @@ from time import gmtime, mktime, strftime, strptime import logging #logging has been set up in fpdb.py or HUD_main.py, use their settings: log = logging.getLogger("filter") -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 Configuration #import Database #import SQL diff --git a/pyfpdb/TourneySummary.py b/pyfpdb/TourneySummary.py index 7490802b..def20fef 100644 --- a/pyfpdb/TourneySummary.py +++ b/pyfpdb/TourneySummary.py @@ -17,6 +17,9 @@ """parses and stores summary sections from e.g. eMail or summary files""" +import L10n +_ = L10n.get_translation() + # TODO: check to keep only the needed modules import re @@ -31,18 +34,6 @@ import time,datetime from copy import deepcopy from Exceptions import * -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 pprint import DerivedStats import Card diff --git a/pyfpdb/UltimateBetToFpdb.py b/pyfpdb/UltimateBetToFpdb.py index 580244bb..d21cc9dc 100755 --- a/pyfpdb/UltimateBetToFpdb.py +++ b/pyfpdb/UltimateBetToFpdb.py @@ -18,6 +18,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() + import sys from HandHistoryConverter import * diff --git a/pyfpdb/Win2dayToFpdb.py b/pyfpdb/Win2dayToFpdb.py index a09f9c9c..e704e11b 100755 --- a/pyfpdb/Win2dayToFpdb.py +++ b/pyfpdb/Win2dayToFpdb.py @@ -18,22 +18,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() + import sys import datetime from HandHistoryConverter import * -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 - # Win2day HH Format class Win2day(HandHistoryConverter): diff --git a/pyfpdb/WinTables.py b/pyfpdb/WinTables.py index 2e1f493d..331714bb 100644 --- a/pyfpdb/WinTables.py +++ b/pyfpdb/WinTables.py @@ -20,6 +20,9 @@ ######################################################################## +import L10n +_ = L10n.get_translation() + # Standard Library modules import re @@ -38,18 +41,6 @@ import win32api import win32con import win32security -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 - # FreePokerTools modules from TableWindow import Table_Window diff --git a/pyfpdb/XTables.py b/pyfpdb/XTables.py index d8ca677f..59fc0b3d 100644 --- a/pyfpdb/XTables.py +++ b/pyfpdb/XTables.py @@ -20,6 +20,9 @@ ######################################################################## +import L10n +_ = L10n.get_translation() + # Standard Library modules import re import os