From 21672f99d1be05825282e53072967408ca83ff15 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Sun, 22 Sep 2024 21:50:30 +0800 Subject: [PATCH] Translating to zh-cn is done --- src/dashboard.py | 23 ++++++++---------- .../newPeersComponents/dnsInput.vue | 2 +- .../newPeersComponents/endpointAllowedIps.vue | 2 +- .../privatePublicKeyInput.vue | 2 +- .../schedulePeerJob.vue | 4 ++-- .../configurationCard.vue | 2 +- .../settingsComponent/dashboardAPIKeys.vue | 2 +- .../newDashboardAPIKey.vue | 2 +- src/static/app/src/router/index.js | 2 +- src/static/app/src/utilities/fetch.js | 4 ++-- src/static/locale/zh-CN.json | 24 ++++++++++++++++++- 11 files changed, 44 insertions(+), 25 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 4f9e43f..2d07475 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -1599,13 +1599,10 @@ def API_addWireguardConfiguration(): @app.route(f'{APP_PREFIX}/api/toggleWireguardConfiguration/') def API_toggleWireguardConfiguration(): configurationName = request.args.get('configurationName') - if configurationName is None or len( configurationName) == 0 or configurationName not in WireguardConfigurations.keys(): return ResponseObject(False, "Please provide a valid configuration name") - toggleStatus, msg = WireguardConfigurations[configurationName].toggleConfiguration() - return ResponseObject(toggleStatus, msg, WireguardConfigurations[configurationName].Status) @@ -1638,7 +1635,7 @@ def API_updateDashboardConfigurationItem(): def API_getDashboardAPIKeys(): if DashboardConfig.GetConfig('Server', 'dashboard_api_key'): return ResponseObject(data=DashboardConfig.DashboardAPIKeys) - return ResponseObject(False, "Dashboard API Keys function is disabled") + return ResponseObject(False, "WGDashboard API Keys function is disabled") @app.route(f'{APP_PREFIX}/api/newDashboardAPIKey', methods=['POST']) def API_newDashboardAPIKey(): @@ -1704,7 +1701,7 @@ def API_deletePeers(configName: str) -> ResponseObject: peers = data['peers'] if configName in WireguardConfigurations.keys(): if len(peers) == 0: - return ResponseObject(False, "Please specify more than one peer") + return ResponseObject(False, "Please specify one or more peers") configuration = WireguardConfigurations.get(configName) return configuration.deletePeers(peers) @@ -1717,7 +1714,7 @@ def API_restrictPeers(configName: str) -> ResponseObject: peers = data['peers'] if configName in WireguardConfigurations.keys(): if len(peers) == 0: - return ResponseObject(False, "Please specify more than one peer") + return ResponseObject(False, "Please specify one or more peers") configuration = WireguardConfigurations.get(configName) return configuration.restrictPeers(peers) return ResponseObject(False, "Configuration does not exist") @@ -1729,7 +1726,7 @@ def API_sharePeer_create(): Peer = data.get('Peer') ExpireDate = data.get('ExpireDate') if Configuration is None or Peer is None: - return ResponseObject(False, "Please specify configuration and peer") + return ResponseObject(False, "Please specify configuration and peers") activeLink = AllPeerShareLinks.getLink(Configuration, Peer) if len(activeLink) > 0: return ResponseObject(False, "This peer is already sharing, please stop sharing first.") @@ -1782,7 +1779,7 @@ def API_allowAccessPeers(configName: str) -> ResponseObject: peers = data['peers'] if configName in WireguardConfigurations.keys(): if len(peers) == 0: - return ResponseObject(False, "Please specify more than one peer") + return ResponseObject(False, "Please specify one or more peers") configuration = WireguardConfigurations.get(configName) return configuration.allowAccessPeers(peers) return ResponseObject(False, "Configuration does not exist") @@ -1865,18 +1862,18 @@ def API_addPeers(configName): def API_downloadPeer(configName): data = request.args if configName not in WireguardConfigurations.keys(): - return ResponseObject(False, "Configuration or peer does not exist") + return ResponseObject(False, "Configuration does not exist") configuration = WireguardConfigurations[configName] peerFound, peer = configuration.searchPeer(data['id']) if len(data['id']) == 0 or not peerFound: - return ResponseObject(False, "Configuration or peer does not exist") + return ResponseObject(False, "Peer does not exist") return ResponseObject(data=peer.downloadPeer()) @app.route(f"{APP_PREFIX}/api/downloadAllPeers/") def API_downloadAllPeers(configName): if configName not in WireguardConfigurations.keys(): - return ResponseObject(False, "Configuration or peer does not exist") + return ResponseObject(False, "Configuration does not exist") configuration = WireguardConfigurations[configName] peerData = [] untitledPeer = 0 @@ -1927,7 +1924,7 @@ def API_savePeerScheduleJob(): configuration = WireguardConfigurations.get(job['Configuration']) f, fp = configuration.searchPeer(job['Peer']) if not f: - return ResponseObject(False, "Peer does not exist in this configuration") + return ResponseObject(False, "Peer does not exist") s, p = AllPeerJobs.saveJob(PeerJob( job['JobID'], job['Configuration'], job['Peer'], job['Field'], job['Operator'], job['Value'], @@ -1947,7 +1944,7 @@ def API_deletePeerScheduleJob(): configuration = WireguardConfigurations.get(job['Configuration']) f, fp = configuration.searchPeer(job['Peer']) if not f: - return ResponseObject(False, "Peer does not exist in this configuration") + return ResponseObject(False, "Peer does not exist") s, p = AllPeerJobs.deleteJob(PeerJob( job['JobID'], job['Configuration'], job['Peer'], job['Field'], job['Operator'], job['Value'], diff --git a/src/static/app/src/components/configurationComponents/newPeersComponents/dnsInput.vue b/src/static/app/src/components/configurationComponents/newPeersComponents/dnsInput.vue index 83c04bc..76552b7 100644 --- a/src/static/app/src/components/configurationComponents/newPeersComponents/dnsInput.vue +++ b/src/static/app/src/components/configurationComponents/newPeersComponents/dnsInput.vue @@ -29,7 +29,7 @@ export default { for(let ip in i){ if (!this.store.regexCheckIP(i[ip])){ if (!this.error){ - this.dashboardStore.newMessage("WGDashboard", "DNS is invalid", "danger"); + this.dashboardStore.newMessage("WGDashboard", "DNS format is incorrect", "danger"); } this.error = true; this.data.DNS = ""; diff --git a/src/static/app/src/components/configurationComponents/newPeersComponents/endpointAllowedIps.vue b/src/static/app/src/components/configurationComponents/newPeersComponents/endpointAllowedIps.vue index 3f5997d..5c56923 100644 --- a/src/static/app/src/components/configurationComponents/newPeersComponents/endpointAllowedIps.vue +++ b/src/static/app/src/components/configurationComponents/newPeersComponents/endpointAllowedIps.vue @@ -27,7 +27,7 @@ export default { for (let ip in i){ if (!this.store.checkCIDR(i[ip])){ if (!this.error){ - this.dashboardStore.newMessage("WGDashboard", "Endpoint Allowed IP is invalid.", "danger") + this.dashboardStore.newMessage("WGDashboard", "Endpoint Allowed IPs format is incorrect", "danger") } this.data.endpoint_allowed_ip = ""; this.error = true; diff --git a/src/static/app/src/components/configurationComponents/newPeersComponents/privatePublicKeyInput.vue b/src/static/app/src/components/configurationComponents/newPeersComponents/privatePublicKeyInput.vue index 6263727..6362adc 100644 --- a/src/static/app/src/components/configurationComponents/newPeersComponents/privatePublicKeyInput.vue +++ b/src/static/app/src/components/configurationComponents/newPeersComponents/privatePublicKeyInput.vue @@ -44,7 +44,7 @@ export default { if (window.wireguard.generatePublicKey(this.keypair.privateKey) !== this.keypair.publicKey){ this.error = true; - this.dashboardStore.newMessage("WGDashboard", "Private Key and Public Key does not match.", "danger"); + this.dashboardStore.newMessage("WGDashboard", "Private key does not match with the public key", "danger"); }else{ this.data.private_key = this.keypair.privateKey this.data.public_key = this.keypair.publicKey diff --git a/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue b/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue index fc3a782..e6142c6 100644 --- a/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue +++ b/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/schedulePeerJob.vue @@ -51,7 +51,7 @@ export default { }, (res) => { if (res.status){ this.edit = false; - this.store.newMessage("Server", "Job Saved!", "success") + this.store.newMessage("Server", "Peer job saved", "success") console.log(res.data) this.$emit("refresh", res.data[0]) this.newJob = false; @@ -91,7 +91,7 @@ export default { this.store.newMessage("Server", res.message, "danger") this.$emit('delete') }else{ - this.store.newMessage("Server", "Job Deleted!", "success") + this.store.newMessage("Server", "Peer job deleted", "success") } }) diff --git a/src/static/app/src/components/configurationListComponents/configurationCard.vue b/src/static/app/src/components/configurationListComponents/configurationCard.vue index c0ec6ec..d5163c1 100644 --- a/src/static/app/src/components/configurationListComponents/configurationCard.vue +++ b/src/static/app/src/components/configurationListComponents/configurationCard.vue @@ -31,7 +31,7 @@ export default { }, (res) => { if (res.status){ this.dashboardConfigurationStore.newMessage("Server", - `${this.c.Name} is ${res.data ? 'is on':'is off'}`) + `${this.c.Name} ${res.data ? 'is on':'is off'}`) }else{ this.dashboardConfigurationStore.newMessage("Server", res.message, 'danger') diff --git a/src/static/app/src/components/settingsComponent/dashboardAPIKeys.vue b/src/static/app/src/components/settingsComponent/dashboardAPIKeys.vue index 4f750b5..810456f 100644 --- a/src/static/app/src/components/settingsComponent/dashboardAPIKeys.vue +++ b/src/static/app/src/components/settingsComponent/dashboardAPIKeys.vue @@ -34,7 +34,7 @@ export default { }else{ this.value = this.store.Configuration.Peers[this.targetData]; this.store.newMessage("Server", - `API Keys function is failed ${this.value ? 'enabled':'disabled'}`, "danger") + `API Keys function is failed to ${this.value ? 'enabled':'disabled'}`, "danger") } }) }, diff --git a/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue b/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue index fc1d329..ed38df2 100644 --- a/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue +++ b/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/newDashboardAPIKey.vue @@ -31,7 +31,7 @@ export default { fetchPost('/api/newDashboardAPIKey', this.newKeyData, (res) => { if (res.status){ this.$emit('created', res.data); - this.store.newMessage("Server", "New API Key created", "success"); + this.store.newMessage("Server", "API Key created", "success"); this.$emit('close') }else{ this.store.newMessage("Server", res.message, "danger") diff --git a/src/static/app/src/router/index.js b/src/static/app/src/router/index.js index 84ec48f..7df462e 100644 --- a/src/static/app/src/router/index.js +++ b/src/static/app/src/router/index.js @@ -149,7 +149,7 @@ router.beforeEach(async (to, from, next) => { }else{ dashboardConfigurationStore.Redirect = to; next("/signin") - dashboardConfigurationStore.newMessage("WGDashboard", "Session Ended", "warning") + dashboardConfigurationStore.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning") } }else{ await dashboardConfigurationStore.getConfiguration() diff --git a/src/static/app/src/utilities/fetch.js b/src/static/app/src/utilities/fetch.js index 9d25109..8819e69 100644 --- a/src/static/app/src/utilities/fetch.js +++ b/src/static/app/src/utilities/fetch.js @@ -37,7 +37,7 @@ export const fetchGet = async (url, params=undefined, callback=undefined) => { if (x.status !== 200){ if (x.status === 401){ - store.newMessage("WGDashboard", "Session Ended", "warning") + store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning") } throw new Error(x.statusText) } @@ -61,7 +61,7 @@ export const fetchPost = async (url, body, callback) => { if (x.status !== 200){ if (x.status === 401){ - store.newMessage("WGDashboard", "Session Ended", "warning") + store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning") } throw new Error(x.statusText) } diff --git a/src/static/locale/zh-CN.json b/src/static/locale/zh-CN.json index 469ad35..55af8ba 100644 --- a/src/static/locale/zh-CN.json +++ b/src/static/locale/zh-CN.json @@ -187,6 +187,7 @@ "This peer already exist": "此端点已存在", "This IP is not available: (.*)": "此 IP 地址不可用:$1", "Configuration does not exist": "此配置不存在", + "Peer does not exist": "此端点不存在", "Please provide a valid configuration name": "请提供一个正确的配置名称", "Peer saved": "端点保存成功", "Allowed IPs already taken by another peer": "允许的 IP 地址已被其他端点使用", @@ -198,5 +199,26 @@ "Update peer failed when updating Pre-Shared Key": "更新共享密钥失败", "Update peer failed when updating Allowed IPs": "更新允许的 IP 地址失败", "Update peer failed when saving the configuration": "配置保存端点失败", - "Peer data usage reset successfully": "端点数据重置成功" + "Peer data usage reset successfully": "端点数据重置成功", + "Peer download started": "端点文件下载开始", + "Please specify one or more peers": "请提供一个或更多端点", + "Share link failed to create. Reason: (.*)": "端点分享链接生成失败。原因:$1", + "Link expire date updated": "分享链接过期时间更新成功", + "Link expire date failed to update. Reason: (.*)": "分享链接过期时间更新失败。原因:$1", + "Peer job saved": "端点任务保存成功", + "Please specify job": "请提供任务", + "Please specify peer and configuration": "请提供配置名称以及端点", + "Peer job deleted": "端点任务删除成功", + "API Keys function is successfully enabled": "API 秘钥功能开启成功", + "API Keys function is successfully disabled": "API 秘钥功能停用成功", + "API Keys function is failed to enable": "API 秘钥功能开启失败", + "API Keys function is failed to disable": "API 秘钥功能停用失败", + "WGDashboard API Keys function is disabled": "WGDashboard 的 API 秘钥功能并未开启", + "WireGuard configuration path saved": "WireGuard 配置路径保存成功", + "API Key deleted": "API 秘钥删除成功", + "API Key created": "API 秘钥创建成功", + "Sign in session ended, please sign in again": "登录已过期,请重新登录", + "Please specify an IP Address (v4/v6)": "请提供一个 IP 地址 (v4或v6)", + "Please provide ipAddress and count": "请提供 ipAddress 和 count", + "Please provide ipAddress": "请提供 ipAddress" } \ No newline at end of file