Skip to content

Commit

Permalink
Fixed compute percentage for local lang
Browse files Browse the repository at this point in the history
  • Loading branch information
panther7 committed Oct 10, 2023
1 parent 463183e commit 1f2735f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions wingetui/Interface/GenericSections.py
Expand Up @@ -289,16 +289,21 @@ def __init__(self, parent=None):
if perc == "0%":
continue
if key not in lang["locale"]:
langListWithPercentage.append(f"{value} ({perc})")
langDictWithPercentage[key] = f"{value} ({perc})"
invertedLangDict[f"{value} ({perc})"] = key
langValue = f"{value} ({perc})"
langListWithPercentage.append(langValue)
langDictWithPercentage[key] = langValue
invertedLangDict[langValue] = key
else:
k = len(lang.keys())
v = len([val for val in lang.values() if val is None])
perc = f"{int(v/k*100)}%"
langListWithPercentage.append(f"{value} ({perc})")
langDictWithPercentage[key] = f"{value} ({perc})"
invertedLangDict[f"{value} ({perc})"] = key
v = len([val for val in lang.values() if val != None])
percNum = v / k
perc = f"{percNum:.0%}"
if (perc == "100%" and percNum < 1):
perc = "99%"
langValue = f"{value} ({perc})"
langListWithPercentage.append(langValue)
langDictWithPercentage[key] = langValue
invertedLangDict[langValue] = key
else:
invertedLangDict[value] = key
langDictWithPercentage[key] = value
Expand Down

0 comments on commit 1f2735f

Please sign in to comment.