mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
You can use library without Babel
This commit is contained in:
parent
92b3e027db
commit
d5d4e9c90e
1 changed files with 6 additions and 1 deletions
|
|
@ -1,4 +1,7 @@
|
|||
import babel
|
||||
try:
|
||||
import babel
|
||||
except ImportError:
|
||||
babel = None
|
||||
|
||||
from .base import Deserializable
|
||||
|
||||
|
|
@ -38,6 +41,8 @@ class User(Deserializable):
|
|||
|
||||
@property
|
||||
def locale(self) -> babel.core.Locale or None:
|
||||
if not babel:
|
||||
raise ImportError('Babel is not installed!')
|
||||
if not self.language_code:
|
||||
return None
|
||||
if not hasattr(self, '_locale'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue