auto-detect language

This commit is contained in:
steffen123 2010-08-15 20:50:49 +02:00
parent 21211a7669
commit b4317bba2a
14 changed files with 156 additions and 39 deletions

View File

@ -23,9 +23,18 @@ import HandHistoryConverter
import Configuration import Configuration
import sys import sys
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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() (options, argv) = Options.fpdb_options()
config = Configuration.Config() config = Configuration.Config()

View File

@ -22,9 +22,18 @@ import sys
import logging import logging
from HandHistoryConverter import * from HandHistoryConverter import *
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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 # Betfair HH format

View File

@ -15,9 +15,18 @@
#along with this program. If not, see <http://www.gnu.org/licenses/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in agpl-3.0.txt. #In the "official" distribution you can find the license in agpl-3.0.txt.
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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 fpdb_simple # From fpdb_simple
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8, card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,

View File

@ -33,9 +33,18 @@ import fpdb_import
import Configuration import Configuration
import Exceptions import Exceptions
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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 GuiBulkImport(): class GuiBulkImport():

View File

@ -35,9 +35,18 @@ import Exceptions
import Database import Database
import SQL import SQL
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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: class GuiDatabase:

View File

@ -30,9 +30,18 @@ import logging
# logging has been set up in fpdb.py or HUD_main.py, use their settings: # logging has been set up in fpdb.py or HUD_main.py, use their settings:
log = logging.getLogger("logview") log = logging.getLogger("logview")
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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 MAX_LINES = 100000 # max lines to display in window
EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file

View File

@ -60,9 +60,18 @@ elif os.name == 'nt':
#import Tables #import Tables
import Hud import Hud
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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 config and set up logger # get config and set up logger
c = Configuration.Config(file=options.config, dbname=options.dbname) c = Configuration.Config(file=options.config, dbname=options.dbname)

View File

@ -41,9 +41,18 @@ import Hand
from Exceptions import FpdbParseError from Exceptions import FpdbParseError
import Configuration import Configuration
#import gettext import locale
#trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
#trans.install() print "lang:", lang
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 pygtk
import gtk import gtk

View File

@ -22,9 +22,18 @@
from imaplib import IMAP4, IMAP4_SSL from imaplib import IMAP4, IMAP4_SSL
import PokerStarsSummary import PokerStarsSummary
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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(emailText): def splitPokerStarsSummaries(emailText):
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:] splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]

View File

@ -19,9 +19,18 @@ import sys
from optparse import OptionParser from optparse import OptionParser
# http://docs.python.org/library/optparse.html # http://docs.python.org/library/optparse.html
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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(): def fpdb_options():

View File

@ -36,9 +36,18 @@ import gobject
import Configuration import Configuration
from HandHistoryConverter import getTableTitleRe from HandHistoryConverter import getTableTitleRe
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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 # get the correct module for the current os
if os.name == 'posix': if os.name == 'posix':

View File

@ -20,9 +20,18 @@ import sys
import re import re
import Queue import Queue
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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: # if path is set to use an old version of python look for a new one:
# (does this work in linux?) # (does this work in linux?)

View File

@ -17,9 +17,18 @@
# create .bat scripts in windows to try out different gtk dirs # create .bat scripts in windows to try out different gtk dirs
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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
try: try: