def set_lang(update: Update, _) -> None: chat = update.effective_chat msg = update.effective_message msg_text = gs(chat.id, "curr_chat_lang").format( get_language(sql.get_chat_lang(chat.id))[:-3] ) keyb = [] for code, name in get_languages().items(): keyb.append( InlineKeyboardButton( text=name, callback_data=f"setLang_{code}", ) ) keyb = list(paginate(keyb, 2)) keyb.append( [ InlineKeyboardButton( text="Help us in translations", url="https://poeditor.com/join/project?hash=oJISpjNcEx", ) ] ) msg.reply_text(msg_text, reply_markup=InlineKeyboardMarkup(keyb))
def set_lang(update: Update, _) -> None: chat = update.effective_chat msg = update.effective_message msg_text = gs(chat.id, "curr_chat_lang").format( get_language(sql.get_chat_lang(chat.id))[:-3]) keyb = [] for code, name in get_languages().items(): keyb.append( InlineKeyboardButton( text=name, callback_data=f"setLang_{code}", )) keyb = list(paginate(keyb, 2)) keyb.append([ InlineKeyboardButton( text="Help us in translations", url= "https://github.com/Dank-del/EnterpriseALRobot/tree/translations", ) ]) msg.reply_text(msg_text, reply_markup=InlineKeyboardMarkup(keyb))
def gs(chat_id: Union[int, str], string: str) -> str: lang = sql.get_chat_lang(chat_id) return get_string(lang, string)