1
0
Fork 0
mirror of synced 2024-05-24 14:29:58 +12:00

Legendary: Do a smarter split

This commit is contained in:
loathingKernel 2024-01-24 18:00:19 +02:00
parent fe709f5702
commit 58574c1977

View file

@ -149,7 +149,7 @@ class LegendarySettings(QWidget, Ui_LegendarySettings):
def locale_edit_cb(text: str) -> Tuple[bool, str, int]:
if text:
if re.match("^[a-zA-Z]{2,3}[-_][a-zA-Z]{2,3}$", text):
language, country = text.replace("_", "-").split("-")
language, country = text.split("-" if "-" in text else "_")
text = "-".join([language.lower(), country.upper()])
if bool(re.match("^[a-z]{2,3}-[A-Z]{2,3}$", text)):
return True, text, IndicatorReasonsCommon.VALID