diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bf34179..42f1352f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bauh/view/util/translation.py b/bauh/view/util/translation.py index 665e395a..40350c30 100644 --- a/bauh/view/util/translation.py +++ b/bauh/view/util/translation.py @@ -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()]