4532: Patch for Windows (by josip)
svn: r16386
This commit is contained in:
		| @@ -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"] | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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' | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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@" | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
|   | ||||
		Reference in New Issue
	
	Block a user