diff --git a/src/DateHandler/_DateHandler.py b/src/DateHandler/_DateHandler.py index 37c072f24..2b2527394 100644 --- a/src/DateHandler/_DateHandler.py +++ b/src/DateHandler/_DateHandler.py @@ -47,13 +47,18 @@ log = logging.getLogger(".DateHandler") #------------------------------------------------------------------------- from _DateParser import DateParser from _DateDisplay import DateDisplay, DateDisplayEn +import constfunc #------------------------------------------------------------------------- # # 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 "LANG" in os.environ: LANG = os.environ["LANG"] diff --git a/src/GrampsLocale/_GrampsLocale.py b/src/GrampsLocale/_GrampsLocale.py index dafca49a0..5b34e7aee 100644 --- a/src/GrampsLocale/_GrampsLocale.py +++ b/src/GrampsLocale/_GrampsLocale.py @@ -21,6 +21,7 @@ # $Id$ import locale +import constfunc """ Some OS environments do not support the locale.nl_langinfo() method @@ -131,7 +132,10 @@ try: except: import time - codeset = locale.getpreferredencoding() + if constfunc.win(): + codeset = locale.getlocale()[1] + else: + codeset = locale.getpreferredencoding() month_to_int = { unicode(time.strftime('%B',(0,1,1,1,1,1,1,1,1)),codeset).lower() : 1, diff --git a/src/TransUtils.py b/src/TransUtils.py index 6ad88562b..4eb7f3ca8 100644 --- a/src/TransUtils.py +++ b/src/TransUtils.py @@ -47,6 +47,16 @@ import const # 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: LOCALEDIR = os.environ["GRAMPSI18N"] 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 """ + # 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" translated = "" + # 1. See if there is a intl.dll in Windows/system os_path = os.environ['PATH'] intl_path = 'c:\\WINDOWS\\system\\intl.dll' diff --git a/src/Utils.py b/src/Utils.py index 71f5dd6bb..fbc292d7d 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -470,6 +470,8 @@ def search_for(name): fname = os.path.join(i, name) if os.access(fname, os.X_OK) and not os.path.isdir(fname): return 1 + if os.access(name, os.X_OK) and not os.path.isdir(name): + return 1 else: for i in os.environ['PATH'].split(':'): fname = os.path.join(i, name) diff --git a/src/const.py.in b/src/const.py.in index f1ed81156..845538947 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -80,8 +80,13 @@ APP_VCARD = ["text/x-vcard", "text/x-vcalendar"] # system paths # #------------------------------------------------------------------------- -PREFIXDIR = "@prefix@" -SYSCONFDIR = "@sysconfdir@" +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@" + SYSCONFDIR = "@sysconfdir@" #------------------------------------------------------------------------- #