mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 07:50:32 +00:00
Merge pull request #48 from surik00/dev-1.x
Babel is not in requirements
This commit is contained in:
commit
a139ebee6e
1 changed files with 4 additions and 10 deletions
|
|
@ -1,12 +1,9 @@
|
|||
import babel
|
||||
|
||||
from . import base
|
||||
from . import fields
|
||||
from ..utils import markdown
|
||||
|
||||
try:
|
||||
import babel
|
||||
except ImportError:
|
||||
babel = None
|
||||
|
||||
|
||||
class User(base.TelegramObject):
|
||||
"""
|
||||
|
|
@ -46,15 +43,12 @@ class User(base.TelegramObject):
|
|||
return self.full_name
|
||||
|
||||
@property
|
||||
def locale(self) -> 'babel.core.Locale' or None:
|
||||
def locale(self) -> babel.core.Locale or None:
|
||||
"""
|
||||
This property requires `Babel <https://pypi.python.org/pypi/Babel>`_ module
|
||||
Get user's locale
|
||||
|
||||
:return: :class:`babel.core.Locale`
|
||||
:raise: ImportError: when babel is not installed.
|
||||
"""
|
||||
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