Bug 7036: [Win32]Setting LANG crashes Gramps

Also fixes Bug 6919: No automatic language selection in Windows
Thanks to Helge Herz.

svn: r23011
This commit is contained in:
John Ralls 2013-09-03 17:39:04 +00:00
parent 6422964a40
commit 8c331a5d92

View File

@ -105,11 +105,11 @@ _LOCALE_NAMES = {
def _check_mswin_locale(locale):
msloc = None
try:
msloc = _LOCALE_NAMES[locale[:5]]
msloc = _LOCALE_NAMES[locale[:5]][:2]
locale = locale[:5]
except KeyError:
try:
msloc = _LOCALE_NAMES[locale[:2]]
msloc = _LOCALE_NAMES[locale[:2]][:2]
locale = locale[:2]
except KeyError:
return (None, None)
@ -196,7 +196,7 @@ class GrampsLocale(object):
locale.setlocale(locale.LC_ALL, '')
(lang, encoding) = locale.getlocale()
loc = _check_mswin_locale_reverse(lang)
if loc:
if loc[0]:
self.lang = loc[0]
self.encoding = loc[1]
else: