Refactor broadcast and user logs messages for localization support
- Updated the broadcast confirmation message to utilize localization for dynamic content, enhancing multilingual support. - Modified user logs display to incorporate localization for the title, improving consistency across languages. - Added new localization entries in both English and Russian for better user experience and clarity.
This commit is contained in:
@@ -337,15 +337,24 @@ async def confirm_broadcast_callback_handler(
|
||||
# Get queue stats for detailed report
|
||||
queue_stats = queue_manager.get_queue_stats()
|
||||
|
||||
result_message = f"""🚀 Рассылка поставлена в очередь!
|
||||
📤 В очередь добавлено: {sent_count}
|
||||
❌ Ошибок: {failed_count}
|
||||
|
||||
📊 Статус очередей:
|
||||
👥 Очередь пользователей: {queue_stats['user_queue_size']} сообщений
|
||||
📢 Очередь групп: {queue_stats['group_queue_size']} сообщений
|
||||
|
||||
ℹ️ Сообщения будут отправлены автоматически с соблюдением лимитов Telegram."""
|
||||
result_message = (
|
||||
_(
|
||||
"broadcast_queue_result",
|
||||
default=(
|
||||
"🚀 Рассылка поставлена в очередь!\n"
|
||||
"📤 В очередь добавлено: {sent_count}\n"
|
||||
"❌ Ошибок: {failed_count}\n\n"
|
||||
"📊 Статус очередей:\n"
|
||||
"👥 Очередь пользователей: {user_queue_size} сообщений\n"
|
||||
"📢 Очередь групп: {group_queue_size} сообщений\n\n"
|
||||
"ℹ️ Сообщения будут отправлены автоматически с соблюдением лимитов Telegram."
|
||||
),
|
||||
sent_count=sent_count,
|
||||
failed_count=failed_count,
|
||||
user_queue_size=queue_stats["user_queue_size"],
|
||||
group_queue_size=queue_stats["group_queue_size"],
|
||||
)
|
||||
)
|
||||
await callback.message.answer(
|
||||
result_message,
|
||||
reply_markup=get_back_to_admin_panel_keyboard(current_lang, i18n),
|
||||
|
||||
@@ -420,7 +420,9 @@ async def handle_view_user_logs(callback: types.CallbackQuery, user: User,
|
||||
), show_alert=True)
|
||||
return
|
||||
|
||||
logs_text_parts = [f"📜 <b>Последние действия пользователя {user.user_id}:</b>\n"]
|
||||
logs_text_parts = [
|
||||
f"{_('admin_user_recent_actions_title', default='📜 Последние действия пользователя {user_id}:', user_id=user.user_id)}\n"
|
||||
]
|
||||
|
||||
for log in logs:
|
||||
timestamp = log.timestamp.strftime('%Y-%m-%d %H:%M') if log.timestamp else 'N/A'
|
||||
|
||||
+14
-9
@@ -14,7 +14,7 @@
|
||||
|
||||
"back_to_main_menu_button": "⬅️ Back",
|
||||
|
||||
"choose_language": "Choose language / Выберите язык:",
|
||||
"choose_language": "Choose language:",
|
||||
"language_set_alert": "Language changed!",
|
||||
|
||||
"error_occurred_try_again": "An error occurred, please try again.",
|
||||
@@ -58,6 +58,8 @@
|
||||
"referral_share_message_button": "📩 Message for friend",
|
||||
"referral_friend_message": "🚀 Hey! Try this VPN - it's fast, reliable and affordable!\n\n🎁 Use my link to get bonus days with your subscription!\n\n{referral_link}",
|
||||
"friend_placeholder": "friend",
|
||||
"referral_bonus_inviter_notification_extended": "🎉 Congrats! Your friend {referee_name} paid for a subscription. You received {days} bonus days! Your subscription is now active until {new_end_date}.",
|
||||
"referral_bonus_inviter_notification_new_sub": "🎉 Congrats! Your friend {referee_name} paid for a subscription. You received a {days}-day bonus subscription! It is active until {new_end_date}.",
|
||||
"user_is_banned": "🚫 Your account is banned. Please contact support.",
|
||||
|
||||
"admin_panel_title": "Admin Panel",
|
||||
@@ -125,19 +127,20 @@
|
||||
"admin_broadcast_cancelled": "Broadcast cancelled.",
|
||||
"admin_broadcast_cancelled_alert": "Broadcast cancelled!",
|
||||
"admin_broadcast_cancelled_nav_back": "Broadcast cancelled. You are returned to the admin panel.",
|
||||
"broadcast_queue_result": "🚀 Broadcast queued!\n📤 Enqueued: {sent_count}\n❌ Errors: {failed_count}\n\n📊 Queue Status:\n👥 User queue: {user_queue_size} messages\n📢 Group queue: {group_queue_size} messages\n\nℹ️ Messages will be sent automatically within Telegram limits.",
|
||||
"admin_promo_invalid_code_format": "Code must be 3–30 alphanumeric characters.",
|
||||
"admin_promo_invalid_bonus_days": "Bonus days must be a positive number.",
|
||||
"admin_promo_invalid_max_activations": "Max activations must be a positive number.",
|
||||
"admin_promo_invalid_validity_days": "Validity period (in days) must be a positive number.",
|
||||
"admin_promo_created_success": "✅ Promo code <code>{code}</code> created successfully!\nBonus: {bonus_days} days\nMax uses: {max_activations}\nValid until: {valid_until_str}.",
|
||||
"admin_promo_set_validity_days": "⏰ Установить срок (дни)",
|
||||
"admin_back_to_panel": "⬅️ В панель",
|
||||
"admin_promo_unlimited": "♾️ Неограниченно",
|
||||
"admin_bulk_promo_created_title": "📦 Массовое создание завершено",
|
||||
"admin_bulk_promo_created_stats": "📊 Создано: <b>{created}</b> из <b>{total}</b>",
|
||||
"admin_bulk_promo_settings": "🎁 Бонусные дни: <b>{bonus_days}</b>\n📊 Макс. активаций: <b>{max_activations}</b>\n⏰ Срок действия: <b>{validity}</b>",
|
||||
"admin_promo_set_validity_days": "⏰ Set validity (days)",
|
||||
"admin_back_to_panel": "⬅️ Back to panel",
|
||||
"admin_promo_unlimited": "♾️ Unlimited",
|
||||
"admin_bulk_promo_created_title": "📦 Bulk creation completed",
|
||||
"admin_bulk_promo_created_stats": "📊 Created: <b>{created}</b> of <b>{total}</b>",
|
||||
"admin_bulk_promo_settings": "🎁 Bonus days: <b>{bonus_days}</b>\n📊 Max activations: <b>{max_activations}</b>\n⏰ Validity: <b>{validity}</b>",
|
||||
"admin_promo_list_page_info": "Page {current}/{total} ({count} promo codes)",
|
||||
"admin_queue_status_button": "📊 Статус очередей",
|
||||
"admin_queue_status_button": "📊 Queue Status",
|
||||
"admin_queue_status_title": "📊 Message Queue Status",
|
||||
"admin_queue_status_info": "📤 <b>Message Queues:</b>\n\n👥 <b>Users (25 msg/sec):</b>\n 📋 In queue: {user_queue_size}\n 🔄 Processing: {user_processing}\n 📈 Sent per minute: {user_recent}\n\n📢 <b>Groups/channels (15 msg/min):</b>\n 📋 In queue: {group_queue_size}\n 🔄 Processing: {group_processing}\n 📈 Sent per minute: {group_recent}",
|
||||
"admin_active_promos_list_header": "Active Promo Codes:",
|
||||
@@ -240,7 +243,7 @@
|
||||
"admin_user_logs_error": "❌ Error loading user actions",
|
||||
"admin_direct_message_signature": "\n\n---\n💬 Message from administrator",
|
||||
"inline_user_stats_message": "👥 <b>User Statistics</b>\n\n📊 Total: <b>{total}</b>\n📈 Active today: <b>{active_today}</b>\n💳 With paid subscription: <b>{paid}</b>\n🆓 On trial period: <b>{trial}</b>\n😴 Inactive: <b>{inactive}</b>\n🚫 Banned: <b>{banned}</b>\n🎁 Via referral program: <b>{referral}</b>",
|
||||
"inline_user_stats_description": "Всего: {total}, Платных: {active}",
|
||||
"inline_user_stats_description": "Total: {total}, Paid: {active}",
|
||||
"inline_admin_user_stats_title": "👥 User Statistics",
|
||||
"inline_financial_stats_message": "💰 <b>Financial Statistics</b>\n\n📅 Today: <b>{today:.2f} RUB</b>\n ({today_count} payments)\n📅 Week: <b>{week:.2f} RUB</b>\n📅 Month: <b>{month:.2f} RUB</b>\n🏆 All time: <b>{all_time:.2f} RUB</b>",
|
||||
"inline_admin_financial_stats_title": "💰 Financial Statistics",
|
||||
@@ -255,6 +258,8 @@
|
||||
"log_suspicious_promo": "⚠️ <b>Suspicious Promo Code Attempt</b>\n\n👤 User: {user_display}\n🆔 ID: <code>{user_id}</code>\n📝 Input: <pre>{suspicious_input}</pre>\n🕐 Time: {timestamp}",
|
||||
"admin_logs_csv_export_started": "📄 Starting log export to CSV...",
|
||||
"admin_logs_csv_export_success": "✅ Logs exported! File attached above.",
|
||||
"admin_user_logs_title": "Logs for {user_display} (page {current_page}/{total_pages}):",
|
||||
"admin_all_logs_title": "All Logs (page {current_page}/{total_pages}):",
|
||||
"admin_csv_header_log_id": "Log ID",
|
||||
"admin_csv_header_timestamp": "Timestamp",
|
||||
"admin_csv_header_user_id": "User ID",
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
"referral_share_message_button": "📩 Сообщение для друга",
|
||||
"referral_friend_message": "🚀 Привет! Попробуй этот VPN - быстрый, надёжный и доступный!\n\n🎁 По моей ссылке тебе дадут бонусные дни к подписке!\n\n{referral_link}",
|
||||
"friend_placeholder": "друг",
|
||||
"referral_bonus_inviter_notification_extended": "🎉 Поздравляем! Ваш друг {referee_name} оплатил подписку. Вам начислено {days} бонусных дней! Ваша подписка теперь активна до {new_end_date}.",
|
||||
"referral_bonus_inviter_notification_new_sub": "🎉 Поздравляем! Ваш друг {referee_name} оплатил подписку. Вам начислена бонусная подписка на {days} дней! Она активна до {new_end_date}.",
|
||||
"user_is_banned": "🚫 Ваш аккаунт заблокирован. Пожалуйста, свяжитесь со службой поддержки.",
|
||||
|
||||
"admin_panel_title": "Панель администратора",
|
||||
@@ -255,6 +257,8 @@
|
||||
"log_suspicious_promo": "⚠️ <b>Подозрительная попытка ввода промокода</b>\n\n👤 Пользователь: {user_display}\n🆔 ID: <code>{user_id}</code>\n📝 Ввод: <pre>{suspicious_input}</pre>\n🕐 Время: {timestamp}",
|
||||
"admin_logs_csv_export_started": "📄 Начинаю экспорт логов в CSV...",
|
||||
"admin_logs_csv_export_success": "✅ Логи экспортированы! Файл прикреплен выше.",
|
||||
"admin_user_logs_title": "Логи пользователя {user_display} (стр. {current_page}/{total_pages}):",
|
||||
"admin_all_logs_title": "Все логи (стр. {current_page}/{total_pages}):",
|
||||
"admin_csv_header_log_id": "ID Лога",
|
||||
"admin_csv_header_timestamp": "Время",
|
||||
"admin_csv_header_user_id": "ID Пользователя",
|
||||
|
||||
Reference in New Issue
Block a user