1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 07:10:09 +01:00

Translating to zh-cn is done

This commit is contained in:
Donald Zou 2024-09-22 21:50:30 +08:00
parent c269e46892
commit 21672f99d1
11 changed files with 44 additions and 25 deletions

View File

@ -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/<configName>")
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'],

View File

@ -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 = "";

View File

@ -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;

View File

@ -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

View File

@ -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")
}
})

View File

@ -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')

View File

@ -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")
}
})
},

View File

@ -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")

View File

@ -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()

View File

@ -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)
}

View File

@ -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"
}