From 8534e8cf5bce76c7b487b3be89ee05b86d0bd190 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Sun, 22 Sep 2024 16:33:22 +0800 Subject: [PATCH] Still working on translating.... --- src/dashboard.py | 17 ++++++++--------- .../configurationComponents/peerCreate.vue | 2 +- .../configurationComponents/peerSettings.vue | 2 +- src/static/locale/zh-CN.json | 16 +++++++++++++++- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 18b246d..16ff44d 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -966,19 +966,19 @@ class Peer: list(filter(lambda k: k.id != self.id, self.configuration.getPeersList()))))) for item in row] if allowed_ip in existingAllowedIps: - return ResponseObject(False, "Allowed IP already taken by another peer.") + return ResponseObject(False, "Allowed IP already taken by another peer") if not _checkIPWithRange(endpoint_allowed_ip): - return ResponseObject(False, f"Endpoint Allowed IPs format is incorrect.") + return ResponseObject(False, f"Endpoint Allowed IPs format is incorrect") if len(dns_addresses) > 0 and not _checkDNS(dns_addresses): - return ResponseObject(False, f"DNS format is incorrect.") + return ResponseObject(False, f"DNS format is incorrect") if mtu < 0 or mtu > 1460: - return ResponseObject(False, "MTU format is not correct.") + return ResponseObject(False, "MTU format is not correct") if keepalive < 0: - return ResponseObject(False, "Persistent Keepalive format is not correct.") + return ResponseObject(False, "Persistent Keepalive format is not correct") if len(private_key) > 0: pubKey = _generatePublicKey(private_key) if not pubKey[0] or pubKey[1] != self.id: - return ResponseObject(False, "Private key does not match with the public key.") + return ResponseObject(False, "Private key does not match with the public key") try: if len(preshared_key) > 0: rd = random.Random() @@ -1805,7 +1805,7 @@ def API_addPeers(configName): if configName in WireguardConfigurations.keys(): config = WireguardConfigurations.get(configName) if (not bulkAdd and (len(public_key) == 0 or len(allowed_ips) == 0)) or len(endpoint_allowed_ip) == 0: - return ResponseObject(False, "Please fill in all required box.") + return ResponseObject(False, "Please fill in all required box") if not config.getStatus(): config.toggleConfiguration() @@ -1814,7 +1814,6 @@ def API_addPeers(configName): if bulkAdd: if bulkAddAmount < 1: return ResponseObject(False, "Please specify amount of peers you want to add") - if not availableIps[0]: return ResponseObject(False, "No more available IP can assign") if bulkAddAmount > len(availableIps[1]): @@ -1845,7 +1844,7 @@ def API_addPeers(configName): else: if config.searchPeer(public_key)[0] is True: - return ResponseObject(False, f"This peer already exist.") + return ResponseObject(False, f"This peer already exist") name = data['name'] private_key = data['private_key'] diff --git a/src/static/app/src/components/configurationComponents/peerCreate.vue b/src/static/app/src/components/configurationComponents/peerCreate.vue index 9daea8b..1b1d3a3 100644 --- a/src/static/app/src/components/configurationComponents/peerCreate.vue +++ b/src/static/app/src/components/configurationComponents/peerCreate.vue @@ -62,7 +62,7 @@ export default { fetchPost("/api/addPeers/" + this.$route.params.id, this.data, (res) => { if (res.status){ this.$router.push(`/configuration/${this.$route.params.id}/peers`) - this.dashboardStore.newMessage("Server", "Peer create successfully", "success") + this.dashboardStore.newMessage("Server", "Peer created successfully", "success") }else{ this.dashboardStore.newMessage("Server", res.message, "danger") } diff --git a/src/static/app/src/components/configurationComponents/peerSettings.vue b/src/static/app/src/components/configurationComponents/peerSettings.vue index d5f3ee2..d45a30b 100644 --- a/src/static/app/src/components/configurationComponents/peerSettings.vue +++ b/src/static/app/src/components/configurationComponents/peerSettings.vue @@ -33,7 +33,7 @@ export default { fetchPost(`/api/updatePeerSettings/${this.$route.params.id}`, this.data, (res) => { this.saving = false; if (res.status){ - this.dashboardConfigurationStore.newMessage("Server", "Peer Updated!", "success") + this.dashboardConfigurationStore.newMessage("Server", "Peer saved", "success") }else{ this.dashboardConfigurationStore.newMessage("Server", res.message, "danger") } diff --git a/src/static/locale/zh-CN.json b/src/static/locale/zh-CN.json index 8a45d77..d24fd43 100644 --- a/src/static/locale/zh-CN.json +++ b/src/static/locale/zh-CN.json @@ -176,5 +176,19 @@ "FROM ": "来自 ", "(.*) is on": "$1 已启用", "(.*) is off": "$1 已停用", - "Allowed IPs is invalid": "允许的 IP 地址错误" + "Allowed IPs is invalid": "允许的 IP 地址错误", + "Peer created successfully": "成功创建端点", + "Please fill in all required box": "请填写所有必填项", + "Please specify amount of peers you want to add": "请提供批量添加端点的数量", + "No more available IP can assign": "没有更多可用的 IP 可以分配了", + "The maximum number of peers can add is (.*)": "最多只能添加$1个端点", + "Generating key pairs by bulk failed": "生成公钥秘钥失败了", + "Failed to add peers in bulk": "批量创建端点失败", + "This peer already exist": "此端点已存在", + "This IP is not available: (.*)": "此 IP 地址不可用:$1", + "Configuration does not exist": "此配置不存在", + "Please provide a valid configuration name": "请提供一个正确的配置名称", + "Peer saved": "端点保存成功", + "Allowed IP already taken by another peer": "允许的 IP 地址已被其他端点使用", + "Endpoint Allowed IPs format is incorrect": "" } \ No newline at end of file