mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fallback to non-localized version if present instead of considering it a match
This commit is contained in:
parent
0bb47ed9fe
commit
ffa42fe809
@ -176,12 +176,14 @@ def localize_string(data):
|
|||||||
|
|
||||||
def key_matches(key):
|
def key_matches(key):
|
||||||
if key is None:
|
if key is None:
|
||||||
return True
|
return False
|
||||||
base = re.split(r'[_.@]', key)[0]
|
base = re.split(r'[_.@]', key)[0]
|
||||||
return canonicalize_lang(base) == lang
|
return canonicalize_lang(base) == lang
|
||||||
|
|
||||||
matches = tuple(filter(key_matches, data))
|
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):
|
def process_desktop_file(data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user