4532: Patch for Windows (by josip)
svn: r16386
This commit is contained in:
parent
51f239f53b
commit
5c8a3f7488
@ -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
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
LANG = locale.getlocale(locale.LC_TIME)[0]
|
if not constfunc.win():
|
||||||
|
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"]
|
||||||
|
@ -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,7 +132,10 @@ try:
|
|||||||
except:
|
except:
|
||||||
import time
|
import time
|
||||||
|
|
||||||
codeset = locale.getpreferredencoding()
|
if constfunc.win():
|
||||||
|
codeset = locale.getlocale()[1]
|
||||||
|
else:
|
||||||
|
codeset = locale.getpreferredencoding()
|
||||||
|
|
||||||
month_to_int = {
|
month_to_int = {
|
||||||
unicode(time.strftime('%B',(0,1,1,1,1,1,1,1,1)),codeset).lower() : 1,
|
unicode(time.strftime('%B',(0,1,1,1,1,1,1,1,1)),codeset).lower() : 1,
|
||||||
|
@ -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'
|
||||||
|
@ -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)
|
||||||
|
@ -80,8 +80,13 @@ APP_VCARD = ["text/x-vcard", "text/x-vcalendar"]
|
|||||||
# system paths
|
# system paths
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
PREFIXDIR = "@prefix@"
|
if sys.platform == "win32":
|
||||||
SYSCONFDIR = "@sysconfdir@"
|
if sys.prefix == os.path.dirname(os.getcwd()):
|
||||||
|
PREFIXDIR = sys.prefix
|
||||||
|
SYSCONFDIR = os.path.join(sys.prefix, "etc")
|
||||||
|
else:
|
||||||
|
PREFIXDIR = "@prefix@"
|
||||||
|
SYSCONFDIR = "@sysconfdir@"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user