From 6f293f6013f8077d4bf40ecde2e4f9081aaac9c7 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 28 Oct 2024 16:12:59 -0400 Subject: [PATCH] Fix 400 error msg --- libretranslate/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretranslate/app.py b/libretranslate/app.py index 705058f..c1fd4ac 100644 --- a/libretranslate/app.py +++ b/libretranslate/app.py @@ -858,7 +858,7 @@ def create_app(args): detected_src_lang = candidate_langs[0] src_lang = next(iter([l for l in languages if l.code == detected_src_lang["language"]]), None) if src_lang is None: - abort(400, description=_("%(lang)s is not supported", lang=candidate_langs[0])) + abort(400, description=_("%(lang)s is not supported", lang=detected_src_lang["language"])) translated_file_path = argostranslatefiles.translate_file(src_lang.get_translation(tgt_lang), filepath) translated_filename = os.path.basename(translated_file_path)