From 0c28b3863862a12b8c922cfceb8cf44538291632 Mon Sep 17 00:00:00 2001 From: terrtia Date: Mon, 6 May 2024 11:31:37 +0200 Subject: [PATCH] fix: [language detector] fix exception if the libretranslate url is not specified --- bin/lib/Language.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/lib/Language.py b/bin/lib/Language.py index a53391d8..87a2db31 100755 --- a/bin/lib/Language.py +++ b/bin/lib/Language.py @@ -440,7 +440,11 @@ def delete_obj_translation(obj_global_id, language, field=''): class LanguagesDetector: def __init__(self, nb_langs=3, min_proportion=0.2, min_probability=-1, min_len=0): - self.lt = LibreTranslateAPI(get_translator_instance()) + lt_url = get_translator_instance() + if not lt_url: + self.lt = None + else: + self.lt = LibreTranslateAPI(get_translator_instance()) try: self.lt.languages() except Exception: