Sort OCR languages when loading them from json

Because now the ocr-languages.json is sorted by tesseract language arg
name, we'll want to sort the languages the user sees alphabetically.
This commit is contained in:
deeplow 2023-02-28 20:07:41 +00:00
parent 58332fdd6e
commit bc50917362
No known key found for this signature in database
GPG key ID: 577982871529A52A

View file

@ -34,7 +34,8 @@ class DangerzoneCore(object):
# Languages supported by tesseract
with open(get_resource_path("ocr-languages.json"), "r") as f:
self.ocr_languages = json.load(f)
unsorted_ocr_languages = json.load(f)
self.ocr_languages = dict(sorted(unsorted_ocr_languages.items()))
# Load settings
self.settings = Settings(self)