fix(ui): critical translation workflow improvements
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2s
- Extracted Translate button to sticky bottom wrapper (always visible) - Added humanFriendlyError mapper for readable error messages - Added 'Réessayer' and 'Nouveau fichier' buttons to FAILED state - Hid GlossarySelector for non-Pro users - Fixed silent failure: attempted=0 now fails explicitly
This commit is contained in:
@@ -1188,14 +1188,23 @@ async def _run_translation_job(
|
||||
attempted = stats.get("attempted", 0)
|
||||
changed = stats.get("changed", 0)
|
||||
|
||||
if attempted == 0 and file_extension in ('.docx', '.xlsx', '.pptx'):
|
||||
error_msg = (
|
||||
"Aucun texte traduisible détecté dans le document. "
|
||||
"Le fichier est peut-être vide, protégé, ou ne contient que des images."
|
||||
)
|
||||
logger.error(f"Job {job_id}: {error_msg}")
|
||||
tracker.set_error(error_msg)
|
||||
return
|
||||
|
||||
if attempted > 0:
|
||||
ratio = changed / attempted
|
||||
logger.info(f"Job {job_id}: translation stats — {changed}/{attempted} texts changed ({ratio:.0%})")
|
||||
if changed == 0:
|
||||
error_msg = (
|
||||
f"Translation failed: 0 out of {attempted} texts were translated. "
|
||||
f"The provider ({provider}) may be unavailable or misconfigured. "
|
||||
f"Check your API keys in admin settings."
|
||||
f"0 textes sur {attempted} ont été traduits. "
|
||||
f"Le moteur ({provider}) est peut-être indisponible ou mal configuré. "
|
||||
f"Vérifiez les clés API dans les paramètres admin."
|
||||
)
|
||||
logger.error(f"Job {job_id}: {error_msg}")
|
||||
tracker.set_error(error_msg)
|
||||
|
||||
Reference in New Issue
Block a user