Commit 8a5a35059d9482f13d32152437fc9e44bd12c586
1 parent
a9f1e82f
Exists in
master
Handling locale setting error
Showing
2 changed files
with
9 additions
and
3 deletions
Show diff stats
app.py
... | ... | @@ -178,7 +178,10 @@ class SplashScreen(wx.SplashScreen): |
178 | 178 | if lang: |
179 | 179 | # print "LANG", lang, _, wx.Locale(), wx.GetLocale() |
180 | 180 | import locale |
181 | - locale.setlocale(locale.LC_ALL, '') | |
181 | + try: | |
182 | + locale.setlocale(locale.LC_ALL, '') | |
183 | + except locale.Error: | |
184 | + pass | |
182 | 185 | # For pt_BR, splash_pt.png should be used |
183 | 186 | if (lang.startswith('pt')): |
184 | 187 | icon_file = "splash_pt.png" | ... | ... |
invesalius/gui/language_dialog.py
... | ... | @@ -56,7 +56,10 @@ class ComboBoxLanguage: |
56 | 56 | # Find out OS locale |
57 | 57 | self.os_locale = i18n.GetLocaleOS() |
58 | 58 | |
59 | - os_lang = self.os_locale[0:2] | |
59 | + try: | |
60 | + os_lang = self.os_locale[0:2] | |
61 | + except TypeError: | |
62 | + os_lang = None | |
60 | 63 | |
61 | 64 | # Default selection will be English |
62 | 65 | selection = self.locales_key.index('en') |
... | ... | @@ -70,7 +73,7 @@ class ComboBoxLanguage: |
70 | 73 | # Add bitmap and info to Combo |
71 | 74 | bitmapCmb.Append(dict_locales[key], bmp, key) |
72 | 75 | # Set default combo item if available on the list |
73 | - if key.startswith(os_lang): | |
76 | + if os_lang and key.startswith(os_lang): | |
74 | 77 | selection = self.locales_key.index(key) |
75 | 78 | bitmapCmb.SetSelection(selection) |
76 | 79 | ... | ... |