We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Problem with tesseract after Bugfix: Some tesseract languages aren't detected as installed. @stumpylog (#2057)
### Description

Hi,
after Fixes [2044  ](https://github.com/paperless-ngx/paperless-ngx/issues/2044)I have problem with OCR and paperless-ngx.

Before this commit I use next ENV :

> 

      - PAPERLESS_OCR_LANGUAGE=srp_latn+srp
      - PAPERLESS_OCR_LANGUAGES=srp-latn srp script-latn 

and everything work.

After this commit if dont make any changes in ENV error is:
?: The selected ocr language srp_latn is not installed. Paperless cannot OCR your documents without it. Please fix PAPERLESS_OCR_LANGUAGE.

If i make changes in ENV, replace _ with -:

> 

      - PAPERLESS_OCR_LANGUAGE=srp-latn+srp
      - PAPERLESS_OCR_LANGUAGES=srp-latn srp script-latn
After this change system install lang and start paperless, but if I upload any document, OCR dont work, error is:

`[2022-12-04 13:05:46,369] [ERROR] [paperless.consumer] Error while consuming document apr 2022.pdf: MissingDependencyError: OCR engine does not have language data for the following requested languages:

srp-latn

**
Paperless-ngx 1.10.0 WORK
Paperless-ngx 1.10.1 DONT WORK
**
### Steps to reproduce

1. Add this ENV
  - PAPERLESS_OCR_LANGUAGE=srp-latn+srp
  - PAPERLESS_OCR_LANGUAGES=srp-latn srp script-latn

2. Upload any document

### Webserver logs

```bash
[2022-12-04 13:05:46,369] [ERROR] [paperless.consumer] Error while consuming document apr 2022.pdf: MissingDependencyError: OCR engine does not have language data for the following requested languages:

srp-latn

Note: most languages are identified by a 3-digit ISO 639-2 Code

Traceback (most recent call last):

  File "/usr/src/paperless/src/paperless_tesseract/parsers.py", line 292, in parse

    ocrmypdf.ocr(**args)

  File "/usr/local/lib/python3.9/site-packages/ocrmypdf/api.py", line 331, in ocr

    check_options(options, plugin_manager)

  File "/usr/local/lib/python3.9/site-packages/ocrmypdf/_validation.py", line 246, in check_options

    _check_plugin_options(options, plugin_manager)

  File "/usr/local/lib/python3.9/site-packages/ocrmypdf/_validation.py", line 241, in _check_plugin_options

    check_options_languages(options, ocr_engine_languages)

  File "/usr/local/lib/python3.9/site-packages/ocrmypdf/_validation.py", line 70, in check_options_languages

    raise MissingDependencyError(msg)

ocrmypdf.exceptions.MissingDependencyError: OCR engine does not have language data for the following requested languages:

srp-latn

Note: most languages are identified by a 3-digit ISO 639-2 Code

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/usr/src/paperless/src/documents/consumer.py", line 337, in try_consume_file

    document_parser.parse(self.path, mime_type, self.filename)

  File "/usr/src/paperless/src/paperless_tesseract/parsers.py", line 346, in parse

    raise ParseError(f"{e.__class__.__name__}: {str(e)}") from e

documents.parsers.ParseError: MissingDependencyError: OCR engine does not have language data for the following requested languages:

srp-latn

Note: most languages are identified by a 3-digit ISO 639-2 Code
```


### Browser logs

_No response_

### Paperless-ngx version

1.10.1

### Host OS

Docker

### Installation method

Docker - official image

### Browser

_No response_

### Configuration changes

_No response_

### Other

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/paperless_tesseract/checks.py`
Content:
```
1 import shutil
2 import subprocess
3 
4 from django.conf import settings
5 from django.core.checks import Error
6 from django.core.checks import register
7 from django.core.checks import Warning
8 
9 
10 def get_tesseract_langs():
11     proc = subprocess.run(
12         [shutil.which("tesseract"), "--list-langs"],
13         capture_output=True,
14     )
15 
16     # Decode bytes to string, split on newlines, trim out the header
17     proc_lines = proc.stdout.decode("utf8", errors="ignore").strip().split("\n")[1:]
18 
19     # Replace _ with - to convert two part languages to the expected code
20     return [x.replace("_", "-") for x in proc_lines]
21 
22 
23 @register()
24 def check_default_language_available(app_configs, **kwargs):
25     installed_langs = get_tesseract_langs()
26 
27     if not settings.OCR_LANGUAGE:
28         return [
29             Warning(
30                 "No OCR language has been specified with PAPERLESS_OCR_LANGUAGE. "
31                 "This means that tesseract will fallback to english.",
32             ),
33         ]
34 
35     specified_langs = settings.OCR_LANGUAGE.split("+")
36 
37     for lang in specified_langs:
38         if lang not in installed_langs:
39             return [
40                 Error(
41                     f"The selected ocr language {lang} is "
42                     f"not installed. Paperless cannot OCR your documents "
43                     f"without it. Please fix PAPERLESS_OCR_LANGUAGE.",
44                 ),
45             ]
46 
47     return []
48
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/paperless_tesseract/checks.py b/src/paperless_tesseract/checks.py
--- a/src/paperless_tesseract/checks.py
+++ b/src/paperless_tesseract/checks.py
@@ -16,8 +16,7 @@
     # Decode bytes to string, split on newlines, trim out the header
     proc_lines = proc.stdout.decode("utf8", errors="ignore").strip().split("\n")[1:]
 
-    # Replace _ with - to convert two part languages to the expected code
-    return [x.replace("_", "-") for x in proc_lines]
+    return [x.strip() for x in proc_lines]
 
 
 @register()

{"golden_diff": "diff --git a/src/paperless_tesseract/checks.py b/src/paperless_tesseract/checks.py\n--- a/src/paperless_tesseract/checks.py\n+++ b/src/paperless_tesseract/checks.py\n@@ -16,8 +16,7 @@\n     # Decode bytes to string, split on newlines, trim out the header\n     proc_lines = proc.stdout.decode(\"utf8\", errors=\"ignore\").strip().split(\"\\n\")[1:]\n \n-    # Replace _ with - to convert two part languages to the expected code\n-    return [x.replace(\"_\", \"-\") for x in proc_lines]\n+    return [x.strip() for x in proc_lines]\n \n \n @register()\n", "issue": "[BUG] Problem with tesseract after Bugfix: Some tesseract languages aren't detected as installed. @stumpylog (#2057)\n### Description\r\n\r\nHi,\r\nafter Fixes [2044  ](https://github.com/paperless-ngx/paperless-ngx/issues/2044)I have problem with OCR and paperless-ngx.\r\n\r\nBefore this commit I use next ENV :\r\n\r\n> \r\n\r\n      - PAPERLESS_OCR_LANGUAGE=srp_latn+srp\r\n      - PAPERLESS_OCR_LANGUAGES=srp-latn srp script-latn \r\n\r\nand everything work.\r\n\r\nAfter this commit if dont make any changes in ENV error is:\r\n?: The selected ocr language srp_latn is not installed. Paperless cannot OCR your documents without it. Please fix PAPERLESS_OCR_LANGUAGE.\r\n\r\nIf i make changes in ENV, replace _ with -:\r\n\r\n> \r\n\r\n      - PAPERLESS_OCR_LANGUAGE=srp-latn+srp\r\n      - PAPERLESS_OCR_LANGUAGES=srp-latn srp script-latn\r\nAfter this change system install lang and start paperless, but if I upload any document, OCR dont work, error is:\r\n\r\n`[2022-12-04 13:05:46,369] [ERROR] [paperless.consumer] Error while consuming document apr 2022.pdf: MissingDependencyError: OCR engine does not have language data for the following requested languages:\r\n\r\nsrp-latn\r\n\r\n**\r\nPaperless-ngx 1.10.0 WORK\r\nPaperless-ngx 1.10.1 DONT WORK\r\n**\r\n### Steps to reproduce\r\n\r\n1. Add this ENV\r\n  - PAPERLESS_OCR_LANGUAGE=srp-latn+srp\r\n  - PAPERLESS_OCR_LANGUAGES=srp-latn srp script-latn\r\n\r\n2. Upload any document\r\n\r\n### Webserver logs\r\n\r\n```bash\r\n[2022-12-04 13:05:46,369] [ERROR] [paperless.consumer] Error while consuming document apr 2022.pdf: MissingDependencyError: OCR engine does not have language data for the following requested languages:\r\n\r\nsrp-latn\r\n\r\nNote: most languages are identified by a 3-digit ISO 639-2 Code\r\n\r\nTraceback (most recent call last):\r\n\r\n  File \"/usr/src/paperless/src/paperless_tesseract/parsers.py\", line 292, in parse\r\n\r\n    ocrmypdf.ocr(**args)\r\n\r\n  File \"/usr/local/lib/python3.9/site-packages/ocrmypdf/api.py\", line 331, in ocr\r\n\r\n    check_options(options, plugin_manager)\r\n\r\n  File \"/usr/local/lib/python3.9/site-packages/ocrmypdf/_validation.py\", line 246, in check_options\r\n\r\n    _check_plugin_options(options, plugin_manager)\r\n\r\n  File \"/usr/local/lib/python3.9/site-packages/ocrmypdf/_validation.py\", line 241, in _check_plugin_options\r\n\r\n    check_options_languages(options, ocr_engine_languages)\r\n\r\n  File \"/usr/local/lib/python3.9/site-packages/ocrmypdf/_validation.py\", line 70, in check_options_languages\r\n\r\n    raise MissingDependencyError(msg)\r\n\r\nocrmypdf.exceptions.MissingDependencyError: OCR engine does not have language data for the following requested languages:\r\n\r\nsrp-latn\r\n\r\nNote: most languages are identified by a 3-digit ISO 639-2 Code\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n\r\n  File \"/usr/src/paperless/src/documents/consumer.py\", line 337, in try_consume_file\r\n\r\n    document_parser.parse(self.path, mime_type, self.filename)\r\n\r\n  File \"/usr/src/paperless/src/paperless_tesseract/parsers.py\", line 346, in parse\r\n\r\n    raise ParseError(f\"{e.__class__.__name__}: {str(e)}\") from e\r\n\r\ndocuments.parsers.ParseError: MissingDependencyError: OCR engine does not have language data for the following requested languages:\r\n\r\nsrp-latn\r\n\r\nNote: most languages are identified by a 3-digit ISO 639-2 Code\r\n```\r\n\r\n\r\n### Browser logs\r\n\r\n_No response_\r\n\r\n### Paperless-ngx version\r\n\r\n1.10.1\r\n\r\n### Host OS\r\n\r\nDocker\r\n\r\n### Installation method\r\n\r\nDocker - official image\r\n\r\n### Browser\r\n\r\n_No response_\r\n\r\n### Configuration changes\r\n\r\n_No response_\r\n\r\n### Other\r\n\r\n_No response_\n", "before_files": [{"content": "import shutil\nimport subprocess\n\nfrom django.conf import settings\nfrom django.core.checks import Error\nfrom django.core.checks import register\nfrom django.core.checks import Warning\n\n\ndef get_tesseract_langs():\n    proc = subprocess.run(\n        [shutil.which(\"tesseract\"), \"--list-langs\"],\n        capture_output=True,\n    )\n\n    # Decode bytes to string, split on newlines, trim out the header\n    proc_lines = proc.stdout.decode(\"utf8\", errors=\"ignore\").strip().split(\"\\n\")[1:]\n\n    # Replace _ with - to convert two part languages to the expected code\n    return [x.replace(\"_\", \"-\") for x in proc_lines]\n\n\n@register()\ndef check_default_language_available(app_configs, **kwargs):\n    installed_langs = get_tesseract_langs()\n\n    if not settings.OCR_LANGUAGE:\n        return [\n            Warning(\n                \"No OCR language has been specified with PAPERLESS_OCR_LANGUAGE. \"\n                \"This means that tesseract will fallback to english.\",\n            ),\n        ]\n\n    specified_langs = settings.OCR_LANGUAGE.split(\"+\")\n\n    for lang in specified_langs:\n        if lang not in installed_langs:\n            return [\n                Error(\n                    f\"The selected ocr language {lang} is \"\n                    f\"not installed. Paperless cannot OCR your documents \"\n                    f\"without it. Please fix PAPERLESS_OCR_LANGUAGE.\",\n                ),\n            ]\n\n    return []\n", "path": "src/paperless_tesseract/checks.py"}], "after_files": [{"content": "import shutil\nimport subprocess\n\nfrom django.conf import settings\nfrom django.core.checks import Error\nfrom django.core.checks import register\nfrom django.core.checks import Warning\n\n\ndef get_tesseract_langs():\n    proc = subprocess.run(\n        [shutil.which(\"tesseract\"), \"--list-langs\"],\n        capture_output=True,\n    )\n\n    # Decode bytes to string, split on newlines, trim out the header\n    proc_lines = proc.stdout.decode(\"utf8\", errors=\"ignore\").strip().split(\"\\n\")[1:]\n\n    return [x.strip() for x in proc_lines]\n\n\n@register()\ndef check_default_language_available(app_configs, **kwargs):\n    installed_langs = get_tesseract_langs()\n\n    if not settings.OCR_LANGUAGE:\n        return [\n            Warning(\n                \"No OCR language has been specified with PAPERLESS_OCR_LANGUAGE. \"\n                \"This means that tesseract will fallback to english.\",\n            ),\n        ]\n\n    specified_langs = settings.OCR_LANGUAGE.split(\"+\")\n\n    for lang in specified_langs:\n        if lang not in installed_langs:\n            return [\n                Error(\n                    f\"The selected ocr language {lang} is \"\n                    f\"not installed. Paperless cannot OCR your documents \"\n                    f\"without it. Please fix PAPERLESS_OCR_LANGUAGE.\",\n                ),\n            ]\n\n    return []\n", "path": "src/paperless_tesseract/checks.py"}]}