4532: Patch for Windows (by josip)

svn: r16386
This commit is contained in:
Jérôme Rapinat 2011-01-15 09:43:34 +00:00
parent 51f239f53b
commit 5c8a3f7488
5 changed files with 37 additions and 4 deletions

View File

@ -47,13 +47,18 @@ log = logging.getLogger(".DateHandler")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from _DateParser import DateParser from _DateParser import DateParser
from _DateDisplay import DateDisplay, DateDisplayEn from _DateDisplay import DateDisplay, DateDisplayEn
import constfunc
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
if not constfunc.win():
LANG = locale.getlocale(locale.LC_TIME)[0] LANG = locale.getlocale(locale.LC_TIME)[0]
else:
LANG = locale.getdefaultlocale(locale.LC_TIME)[0]
if not LANG: if not LANG:
if "LANG" in os.environ: if "LANG" in os.environ:
LANG = os.environ["LANG"] LANG = os.environ["LANG"]

View File

@ -21,6 +21,7 @@
# $Id$ # $Id$
import locale import locale
import constfunc
""" """
Some OS environments do not support the locale.nl_langinfo() method Some OS environments do not support the locale.nl_langinfo() method
@ -131,6 +132,9 @@ try:
except: except:
import time import time
if constfunc.win():
codeset = locale.getlocale()[1]
else:
codeset = locale.getpreferredencoding() codeset = locale.getpreferredencoding()
month_to_int = { month_to_int = {

View File

@ -47,6 +47,16 @@ import const
# Public Constants # Public Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
lang = ' '
try:
lang = os.environ["LANG"]
except:
lang = locale.getlocale()[0]
if not lang:
lang = '.'.join((locale.getdefaultlocale()[0], 'utf-8'))
os.environ["LANG"] = lang
os.environ["LANGUAGE"] = lang
if "GRAMPSI18N" in os.environ: if "GRAMPSI18N" in os.environ:
LOCALEDIR = os.environ["GRAMPSI18N"] LOCALEDIR = os.environ["GRAMPSI18N"]
elif os.path.exists( os.path.join(const.ROOT_DIR, "lang") ): elif os.path.exists( os.path.join(const.ROOT_DIR, "lang") ):
@ -142,8 +152,15 @@ def setup_windows_gettext():
"libintlX-X.dll" which in recent gettext version would be libintl-8.dll "libintlX-X.dll" which in recent gettext version would be libintl-8.dll
""" """
# 0. See if there is a libintl-8.dll in working directory
intl_path = os.path.join(os.getcwd(), 'libintl-8.dll')
if os.path.isfile(intl_path) and not LOCALEDIR is None:
libintl = init_windows_gettext(intl_path)
return
str2translate = "Family Trees - Gramps" str2translate = "Family Trees - Gramps"
translated = "" translated = ""
# 1. See if there is a intl.dll in Windows/system # 1. See if there is a intl.dll in Windows/system
os_path = os.environ['PATH'] os_path = os.environ['PATH']
intl_path = 'c:\\WINDOWS\\system\\intl.dll' intl_path = 'c:\\WINDOWS\\system\\intl.dll'

View File

@ -470,6 +470,8 @@ def search_for(name):
fname = os.path.join(i, name) fname = os.path.join(i, name)
if os.access(fname, os.X_OK) and not os.path.isdir(fname): if os.access(fname, os.X_OK) and not os.path.isdir(fname):
return 1 return 1
if os.access(name, os.X_OK) and not os.path.isdir(name):
return 1
else: else:
for i in os.environ['PATH'].split(':'): for i in os.environ['PATH'].split(':'):
fname = os.path.join(i, name) fname = os.path.join(i, name)

View File

@ -80,6 +80,11 @@ APP_VCARD = ["text/x-vcard", "text/x-vcalendar"]
# system paths # system paths
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
if sys.platform == "win32":
if sys.prefix == os.path.dirname(os.getcwd()):
PREFIXDIR = sys.prefix
SYSCONFDIR = os.path.join(sys.prefix, "etc")
else:
PREFIXDIR = "@prefix@" PREFIXDIR = "@prefix@"
SYSCONFDIR = "@sysconfdir@" SYSCONFDIR = "@sysconfdir@"