feat(translate): refonte du design de la page de traduction et du sélecteur de moteurs (Etapes 1-3)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m12s

This commit is contained in:
2026-05-31 10:14:23 +02:00
parent 9532fef2cd
commit c1ea65f10f
17 changed files with 956 additions and 325 deletions

View File

@@ -468,6 +468,9 @@ async def translate_document_v1(
pdf_mode: Optional[Literal["layout", "text_only"]] = Form(
default=None, description="PDF translation mode: 'layout' (preserve layout) or 'text_only' (clean text output). PDF only."
),
translate_images: bool = Form(
default=False, description="Translate text inside images using AI vision"
),
current_user: Optional[Any] = Depends(get_authenticated_user),
):
"""
@@ -757,6 +760,7 @@ async def translate_document_v1(
"glossary_id": glossary_id,
"prompt_id": prompt_id, # Story 3.12: Store prompt_id
"pdf_mode": pdf_mode, # PDF translation mode
"translate_images": translate_images,
}
await set_job_status_async(job_id, _translation_jobs[job_id])
@@ -790,6 +794,7 @@ async def translate_document_v1(
webhook_url=webhook_url,
user_plan=str(current_user.plan) if current_user else "free",
pdf_mode=pdf_mode,
translate_images=translate_images,
)
)
@@ -926,6 +931,7 @@ async def _run_translation_job(
webhook_url: Optional[str] = None,
user_plan: Optional[str] = None, # Plan name for watermark decision
pdf_mode: Optional[str] = None, # PDF translation mode: "layout" or "text_only"
translate_images: bool = False,
) -> None:
"""
Run translation job in background with progress tracking.
@@ -1194,6 +1200,7 @@ async def _run_translation_job(
target_lang,
source_lang,
progress_callback=progress_callback,
translate_images=translate_images,
)
elif file_extension == ".docx":
job_translator = WordTranslator(provider=translation_provider)
@@ -1204,6 +1211,7 @@ async def _run_translation_job(
target_lang,
source_lang,
progress_callback=progress_callback,
translate_images=translate_images,
)
elif file_extension == ".pptx":
job_translator = PowerPointTranslator(provider=translation_provider)
@@ -1214,6 +1222,7 @@ async def _run_translation_job(
target_lang,
source_lang,
progress_callback=progress_callback,
translate_images=translate_images,
)
elif file_extension == ".pdf":
from translators.pdf_translator import PDFTranslator
@@ -1226,6 +1235,7 @@ async def _run_translation_job(
source_lang,
progress_callback=progress_callback,
pdf_mode=pdf_mode or "layout",
translate_images=translate_images,
)
# PDF translation may output .docx (if no LibreOffice); use actual path
if actual_output and Path(actual_output).exists():