Raise error when locale is not compiled.

This commit is contained in:
Alex Root Junior 2018-06-30 17:00:12 +03:00
parent cdc51a6994
commit 3d5b461409

View file

@ -57,6 +57,8 @@ class I18nMiddleware(BaseMiddleware):
if os.path.exists(mo_path):
with open(mo_path, 'rb') as fp:
translations[name] = gettext.GNUTranslations(fp)
elif os.path.exists(mo_path[:-2] + 'po'):
raise RuntimeError(f"Found locale '{name} but this language is not compiled!")
return translations