mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Raise error when locale is not compiled.
This commit is contained in:
parent
cdc51a6994
commit
3d5b461409
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue