diff --git a/pyfpdb/Card.py b/pyfpdb/Card.py index 0496b47f..1a8b12e8 100755 --- a/pyfpdb/Card.py +++ b/pyfpdb/Card.py @@ -15,17 +15,8 @@ #along with this program. If not, see . #In the "official" distribution you can find the license in agpl-3.0.txt. -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 L10n +_ = L10n.get_translation() # From fpdb_simple card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8, diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 20480221..870a2743 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -20,6 +20,9 @@ Create and manage the database objects. # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +import L10n +_ = L10n.get_translation() + ######################################################################## # TODO: - rebuild indexes / vacuum option @@ -46,18 +49,6 @@ import logging # logging has been set up in fpdb.py or HUD_main.py, use their settings: log = logging.getLogger("db") -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 SQL import Card diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 1b27c555..22977a26 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.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 - # Class for converting Everleaf HH format. class Everleaf(HandHistoryConverter): diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 136c0ab6..a4afb24a 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.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') @@ -30,18 +33,6 @@ 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/FullTiltPokerSummary.py b/pyfpdb/FullTiltPokerSummary.py index 4c141b95..ba8b85cb 100644 --- a/pyfpdb/FullTiltPokerSummary.py +++ b/pyfpdb/FullTiltPokerSummary.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 FullTiltPokerSummary(TourneySummary): limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' } games = { # base, category diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 129dc5a7..7c964564 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -18,17 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## -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 L10n +_ = L10n.get_translation() import logging from HandHistoryConverter import * diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 548003de..c81b7f16 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -23,18 +23,6 @@ import sys import re import Queue -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 path is set to use an old version of python look for a new one: # (does this work in linux?) if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6', '2.7') and '-r' not in sys.argv: diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 65de8181..cea95321 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.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() + # Standard Library modules import os # todo: remove this once import_dir is in fpdb_import @@ -35,18 +38,6 @@ log = logging.getLogger("importer") import pygtk import gtk -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 - # fpdb/FreePokerTools modules import Database import Configuration