mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-06-28 17:31:07 +03:00
i18n fixes
This commit is contained in:
+11
-8
@@ -809,6 +809,16 @@ def merge_adv_from_form(
|
||||
base[key] = default_config[key]
|
||||
|
||||
|
||||
def _dc_validation_message(error: ValueError) -> str:
|
||||
exc_entry = getattr(error, "entry", None)
|
||||
if exc_entry is None:
|
||||
return str(error)
|
||||
kind = getattr(error, "kind", "invalid")
|
||||
if kind == "format":
|
||||
return t("validation.dc_format", entry=exc_entry)
|
||||
return t("validation.dc_invalid", entry=exc_entry)
|
||||
|
||||
|
||||
def validate_config_form(
|
||||
widgets: TrayConfigFormWidgets,
|
||||
default_config: dict,
|
||||
@@ -838,14 +848,7 @@ def validate_config_form(
|
||||
try:
|
||||
parse_dc_ip_list(lines)
|
||||
except ValueError as e:
|
||||
msg = str(e)
|
||||
if "expected DC:IP" in msg:
|
||||
entry = msg.split("format ", 1)[-1].rstrip(")")
|
||||
return t("validation.dc_format", entry=entry.strip("'"))
|
||||
if msg.startswith("Invalid --dc-ip "):
|
||||
entry = msg.split(" ", 2)[-1]
|
||||
return t("validation.dc_invalid", entry=entry)
|
||||
return msg
|
||||
return _dc_validation_message(e)
|
||||
|
||||
secret_val = widgets.secret_var.get().strip()
|
||||
if len(secret_val) != 32:
|
||||
|
||||
Reference in New Issue
Block a user