auto-detect language
This commit is contained in:
parent
21211a7669
commit
b4317bba2a
|
@ -23,9 +23,18 @@ import HandHistoryConverter
|
|||
import Configuration
|
||||
import sys
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
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()
|
||||
|
|
|
@ -22,9 +22,18 @@ import sys
|
|||
import logging
|
||||
from HandHistoryConverter import *
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
# Betfair HH format
|
||||
|
||||
|
|
|
@ -15,9 +15,18 @@
|
|||
#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.
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
# From fpdb_simple
|
||||
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,
|
||||
|
|
|
@ -33,9 +33,18 @@ import fpdb_import
|
|||
import Configuration
|
||||
import Exceptions
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
class GuiBulkImport():
|
||||
|
||||
|
|
|
@ -35,9 +35,18 @@ import Exceptions
|
|||
import Database
|
||||
import SQL
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
class GuiDatabase:
|
||||
|
||||
|
|
|
@ -30,9 +30,18 @@ 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]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
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
|
||||
|
|
|
@ -60,9 +60,18 @@ elif os.name == 'nt':
|
|||
#import Tables
|
||||
import Hud
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
# get config and set up logger
|
||||
c = Configuration.Config(file=options.config, dbname=options.dbname)
|
||||
|
|
|
@ -41,9 +41,18 @@ import Hand
|
|||
from Exceptions import FpdbParseError
|
||||
import Configuration
|
||||
|
||||
#import gettext
|
||||
#trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
#trans.install()
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
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 gtk
|
||||
|
|
|
@ -22,9 +22,18 @@
|
|||
from imaplib import IMAP4, IMAP4_SSL
|
||||
import PokerStarsSummary
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
def splitPokerStarsSummaries(emailText):
|
||||
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
|
||||
|
|
|
@ -19,9 +19,18 @@ import sys
|
|||
from optparse import OptionParser
|
||||
# http://docs.python.org/library/optparse.html
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
def fpdb_options():
|
||||
|
||||
|
|
|
@ -36,9 +36,18 @@ import gobject
|
|||
import Configuration
|
||||
from HandHistoryConverter import getTableTitleRe
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
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
|
||||
if os.name == 'posix':
|
||||
|
|
|
@ -20,9 +20,18 @@ import sys
|
|||
import re
|
||||
import Queue
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
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?)
|
||||
|
|
|
@ -17,9 +17,18 @@
|
|||
|
||||
# create .bat scripts in windows to try out different gtk dirs
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
print "lang:", lang
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"])
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
try:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user