mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-26 15:57:16 +00:00
fix: [language detector] fix exception if the libretranslate url is not specified
This commit is contained in:
parent
adbce24128
commit
0c28b38638
1 changed files with 5 additions and 1 deletions
|
@ -440,7 +440,11 @@ def delete_obj_translation(obj_global_id, language, field=''):
|
||||||
class LanguagesDetector:
|
class LanguagesDetector:
|
||||||
|
|
||||||
def __init__(self, nb_langs=3, min_proportion=0.2, min_probability=-1, min_len=0):
|
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:
|
try:
|
||||||
self.lt.languages()
|
self.lt.languages()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in a new issue