Skip to content

Commit

Permalink
fix: [language detector] fix exception if the libretranslate url is n…
Browse files Browse the repository at this point in the history
…ot specified
  • Loading branch information
Terrtia committed May 6, 2024
1 parent adbce24 commit 0c28b38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/lib/Language.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0c28b38

Please sign in to comment.