Legendary: Do a smarter split
This commit is contained in:
parent
fe709f5702
commit
58574c1977
|
@ -149,7 +149,7 @@ class LegendarySettings(QWidget, Ui_LegendarySettings):
|
||||||
def locale_edit_cb(text: str) -> Tuple[bool, str, int]:
|
def locale_edit_cb(text: str) -> Tuple[bool, str, int]:
|
||||||
if text:
|
if text:
|
||||||
if re.match("^[a-zA-Z]{2,3}[-_][a-zA-Z]{2,3}$", 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()])
|
text = "-".join([language.lower(), country.upper()])
|
||||||
if bool(re.match("^[a-z]{2,3}-[A-Z]{2,3}$", text)):
|
if bool(re.match("^[a-z]{2,3}-[A-Z]{2,3}$", text)):
|
||||||
return True, text, IndicatorReasonsCommon.VALID
|
return True, text, IndicatorReasonsCommon.VALID
|
||||||
|
|
Loading…
Reference in a new issue