feat: translate comments, docstrings, and log messages to Spanish.

This commit is contained in:
Marco Gallegos
2025-12-18 12:33:39 -06:00
parent 519a5ad705
commit 3b9346fe0f
12 changed files with 205 additions and 205 deletions

View File

@@ -1,13 +1,13 @@
"""
Handler for receiving and processing user messages (text, audio, images).
Manejador para recibir y procesar mensajes de usuario (texto, audio, imágenes).
"""
from telegram import Update
from telegram.ext import ContextTypes
import logging
from app.schema.base import RawInput
# This is a simplified integration. In a real app, you would likely
# have a queue or a more robust way to trigger the processing pipeline.
# Esta es una integración simplificada. En una aplicación real, probablemente
# tendrías una cola o una forma más robusta de activar el pipeline de procesamiento.
from app.router import process_expense_input
from app.persistence.db import get_db
@@ -15,12 +15,12 @@ logger = logging.getLogger(__name__)
async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""
Handles regular messages and triggers the expense processing pipeline.
Maneja mensajes regulares y activa el pipeline de procesamiento de gastos.
"""
user_id = str(update.effective_user.id)
# This is a very simplified example.
# A real implementation needs to handle files, voice, etc.
# Este es un ejemplo muy simplificado.
# Una implementación real necesita manejar archivos, voz, etc.
if update.message.text:
raw_input = RawInput(
user_id=user_id,
@@ -29,20 +29,20 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
)
try:
# Get a DB session
# Obtener una sesión de BD
db_session = next(get_db())
# Run the processing pipeline
# Ejecutar el pipeline de procesamiento
result = process_expense_input(db=db_session, raw_input=raw_input)
if result:
await update.message.reply_text(f"Expense saved successfully! ID: {result.id}")
await update.message.reply_text(f"¡Gasto guardado con éxito! ID: {result.id}")
else:
await update.message.reply_text("I couldn't fully process that. It might need manual review.")
await update.message.reply_text("No pude procesar eso completamente. Podría necesitar revisión manual.")
except Exception as e:
logger.error(f"Error handling message: {e}", exc_info=True)
await update.message.reply_text("Sorry, an error occurred while processing your request.")
logger.error(f"Error al manejar el mensaje: {e}", exc_info=True)
await update.message.reply_text("Lo siento, ocurrió un error al procesar tu solicitud.")
else:
await update.message.reply_text("I can currently only process text messages.")
await update.message.reply_text("Actualmente solo puedo procesar mensajes de texto.")