Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
RootShinobi committed Dec 24, 2023
1 parent 944be55 commit e9da720
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions aiogram_i18n/utils/language_inline_keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from aiogram_i18n import I18nContext, I18nMiddleware
from aiogram_i18n.lazy.base import BaseLazyFilter

INLINE_MARKUP = List[List[InlineKeyboardButton]]


class LanguageCallbackFilter(BaseLazyFilter):
keyboard: "LanguageInlineMarkup"
Expand All @@ -31,16 +33,16 @@ def __init__(
hide_current: bool = False,
prefix: str = "__lang__",
param: str = "lang",
keyboard: Optional[List[List[InlineKeyboardButton]]] = None,
keyboard: Optional[INLINE_MARKUP] = None,
):
self.key = key
self.row = row
self.hide_current = hide_current
self.prefix = prefix
self.param = param
self.filter = LanguageCallbackFilter(keyboard=self)
self.keyboards: Dict[str, List[List[InlineKeyboardButton]]] = {}
self.keyboard = keyboard or tuple() # noqa: C408
self.keyboards: Dict[str, INLINE_MARKUP] = {}
self.keyboard: Optional[INLINE_MARKUP] = keyboard or list() # noqa: C408

def reply_markup(self, locale: Optional[str] = None) -> InlineKeyboardMarkup:
if locale is None:
Expand Down Expand Up @@ -68,5 +70,7 @@ async def startup(self, middleware: "I18nMiddleware") -> None:
self.keyboards[_locale].append([])

self.keyboards[_locale][-1].append(button)
if not self.keyboard:
return
for keyboard in self.keyboards.values():
keyboard.extend(self.keyboard)

0 comments on commit e9da720

Please sign in to comment.