1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Get rid of gettext in init.

This commit is contained in:
Shlomi Fish 2012-11-25 19:43:46 +02:00
parent 924f39db97
commit 5dc2edda91
94 changed files with 96 additions and 36 deletions

View file

@ -44,6 +44,7 @@ from pysollib.pysoltk import ProgressionDialog
from pysollib.pysoltk import GameInfoDialog
# toolkit imports
from pysollib.mygettext import _, n_
from pysollib.pysoltk import MfxMessageDialog, MfxSimpleEntry
from pysollib.pysoltk import MfxExceptionDialog
from pysollib.pysoltk import PlayerOptionsDialog

View file

@ -47,6 +47,7 @@ from pysollib.settings import DEBUG
from pysollib.winsystems import TkSettings
# Toolkit imports
from pysollib.mygettext import _, n_
from pysollib.pysoltk import wm_withdraw, loadImage
from pysollib.pysoltk import MfxDialog, MfxMessageDialog, MfxExceptionDialog
from pysollib.pysoltk import TclError, MfxScrolledCanvas

View file

@ -26,6 +26,7 @@ __all__ = []
# imports
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys, math
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -26,6 +26,7 @@ __all__ = []
# imports
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys, types
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault, Struct

View file

@ -26,6 +26,7 @@ __all__ = []
# imports
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -30,6 +30,7 @@ import time
from gettext import ungettext
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault, Struct, Image

View file

@ -29,6 +29,7 @@ import sys
from gettext import ungettext
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys, time
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -26,6 +26,7 @@ __all__ = []
# imports
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -26,6 +26,7 @@ __all__ = []
# Imports
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -26,7 +26,9 @@ __all__ = []
# Imports
import sys, math, time
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys, math
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -52,6 +52,7 @@ __all__ = [
import sys, math
from pysollib.mygettext import _, n_
from pysollib.util import *
from pysollib.mfxutil import kwdefault
from pysollib.stack import *

View file

@ -27,6 +27,7 @@ __all__ = []
import sys, math
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys, math
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -27,6 +27,7 @@ __all__ = []
import sys
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault

View file

@ -25,6 +25,7 @@
# imports
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.settings import TITLE, PACKAGE_URL, TOOLKIT, VERSION
from pysollib.pysoltk import make_help_toplevel
from pysollib.pysoltk import MfxMessageDialog

View file

@ -23,48 +23,17 @@
import sys, os, locale, subprocess
import traceback
import gettext
from pysollib.mygettext import _, n_
import gettext
import pysollib.settings
# ************************************************************************
# * init
# ************************************************************************
def fix_gettext():
def ugettext(message):
# unicoded gettext
if not isinstance(message, unicode):
message = unicode(message, 'utf-8')
domain = gettext._current_domain
try:
t = gettext.translation(domain,
gettext._localedirs.get(domain, None))
except IOError:
return message
return t.ugettext(message)
gettext.ugettext = ugettext
def ungettext(msgid1, msgid2, n):
# unicoded ngettext
if not isinstance(msgid1, unicode):
msgid1 = unicode(msgid1, 'utf-8')
if not isinstance(msgid2, unicode):
msgid2 = unicode(msgid2, 'utf-8')
domain = gettext._current_domain
try:
t = gettext.translation(domain,
gettext._localedirs.get(domain, None))
except IOError:
if n == 1:
return msgid1
else:
return msgid2
return t.ungettext(msgid1, msgid2, n)
gettext.ungettext = ungettext
def init():
fix_gettext()
if os.name == 'nt' and 'LANG' not in os.environ:
try:
@ -88,9 +57,6 @@ def init():
#gettext.install('pysol', locale_dir, unicode=True) # ngettext don't work
gettext.bindtextdomain('pysol', locale_dir)
gettext.textdomain('pysol')
import __builtin__
__builtin__._ = gettext.ugettext # use unicode
__builtin__.n_ = lambda x: x
## debug
if 'PYSOL_CHECK_GAMES' in os.environ or 'PYSOL_DEBUG' in os.environ:

View file

@ -28,6 +28,7 @@ import traceback
import getopt
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.util import DataLoader
from pysollib.mfxutil import print_err
from pysollib.resource import Tile

View file

@ -34,6 +34,7 @@ import pysollib.settings
# Toolkit imports
from pysollib.pysoltk import TOOLBAR_BUTTONS
from pysollib.mygettext import _, n_
# ************************************************************************
# * Options

View file

@ -24,6 +24,7 @@
__all__ = ['ColorsDialog']
# imports
from pysollib.mygettext import _, n_
## import os, sys
import gtk, gobject, pango
import gtk.glade

View file

@ -30,6 +30,7 @@ import gtk, gobject, pango
import gtk.glade
# PySol imports
from pysollib.mygettext import _, n_
from tkutil import create_pango_font_desc

View file

@ -29,6 +29,7 @@ import gtk
from gtk import gdk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.gamedb import GI
from pysollib.settings import TITLE

View file

@ -27,6 +27,7 @@ __all__ = ['PlayerOptionsDialog']
import gobject, gtk
# PySol imports
from pysollib.mygettext import _, n_
# Toolkit imports
from tkwidget import MfxDialog

View file

@ -27,6 +27,7 @@ import os, re, sys, types
import gtk, gobject
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.resource import CSI
from pysollib.mfxutil import kwdefault

View file

@ -29,6 +29,7 @@ import gtk, gobject
#from UserList import UserList
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct, Struct, KwStruct
from pysollib.mfxutil import kwdefault
from pysollib.mfxutil import format_time

View file

@ -30,6 +30,7 @@ from gtk import gdk
# PySol imports
## from pysollib.mfxutil import destruct, Struct, KwStruct
from pysollib.mygettext import _, n_
from pysollib.resource import CSI
from pysollib.mfxutil import kwdefault

View file

@ -28,6 +28,7 @@ import gtk
from gtk import glade
# PySol imports
from pysollib.mygettext import _, n_
# Toolkit imports
from tkwidget import MfxDialog

View file

@ -27,6 +27,7 @@ import os, sys
import gtk
# PySol imports
from pysollib.mygettext import _, n_
# ************************************************************************

View file

@ -25,6 +25,7 @@ __all__ = ['TimeoutsDialog']
# imports
## import os, sys
from pysollib.mygettext import _, n_
import gtk, gobject, pango
import gtk.glade

View file

@ -27,6 +27,7 @@ __all__ = ['HTMLViewer']
import os, sys, re, types
import htmllib, formatter
import traceback
from pysollib.mygettext import _, n_
import gtk, pango, gobject
from gtk import gdk

View file

@ -28,6 +28,7 @@ import gtk, gobject, pango
import gtk.glade
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import format_time
from pysollib.settings import TOP_TITLE, TITLE
from pysollib.stats import PysolStatsFormatter

View file

@ -29,6 +29,7 @@ import gtk
gdk = gtk.gdk
# PySol imports
from pysollib.mygettext import _, n_
# Toolkit imports
from tkutil import makeToplevel, setTransient, wm_withdraw

View file

@ -25,6 +25,7 @@
# imports
import sys, re, time
import random
from pysollib.mygettext import _, n_
from pysollib.mfxutil import SubclassResponsibility

View file

@ -28,6 +28,7 @@ import time
# PySol imports
from pysollib.mfxutil import format_time
from pysollib.gamedb import GI
from pysollib.mygettext import _, n_
# ************************************************************************

View file

@ -30,6 +30,7 @@ from tkColorChooser import askcolor
# PySol imports
from pysollib.mfxutil import KwStruct
from pysollib.mygettext import _, n_
# Toolkit imports
from tkwidget import MfxDialog

View file

@ -29,6 +29,7 @@ import ttk
# PySol imports
from pysollib.mfxutil import KwStruct
from pysollib.mygettext import _, n_
# Toolkit imports
from tkwidget import MfxDialog

View file

@ -29,6 +29,7 @@ __all__ = ['create_find_card_dialog',
# imports
import os
import Tkinter
from pysollib.mygettext import _, n_
# Toolkit imports
from tkutil import after, after_cancel

View file

@ -30,6 +30,7 @@ import tkFont
# PySol imports
from pysollib.mfxutil import KwStruct
from pysollib.mygettext import _, n_
# Toolkit imports
from tkwidget import MfxDialog

View file

@ -28,6 +28,7 @@ __all__ = ['GameInfoDialog']
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.gamedb import GI

View file

@ -30,6 +30,7 @@ import ttk
import tkFileDialog
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import Struct, kwdefault
from pysollib.mfxutil import Image, USE_PIL
from pysollib.util import CARDSET

View file

@ -28,6 +28,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -30,6 +30,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct, USE_PIL
from pysollib.util import CARDSET
from pysollib.resource import CSI

View file

@ -28,6 +28,7 @@ import ttk
from UserList import UserList
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct, Struct, KwStruct
from pysollib.mfxutil import format_time
from pysollib.gamedb import GI

View file

@ -28,6 +28,7 @@ import ttk
import tkColorChooser
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -34,6 +34,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.settings import TITLE
from pysollib.mfxutil import KwStruct

View file

@ -29,6 +29,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.settings import TITLE
from pysollib.pysolaudio import pysolsoundserver

View file

@ -29,6 +29,7 @@ import os, sys
import Tkinter
import ttk
from pysollib.mygettext import _, n_
if __name__ == '__main__':
d = os.path.abspath(os.path.join(sys.path[0], os.pardir, os.pardir))
sys.path.append(d)

View file

@ -28,6 +28,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -36,6 +36,7 @@ if __name__ == '__main__':
gettext.install('pysol', d, unicode=True)
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import Struct, openURL
from pysollib.settings import TITLE

View file

@ -38,6 +38,7 @@ import ttk
import tkFont
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.mfxutil import format_time
##from pysollib.util import *

View file

@ -39,6 +39,7 @@ import tkFont
import traceback
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct, kwdefault, KwStruct, openURL
from pysollib.settings import WIN_SYSTEM

View file

@ -29,6 +29,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct
from pysollib.mfxutil import Image, ImageTk, ImageOps
from pysollib.util import IMAGE_EXTENSIONS

View file

@ -26,6 +26,7 @@ __all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
"tclobjs_to_py"]
import Tkinter
from pysollib.mygettext import _, n_
_flatten = Tkinter._flatten

View file

@ -29,6 +29,7 @@ import Tkinter
import ttk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.wizardutil import WizardWidgets
from pysollib.wizardpresets import presets

View file

@ -28,6 +28,7 @@ import Tkinter
from tkColorChooser import askcolor
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -27,6 +27,7 @@ __all__ = ['EditTextDialog']
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -32,6 +32,7 @@ import Tkinter
##import traceback
# PySol imports
from pysollib.mygettext import _, n_
# Toolkit imports
from tkutil import after, after_cancel

View file

@ -28,6 +28,7 @@ import Tkinter
import tkFont
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -28,6 +28,7 @@ __all__ = ['GameInfoDialog']
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.gamedb import GI

View file

@ -29,6 +29,7 @@ import traceback
import Tkinter, tkFileDialog
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import Struct, kwdefault
from pysollib.mfxutil import Image, USE_PIL
from pysollib.util import CARDSET

View file

@ -27,6 +27,7 @@ __all__ = ['PlayerOptionsDialog']
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct, Struct
# Toolkit imports

View file

@ -28,6 +28,7 @@ import os
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct, USE_PIL
from pysollib.util import CARDSET
from pysollib.resource import CSI

View file

@ -28,6 +28,7 @@ import Tkinter
from UserList import UserList
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct, Struct, KwStruct
from pysollib.mfxutil import format_time
from pysollib.gamedb import GI

View file

@ -26,6 +26,7 @@
import Tkinter, tkColorChooser
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -34,6 +34,7 @@ import Tkinter
##import traceback
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.settings import TITLE

View file

@ -28,6 +28,7 @@ import os
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.settings import TITLE
from pysollib.pysolaudio import pysolsoundserver

View file

@ -34,6 +34,7 @@ if __name__ == '__main__':
gettext.install('pysol', d, unicode=True)
# PySol imports
from pysollib.mygettext import _, n_
# Toolkit imports
from tkwidget import MfxTooltip

View file

@ -27,6 +27,7 @@ __all__ = ['TimeoutsDialog']
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
# Toolkit imports

View file

@ -35,6 +35,7 @@ if __name__ == '__main__':
gettext.install('pysol', d, unicode=True)
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import Struct, openURL
from pysollib.settings import TITLE

View file

@ -36,6 +36,7 @@ import time
import Tkinter, tkFont
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import kwdefault, KwStruct
from pysollib.mfxutil import format_time
##from pysollib.util import *

View file

@ -38,6 +38,7 @@ import tkFont
import traceback
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct, kwdefault, KwStruct, openURL
from pysollib.settings import WIN_SYSTEM

View file

@ -28,6 +28,7 @@ import os
import Tkinter
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import destruct
from pysollib.mfxutil import Image, ImageTk
from pysollib.util import IMAGE_EXTENSIONS

View file

@ -29,6 +29,7 @@ import Tkinter
from tabpage import TabPageSet
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mfxutil import KwStruct
from pysollib.wizardutil import WizardWidgets
from pysollib.wizardpresets import presets

View file

@ -23,6 +23,7 @@
import sys, os, traceback
from pysollib.mygettext import _, n_
from pysollib.settings import TITLE
from pysollib.settings import VERSION
from pysollib.settings import TOOLKIT, USE_TILE