From 016172f78da12d3e83f98a7203b5bdc5d05c745f Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 23 Sep 2010 13:11:06 +0800 Subject: [PATCH] L10n update: Gui* --- pyfpdb/GuiAutoImport.py | 15 +++------------ pyfpdb/GuiDatabase.py | 16 +++------------- pyfpdb/GuiGraphViewer.py | 15 +++------------ pyfpdb/GuiImapFetcher.py | 15 +++------------ pyfpdb/GuiLogView.py | 15 +++------------ pyfpdb/GuiRingPlayerStats.py | 15 +++------------ pyfpdb/GuiSessionViewer.py | 15 +++------------ pyfpdb/GuiTourneyGraphViewer.py | 15 +++------------ pyfpdb/GuiTourneyPlayerStats.py | 15 +++------------ pyfpdb/GuiTourneyViewer.py | 15 +++------------ 10 files changed, 30 insertions(+), 121 deletions(-) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index 2f595fed..c603ab8b 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.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 subprocess import traceback @@ -37,18 +40,6 @@ from optparse import OptionParser import Configuration import string -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 GuiAutoImport (threading.Thread): def __init__(self, settings, config, sql, parent): self.importtimer = 0 diff --git a/pyfpdb/GuiDatabase.py b/pyfpdb/GuiDatabase.py index d6eaf14f..f77bcd74 100755 --- a/pyfpdb/GuiDatabase.py +++ b/pyfpdb/GuiDatabase.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 sys import traceback @@ -31,24 +34,11 @@ import logging # logging has been set up in fpdb.py or HUD_main.py, use their settings: log = logging.getLogger("maintdbs") - import Exceptions import Configuration import Database import SQL -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 GuiDatabase: # columns in liststore: diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index b82cf7a8..e43657c8 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.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') @@ -26,18 +29,6 @@ from time import * from datetime import datetime #import pokereval -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 fpdb_import import Database import Filters diff --git a/pyfpdb/GuiImapFetcher.py b/pyfpdb/GuiImapFetcher.py index 7294086a..c312e17e 100644 --- a/pyfpdb/GuiImapFetcher.py +++ b/pyfpdb/GuiImapFetcher.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') @@ -22,18 +25,6 @@ import gtk from imaplib import IMAP4 from socket import gaierror -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 ImapFetcher class GuiImapFetcher (threading.Thread): diff --git a/pyfpdb/GuiLogView.py b/pyfpdb/GuiLogView.py index f42db9e2..f28933a2 100755 --- a/pyfpdb/GuiLogView.py +++ b/pyfpdb/GuiLogView.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 Queue @@ -30,18 +33,6 @@ import logging # logging has been set up in fpdb.py or HUD_main.py, use their settings: log = logging.getLogger("logview") -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 - MAX_LINES = 100000 # max lines to display in window EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file LOGFILES = [ [ 'Fpdb Errors', 'fpdb-errors.txt', False ] # label, filename, start value diff --git a/pyfpdb/GuiRingPlayerStats.py b/pyfpdb/GuiRingPlayerStats.py index ef519290..d94581cf 100644 --- a/pyfpdb/GuiRingPlayerStats.py +++ b/pyfpdb/GuiRingPlayerStats.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 traceback import threading import pygtk @@ -24,18 +27,6 @@ import os import sys from time import time, strftime -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 Card import fpdb_import import Database diff --git a/pyfpdb/GuiSessionViewer.py b/pyfpdb/GuiSessionViewer.py index d4ffaccc..53360680 100755 --- a/pyfpdb/GuiSessionViewer.py +++ b/pyfpdb/GuiSessionViewer.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 sys import threading import pygtk @@ -41,18 +44,6 @@ except ImportError, inst: print _("""Failed to load numpy and/or matplotlib in Session Viewer""") print _("ImportError: %s") % inst.args -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 Card import fpdb_import import Database diff --git a/pyfpdb/GuiTourneyGraphViewer.py b/pyfpdb/GuiTourneyGraphViewer.py index 877cdea8..a1a5cc7d 100644 --- a/pyfpdb/GuiTourneyGraphViewer.py +++ b/pyfpdb/GuiTourneyGraphViewer.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') @@ -26,18 +29,6 @@ from time import * from datetime import datetime #import pokereval -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 fpdb_import import Database import Filters diff --git a/pyfpdb/GuiTourneyPlayerStats.py b/pyfpdb/GuiTourneyPlayerStats.py index 0b90c9b3..ef6c0f66 100644 --- a/pyfpdb/GuiTourneyPlayerStats.py +++ b/pyfpdb/GuiTourneyPlayerStats.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 traceback import threading import pygtk @@ -24,18 +27,6 @@ import gtk #import sys from time import time, strftime -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 Card #import fpdb_import #import Database diff --git a/pyfpdb/GuiTourneyViewer.py b/pyfpdb/GuiTourneyViewer.py index 3c1dd53b..eee83197 100644 --- a/pyfpdb/GuiTourneyViewer.py +++ b/pyfpdb/GuiTourneyViewer.py @@ -15,23 +15,14 @@ #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') 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 - class GuiTourneyViewer (threading.Thread): def __init__(self, config, db, sql, mainwin, debug=True): self.db = db