From 8b55f92b11dbf66401c7ed08d8421aec6daa8466 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 9 Jul 2025 11:22:46 -0400 Subject: [PATCH] Updated /translate definition --- libretranslate/app.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/libretranslate/app.py b/libretranslate/app.py index 47d65c4..c15c747 100644 --- a/libretranslate/app.py +++ b/libretranslate/app.py @@ -598,7 +598,7 @@ def create_app(args): description: API key responses: 200: - description: Translated text + description: Translation schema: id: translate type: object @@ -608,6 +608,41 @@ def create_app(args): - type: string - type: array description: Translated text(s) + detectedLanguage: + oneOf: + - type: object + properties: + confidence: + type: number + format: float + description: Confidence score (0-100) of the detected language + language: + type: string + description: Detected language code + - type: array + items: + type: object + properties: + confidence: + type: number + format: float + description: Confidence score (0-100) of the detected language + language: + type: string + description: Detected language code + alternatives: + oneOf: + - type: array + items: + type: string + - type: array + items: + type: array + items: + type: string + description: Alternative translations + required: + - translatedText 400: description: Invalid request schema: