Catch error if no translation is found

This commit is contained in:
Philipp Hörist 2018-09-11 19:37:48 +02:00 committed by Philipp Hörist
parent 8d896449c7
commit 375af2a3d9
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]