From 1b15e665e0b9c5ff8a854d76ecd3a90c37d4c7df Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 22 Sep 2010 23:51:56 +0800 Subject: [PATCH] L10n update - Absolute->Config --- pyfpdb/AbsoluteToFpdb.py | 15 +++------------ pyfpdb/Anonymise.py | 14 +++----------- pyfpdb/BetfairToFpdb.py | 15 +++------------ pyfpdb/CarbonToFpdb.py | 15 +++------------ pyfpdb/Configuration.py | 15 +++------------ 5 files changed, 15 insertions(+), 59 deletions(-) diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py index 145a0971..6b57b1e4 100755 --- a/pyfpdb/AbsoluteToFpdb.py +++ b/pyfpdb/AbsoluteToFpdb.py @@ -18,23 +18,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## +import L10n +_ = L10n.get_translation() + # TODO: I have no idea if AP has multi-currency options, i just copied the regex out of Everleaf converter for the currency symbols.. weeeeee - Eric import sys import logging 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 for converting Absolute HH format. class Absolute(HandHistoryConverter): diff --git a/pyfpdb/Anonymise.py b/pyfpdb/Anonymise.py index 3281fa3f..ffaa6e70 100755 --- a/pyfpdb/Anonymise.py +++ b/pyfpdb/Anonymise.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 os import re import codecs @@ -23,17 +26,6 @@ import HandHistoryConverter import Configuration import sys -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 (options, argv) = Options.fpdb_options() config = Configuration.Config() diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py index c26cda26..38aa6dc1 100755 --- a/pyfpdb/BetfairToFpdb.py +++ b/pyfpdb/BetfairToFpdb.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 logging 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 - # Betfair HH format class Betfair(HandHistoryConverter): diff --git a/pyfpdb/CarbonToFpdb.py b/pyfpdb/CarbonToFpdb.py index 04b420b2..cf8794da 100644 --- a/pyfpdb/CarbonToFpdb.py +++ b/pyfpdb/CarbonToFpdb.py @@ -19,6 +19,9 @@ ######################################################################## +import L10n +_ = L10n.get_translation() + # This code is based heavily on EverleafToFpdb.py, by Carl Gherardi # # TODO: @@ -52,18 +55,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 Carbon(HandHistoryConverter): diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 51d04b57..20f99893 100644 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -23,6 +23,9 @@ Handles HUD configuration files. ######################################################################## +import L10n +_ = L10n.get_translation() + # Standard Library modules from __future__ import with_statement import os @@ -36,18 +39,6 @@ import re import xml.dom.minidom 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 ConfigParser