From ffa42fe809a32ae3806006903b67b2ab08c45e09 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 25 Oct 2020 10:44:02 +0530 Subject: [PATCH] Fallback to non-localized version if present instead of considering it a match --- src/calibre/utils/open_with/linux.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/open_with/linux.py b/src/calibre/utils/open_with/linux.py index f3fc99edf3..98dfe08cd9 100644 --- a/src/calibre/utils/open_with/linux.py +++ b/src/calibre/utils/open_with/linux.py @@ -176,12 +176,14 @@ def localize_string(data): def key_matches(key): if key is None: - return True + return False base = re.split(r'[_.@]', key)[0] return canonicalize_lang(base) == lang matches = tuple(filter(key_matches, data)) - return data[matches[0]] if matches else '' + if matches: + return data[matches[0]] + return data.get(None) or '' def process_desktop_file(data):