Fallback to non-localized version if present instead of considering it a match

This commit is contained in:
Kovid Goyal 2020-10-25 10:44:02 +05:30
parent 0bb47ed9fe
commit ffa42fe809
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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):