diff --git a/etg/app.py b/etg/app.py index 85a2254e..635c5df1 100644 --- a/etg/app.py +++ b/etg/app.py @@ -506,28 +506,25 @@ def run(): PyFunctionDef('InitLocale', '(self)', doc="""\ - Try to ensure that the C and Python locale is in sync with wxWidgets locale. + Try to ensure that the C and Python locale is in sync with + the wxWidgets locale on Windows. """, body="""\ self.ResetLocale() - import locale - try: - loc, enc = locale.getlocale() - except ValueError: - loc = enc = None - # Try to set it to the same language as what is already set in the C locale - info = wx.Locale.FindLanguageInfo(loc) if loc else None - if info: - self._initial_locale = wx.Locale(info.Language) - else: - # otherwise fall back to the system default - self._initial_locale = wx.Locale(wx.LANGUAGE_DEFAULT) + if 'wxMSW' in PlatformInfo: + import locale + try: + lang, enc = locale.getdefaultlocale() + self._initial_locale = wx.Locale(lang, lang[:2], lang) + locale.setlocale(locale.LC_ALL, lang) + except ValueError: + wx.LogError("Unable to set default locale.") """), PyFunctionDef('ResetLocale', '(self)', doc="""\ Release the wx.Locale object created in :meth:`InitLocale`. - This will reset the application's locale to the previous settings. + This should reset the application's locale to the previous settings. """, body="""\ self._initial_locale = None