From 02c22219703321eab4824c6a0307cc6dc211d2c1 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Thu, 12 Sep 2024 15:21:42 +0800 Subject: [PATCH] Still working on localization --- .../configurationComponents/peerList.vue | 56 ++++++++++++++----- .../configurationComponents/peerSearch.vue | 56 ++++++++++++------- .../dashboardAPIKey.vue | 4 +- .../newDashboardAPIKey.vue | 17 ++++-- ...ettingsInputWireguardConfigurationPath.vue | 2 +- src/static/app/src/utilities/locale.js | 8 +-- src/static/locale/zh-CN.json | 36 +++++++++++- 7 files changed, 129 insertions(+), 50 deletions(-) diff --git a/src/static/app/src/components/configurationComponents/peerList.vue b/src/static/app/src/components/configurationComponents/peerList.vue index a73cb96..e9703e6 100644 --- a/src/static/app/src/components/configurationComponents/peerList.vue +++ b/src/static/app/src/components/configurationComponents/peerList.vue @@ -41,6 +41,7 @@ import PeerJobsAllModal from "@/components/configurationComponents/peerJobsAllMo import PeerJobsLogsModal from "@/components/configurationComponents/peerJobsLogsModal.vue"; import {ref} from "vue"; import PeerShareLinkModal from "@/components/configurationComponents/peerShareLinkModal.vue"; +import LocaleText from "@/components/text/localeText.vue"; Chart.register( ArcElement, @@ -71,6 +72,7 @@ Chart.register( export default { name: "peerList", components: { + LocaleText, PeerShareLinkModal, PeerJobsLogsModal, PeerJobsAllModal, PeerJobs, PeerCreate, PeerQRCode, PeerSettings, PeerSearch, Peer, Line, Bar}, @@ -410,7 +412,9 @@ export default {
- CONFIGURATION + + +

{{this.configurationInfo.Name}}

@@ -418,13 +422,15 @@ export default {
-

Status

+

+ +

-

Address

+

+ +

{{this.configurationInfo.Address}}
@@ -452,7 +460,9 @@ export default {
-

Listen Port

+

+ +

{{this.configurationInfo.ListenPort}}
@@ -460,7 +470,9 @@ export default {
-

Public Key

+

+ +

{{this.configurationInfo.PublicKey}}
@@ -471,7 +483,9 @@ export default {
-

Connected Peers

+

+ +

{{configurationSummary.connectedPeers}}
@@ -482,7 +496,9 @@ export default {
-

Total Usage

+

+ +

{{configurationSummary.totalUsage}} GB
@@ -493,7 +509,9 @@ export default {
-

Total Received

+

+ +

{{configurationSummary.totalReceive}} GB
@@ -504,7 +522,9 @@ export default {
-

Total Sent

+

+ +

{{configurationSummary.totalSent}} GB
@@ -516,7 +536,9 @@ export default {
- Peers Total Data Usage
+ + +
-
Real Time Received Data Usage
+
+ +
-
Real Time Sent Data Usage
+
+ +
@@ -89,16 +94,18 @@ export default { - Peer + +
@@ -108,7 +115,7 @@ export default { class="btn text-secondary-emphasis bg-secondary-subtle rounded-3 border-1 border-secondary-subtle shadow-sm" type="button" aria-expanded="false"> - Display +
-

Refresh interval

+

+ +

-

Configuration Settings +

+

diff --git a/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/dashboardAPIKey.vue b/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/dashboardAPIKey.vue index cfab899..79f918a 100644 --- a/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/dashboardAPIKey.vue +++ b/src/static/app/src/components/settingsComponent/dashboardAPIKeysComponents/dashboardAPIKey.vue @@ -48,7 +48,9 @@ export default { - {{this.apiKey.ExpiredAt ? this.apiKey.ExpiredAt : 'Never'}} + + + {{ this.apiKey.ExpiredAt }}
-
Create API Key
+
+ +
- When should this API Key expire? + + +
diff --git a/src/static/app/src/components/settingsComponent/dashboardSettingsInputWireguardConfigurationPath.vue b/src/static/app/src/components/settingsComponent/dashboardSettingsInputWireguardConfigurationPath.vue index 4424fc2..d96997d 100644 --- a/src/static/app/src/components/settingsComponent/dashboardSettingsInputWireguardConfigurationPath.vue +++ b/src/static/app/src/components/settingsComponent/dashboardSettingsInputWireguardConfigurationPath.vue @@ -72,7 +72,7 @@ export default { -
+
{ - console.log(key) - if (window.Locale === null) return key - const reg = Object.keys(window.Locale) const match = reg.filter(x => { - return key.match(new RegExp('^' + x + '$', 'g')) !== null + return key.match(new RegExp('^' + x + '$', 'gi')) !== null }) - console.log(match) if (match.length === 0 || match.length > 1){ return key } - return window.Locale[match[0]] + return key.replace(new RegExp(match[0], 'gi'), window.Locale[match[0]]) } \ No newline at end of file diff --git a/src/static/locale/zh-CN.json b/src/static/locale/zh-CN.json index cc2d8dd..a16da89 100644 --- a/src/static/locale/zh-CN.json +++ b/src/static/locale/zh-CN.json @@ -45,5 +45,39 @@ "Disabled": "已停用", "No WGDashboard API Key": "没有 WGDashboard API 秘钥", "Expire At": "过期于", - "Are you sure to delete this API key\\?": "确定删除此 API 秘钥?" + "Are you sure to delete this API key\\?": "确定删除此 API 秘钥?", + "Create API Key": "创建 API 秘钥", + "When should this API Key expire\\?": "这个 API 秘钥什么时候过期呢?", + "Never Expire": "从不过期", + "Don't think that's a good idea": "我不觉得这是一个好主意", + "Creating\\.\\.\\.": "创建中...", + "Create": "创建", + "Status": "状态", + "On": "已启用", + "Off": "已停用", + "Address": "网络地址", + "Listen Port": "监听端口", + "Public Key": "公钥", + "Connected Peers": "已连接端点", + "Total Usage": "总数据用量", + "Total Received": "总接收数据用量", + "Total Sent": "总发送数据用量", + "Peers Data Usage": "端点的数据用量", + "Real Time Received Data Usage": "实时接收数据量", + "Real Time Sent Data Usage": "实时发送数据量", + "Peer": "端点", + "Download All": "全部下载", + "Search Peers\\.\\.\\.": "搜索端点...", + "Display": "显示设置", + "Sort By": "排列方式", + "Refresh Interval": "刷新间隔", + "Name": "名字", + "Allowed IP": "允许 IP 地址", + "Restricted": "已限制端点", + "(.*) Seconds": "$1 秒", + "(.*) Minutes": "$1 分钟", + "Configuration Settings": "配置设定", + "Peer Jobs": "端点任务", + "Active Jobs": "未运行任务", + "Logs": "日志" } \ No newline at end of file