mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
fixed checking the installed languages.
This commit is contained in:
parent
24767f62c7
commit
0565118a01
@ -14,12 +14,21 @@ def get_tesseract_langs():
|
|||||||
|
|
||||||
@register()
|
@register()
|
||||||
def check_default_language_available(app_configs, **kwargs):
|
def check_default_language_available(app_configs, **kwargs):
|
||||||
langs = get_tesseract_langs()
|
installed_langs = get_tesseract_langs()
|
||||||
|
|
||||||
if settings.OCR_LANGUAGE not in langs:
|
if not settings.OCR_LANGUAGE:
|
||||||
return [Error(
|
return [Warning(
|
||||||
f"The default ocr language {settings.OCR_LANGUAGE} is "
|
"No OCR language has been specified with PAPERLESS_OCR_LANGUAGE. "
|
||||||
f"not installed. Paperless cannot OCR your documents "
|
"This means that tesseract will fallback to english."
|
||||||
f"without it. Please fix PAPERLESS_OCR_LANGUAGE.")]
|
)]
|
||||||
else:
|
|
||||||
return []
|
specified_langs = settings.OCR_LANGUAGE.split("+")
|
||||||
|
|
||||||
|
for lang in specified_langs:
|
||||||
|
if lang not in installed_langs:
|
||||||
|
return [Error(
|
||||||
|
f"The selected ocr language {lang} is "
|
||||||
|
f"not installed. Paperless cannot OCR your documents "
|
||||||
|
f"without it. Please fix PAPERLESS_OCR_LANGUAGE.")]
|
||||||
|
|
||||||
|
return []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user