From 8374353d515bd4ffcf4473c6aaecbcf6b1823793 Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:19:29 +0200 Subject: [PATCH] fix script variante includes in the lang_code Some dictionaries add a script variante in their lang_code, for example: https://github.com/LibreOffice/dictionaries/tree/master/mn_MN --- src/calibre/spell/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/spell/__init__.py b/src/calibre/spell/__init__.py index e6c2b4265f..8755460c09 100644 --- a/src/calibre/spell/__init__.py +++ b/src/calibre/spell/__init__.py @@ -23,6 +23,9 @@ def parse_lang_code(raw): if lc is None: raise ValueError('Invalid language code: %r' % raw) cc = None + for sc in ['Cyrl', 'Latn']: + if sc in parts: + parts.remove(sc) if len(parts) > 1: ccodes, ccodemap = get_codes()[:2] q = parts[1].upper()