Catch error if no translation is found

This commit is contained in:
Philipp Hörist 2018-09-11 19:37:48 +02:00
parent a34bf54c46
commit dad7def794
1 changed files with 5 additions and 1 deletions

View File

@ -136,7 +136,11 @@ if hasattr(locale, 'bindtextdomain'):
gettext.textdomain(DOMAIN)
gettext.install(DOMAIN, _localedir)
_ = gettext.translation(DOMAIN, _localedir).gettext
try:
_ = gettext.translation(DOMAIN, _localedir).gettext
except OSError:
_ = gettext.gettext
if gettext._translations:
_translations = list(gettext._translations.values())[0]