Skip to content

Commit 3b59811

Browse files
committed
Added fallback to en_US locale for wxWidgets.
- Fixes #493
1 parent 838de14 commit 3b59811

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

kicost/kicost_gui.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,18 @@ def kicost_gui(files=None):
11651165
'''
11661166
app = wx.App(redirect=False)
11671167
loc = wx.Locale(wx.LANGUAGE_DEFAULT)
1168+
locale_retry = False
11681169
if not loc.IsOk():
1169-
logger.warning(W_LOCFAIL+"Failed to set the locale")
1170+
logger.warning(W_LOCFAIL+"Failed to set the default locale")
1171+
locale_retry = True
1172+
elif not loc.GetLocale() and not loc.GetName():
1173+
logger.warning(W_LOCFAIL+"Unsupported locale")
1174+
locale_retry = True
1175+
if locale_retry:
1176+
loc = wx.Locale(wx.LANGUAGE_ENGLISH_US)
1177+
logger.warning(W_LOCFAIL+"Trying with US english locale")
1178+
if not loc.IsOk():
1179+
logger.warning(W_LOCFAIL+"Failed to set the en_US locale")
11701180
else:
11711181
logger.debug('wxWidgets locale {} ({}) system: {}'.format(loc.GetLocale(), loc.GetName(), locale.getlocale()))
11721182
frame = formKiCost(None)

kicost/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__version__ = '1.1.5'
2-
__build__ = 'afec1c0-2021-05-24'
2+
__build__ = '838de14-2021-05-24'

0 commit comments

Comments
 (0)