From a097abf5bc8c39fb404d334333b2c7198a2da6bc Mon Sep 17 00:00:00 2001 From: KomaruTheCat Date: Thu, 2 Jul 2026 22:01:41 +0300 Subject: [PATCH] add localization for forwarding prefix and integrate captcha dependency --- bot/handlers/user.py | 4 ++-- locales/en.json | 3 ++- locales/uk.json | 3 ++- pyproject.toml | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bot/handlers/user.py b/bot/handlers/user.py index 45ab7fe..a3626bd 100644 --- a/bot/handlers/user.py +++ b/bot/handlers/user.py @@ -31,7 +31,7 @@ async def process_captcha(message: Message, state: FSMContext, bot: Bot, locale: try: db_msg_id = data.get("db_msg_id", "N/A") - prefix = f"Forwarding, ID [{db_msg_id}]:" + prefix = _("forwarding_prefix", locale=locale, id=db_msg_id) target_chat_id = settings.group_chat_id if data.get('has_media'): @@ -85,7 +85,7 @@ async def handle_any_message(message: Message, state: FSMContext, bot: Bot, loca if settings.disable_captcha: try: wait_message = await message.answer(_("processing_message", locale=locale)) - prefix = f"Forwarding, ID [{db_msg_id}]:" + prefix = _("forwarding_prefix", locale=locale, id=db_msg_id) target_chat_id = settings.group_chat_id if has_media: diff --git a/locales/en.json b/locales/en.json index 7d846df..1f43bd0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -14,5 +14,6 @@ "msg_details": "Message ID: {id}\nUser: {full_name} (@{username}) [ID: {user_id}]\nType: {content_type}\nTimestamp: {timestamp}\n\nContent:\n{text}", "id_command": "Current Chat ID: {id}", "processing_message": "Forwarding your message...", - "message_processed": "Forwarded!" + "message_processed": "Forwarded!", + "forwarding_prefix": "Forwarding, ID [{id}]:" } diff --git a/locales/uk.json b/locales/uk.json index 8962122..431e087 100644 --- a/locales/uk.json +++ b/locales/uk.json @@ -14,5 +14,6 @@ "msg_details": "ID повідомлення: {id}\nКористувач: {full_name} (@{username}) [ID: {user_id}]\nТип: {content_type}\nЧас: {timestamp}\n\nВміст:\n{text}", "id_command": "Поточний ID чату: {id}", "processing_message": "Відправляємо ваше повідомлення...", - "message_processed": "Відправлено!" + "message_processed": "Відправлено!", + "forwarding_prefix": "Пересилання, ID [{id}]:" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f412821..f90692d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,4 +6,5 @@ dependencies = [ "aiogram>=3.29.1", "pydantic>=2.13.4", "pydantic-settings>=2.14.2", + "captcha", ]