[fix] crashes when Python is not able to retrieve the default locale

This commit is contained in:
Vinícius Moreira
2020-04-13 12:21:08 -03:00
parent 01a60ea686
commit d840ece02a
2 changed files with 9 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixes
- table not displaying all updates when the "updates filter" is clicked several times
- installation logs written to the wrong temp directory
- crashes when Python is not able to retrieve the default locale [#84](https://github.com/vinifmor/bauh/issues/84)
- Arch / AUR:
- sorting algorithm was providing wrong results for some cases
- not caching data about packages with no desktop entry files

View File

@@ -49,7 +49,14 @@ def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale
locale_path = None
if key is None:
current_locale = locale.getdefaultlocale()
try:
current_locale = locale.getdefaultlocale()
if current_locale is None or current_locale[0] is None:
current_locale = ('en', 'UTF-8')
except:
current_locale = ('en', 'UTF-8')
else:
current_locale = [key.strip().lower()]