mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Babel is in requirements now
This commit is contained in:
parent
99bb5a9fef
commit
b7a67cd522
1 changed files with 2 additions and 8 deletions
|
|
@ -1,12 +1,9 @@
|
||||||
|
import babel
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from ..utils import markdown
|
from ..utils import markdown
|
||||||
|
|
||||||
try:
|
|
||||||
import babel
|
|
||||||
except ImportError:
|
|
||||||
babel = None
|
|
||||||
|
|
||||||
|
|
||||||
class User(base.TelegramObject):
|
class User(base.TelegramObject):
|
||||||
"""
|
"""
|
||||||
|
|
@ -51,10 +48,7 @@ class User(base.TelegramObject):
|
||||||
This property requires `Babel <https://pypi.python.org/pypi/Babel>`_ module
|
This property requires `Babel <https://pypi.python.org/pypi/Babel>`_ module
|
||||||
|
|
||||||
:return: :class:`babel.core.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:
|
if not self.language_code:
|
||||||
return None
|
return None
|
||||||
if not hasattr(self, '_locale'):
|
if not hasattr(self, '_locale'):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue