From dee17e8001fb72ac4d4706f9a0c6ba28e31fc0ec Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 23 Sep 2010 14:10:30 +0800 Subject: [PATCH] L10n: H->M updated --- pyfpdb/Hand.py | 15 +++------------ pyfpdb/HandHistoryConverter.py | 15 +++------------ pyfpdb/Hud.py | 16 ++++------------ pyfpdb/ImapFetcher.py | 15 +++------------ pyfpdb/iPokerToFpdb.py | 15 +++------------ pyfpdb/interlocks.py | 15 +++------------ 6 files changed, 19 insertions(+), 72 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index a556de63..7c35c85c 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.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() + # TODO: get writehand() encoding correct import re @@ -28,18 +31,6 @@ import time,datetime from copy import deepcopy import pprint -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 has been set up in fpdb.py or HUD_main.py, use their settings: log = logging.getLogger("parser") diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 25e96400..522092f8 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.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 re import sys import traceback @@ -41,18 +44,6 @@ import Hand from Exceptions import FpdbParseError 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 - import pygtk import gtk diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 49dc91cc..011b329c 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -22,6 +22,10 @@ Create and manage the hud overlays. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## + +import L10n +_ = L10n.get_translation() + # Standard Library modules import os import sys @@ -42,18 +46,6 @@ if os.name == 'nt': import win32con import win32api -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 Stats diff --git a/pyfpdb/ImapFetcher.py b/pyfpdb/ImapFetcher.py index 65936282..1d2068d7 100755 --- a/pyfpdb/ImapFetcher.py +++ b/pyfpdb/ImapFetcher.py @@ -19,6 +19,9 @@ #see http://docs.python.org/library/imaplib.html for the python interface #see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria +import L10n +_ = L10n.get_translation() + from imaplib import IMAP4, IMAP4_SSL import sys import codecs @@ -33,18 +36,6 @@ import PokerStarsSummary import FullTiltPokerSummary -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 splitPokerStarsSummaries(summaryText): #TODO: this needs to go to PSS.py re_SplitTourneys = PokerStarsSummary.PokerStarsSummary.re_SplitTourneys splitSummaries = re.split(re_SplitTourneys, summaryText) diff --git a/pyfpdb/iPokerToFpdb.py b/pyfpdb/iPokerToFpdb.py index b624737b..4766d72e 100644 --- a/pyfpdb/iPokerToFpdb.py +++ b/pyfpdb/iPokerToFpdb.py @@ -19,6 +19,9 @@ ######################################################################## +import L10n +_ = L10n.get_translation() + # This code is based on CarbonToFpdb.py by Matthew Boss # # TODO: @@ -45,18 +48,6 @@ import logging 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 - class iPoker(HandHistoryConverter): diff --git a/pyfpdb/interlocks.py b/pyfpdb/interlocks.py index 3f358019..c2e6abd6 100755 --- a/pyfpdb/interlocks.py +++ b/pyfpdb/interlocks.py @@ -3,6 +3,9 @@ # Code from http://ender.snowburst.org:4747/~jjohns/interlocks.py # Thanks JJ! +import L10n +_ = L10n.get_translation() + import sys import os, os.path import subprocess @@ -10,18 +13,6 @@ import time import signal import base64 -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 - InterProcessLock = None """