From f088797e9fb5bda60f249fd296682fbcd644980b Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 3 Sep 2013 17:44:14 +0000 Subject: [PATCH] [r23011]Bug 7036: [Win32]Setting LANG crashes Gramps Also fixes Bug 6919: No automatic language selection in Windows Thanks to Helge Herz. svn: r23012 --- gramps/gen/utils/grampslocale.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 96f7b7db9..f28d2ae26 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -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) @@ -195,7 +195,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: