Skip to content

Commit af288a5

Browse files
committed
chore: add i18n
1 parent dda8fac commit af288a5

File tree

3 files changed

+142
-65
lines changed

3 files changed

+142
-65
lines changed

apps/web-antd/src/locales/langs/en-US/page.json

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,8 @@
3535
"sysRole": "System Role",
3636
"sysUser": "System User"
3737
},
38-
"table": {
39-
"created_time": "Create Time",
40-
"id": "ID",
41-
"mark": "Mark",
42-
"operation": "Operation",
43-
"updated_time": "Update time"
44-
},
4538
"monitor": {
4639
"redis": {
47-
"desc": {
48-
"title": "Basic Information"
49-
},
5040
"cards": {
5141
"commands": {
5242
"title": "Command Statistics"
@@ -55,29 +45,66 @@
5545
"title": "Memory Status"
5646
}
5747
},
58-
"stats": {
59-
"title": {
60-
"used_memory": "Used Memory"
61-
}
48+
"desc": {
49+
"title": "Basic Information"
6250
},
6351
"info": {
64-
"title": "Basic Info",
65-
"version": "Version",
66-
"mode": "Mode",
67-
"os": "OS",
6852
"arch": "Arch",
69-
"uptime": "Uptime",
7053
"clients": "Connections",
71-
"memory_human": "Allocated Memory",
72-
"connections_received": "Connections Received",
7354
"commands_processed": "Commands Processed",
74-
"rejected_connections": "Rejected Connections",
55+
"connections_received": "Connections Received",
7556
"keys_command_stats": "Keys Stats",
57+
"keys_num": "Keys Num",
58+
"memory_human": "Allocated Memory",
59+
"mode": "Mode",
60+
"os": "OS",
61+
"rejected_connections": "Rejected Connections",
7662
"role": "Role",
63+
"title": "Basic Info",
64+
"uptime": "Uptime",
7765
"used_cpu": "Used CPU",
7866
"used_cpu_children": "Used CPU Children",
79-
"keys_num": "Keys Num"
67+
"version": "Version"
68+
},
69+
"stats": {
70+
"title": {
71+
"used_memory": "Used Memory"
72+
}
8073
}
74+
},
75+
"server": {
76+
"cpu": {
77+
"current_freq": "Current Freq",
78+
"logical_num": "Logical Num",
79+
"physical_num": "Physical Num",
80+
"usage": "Usage"
81+
},
82+
"disk": {
83+
"device": "Device",
84+
"dir": "Dir",
85+
"free": "Free",
86+
"title": "Disk",
87+
"total": "Total",
88+
"type": "Type",
89+
"usage": "Usage",
90+
"used": "Used"
91+
},
92+
"memory": {
93+
"free": "Free",
94+
"title": "Memory",
95+
"total": "Total",
96+
"usage": "Usage",
97+
"used": "Used"
98+
},
99+
"service": "Service",
100+
"system": "System"
81101
}
102+
},
103+
"table": {
104+
"created_time": "Created Time",
105+
"id": "ID",
106+
"mark": "Mark",
107+
"operation": "Operation",
108+
"updated_time": "Updated time"
82109
}
83110
}

apps/web-antd/src/locales/langs/zh-CN/page.json

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,8 @@
3535
"sysRole": "系统角色",
3636
"sysUser": "系统角色"
3737
},
38-
"table": {
39-
"created_time": "创建时间",
40-
"id": "序号",
41-
"mark": "备注",
42-
"operation": "操作",
43-
"updated_time": "更新时间"
44-
},
4538
"monitor": {
4639
"redis": {
47-
"desc": {
48-
"title": "基本信息"
49-
},
5040
"cards": {
5141
"commands": {
5242
"title": "命令统计"
@@ -55,29 +45,66 @@
5545
"title": "内存情况"
5646
}
5747
},
58-
"stats": {
59-
"title": {
60-
"used_memory": "已使用内存"
61-
}
48+
"desc": {
49+
"title": "基本信息"
6250
},
6351
"info": {
64-
"title": "基础信息",
65-
"version": "版本",
66-
"mode": "模式",
67-
"os": "操作系统",
6852
"arch": "架构",
69-
"uptime": "运行时间",
7053
"clients": "连接数",
71-
"memory_human": "已分配内存",
72-
"connections_received": "可接受连接数",
7354
"commands_processed": "已执行命令",
74-
"rejected_connections": "已拒绝连接",
55+
"connections_received": "可接受连接数",
7556
"keys_command_stats": "查询次数",
57+
"keys_num": "Keys 数量",
58+
"memory_human": "已分配内存",
59+
"mode": "模式",
60+
"os": "操作系统",
61+
"rejected_connections": "已拒绝连接",
7662
"role": "角色",
63+
"title": "基础信息",
64+
"uptime": "运行时间",
7765
"used_cpu": "CPU 消耗",
7866
"used_cpu_children": "后台 CPU 占用",
79-
"keys_num": "Keys 数量"
67+
"version": "版本"
68+
},
69+
"stats": {
70+
"title": {
71+
"used_memory": "已使用内存"
72+
}
8073
}
74+
},
75+
"server": {
76+
"cpu": {
77+
"current_freq": "当前频率",
78+
"logical_num": "逻辑核心数",
79+
"physical_num": "物理核心数",
80+
"usage": "使用率"
81+
},
82+
"disk": {
83+
"device": "设备",
84+
"dir": "路径",
85+
"free": "空闲",
86+
"title": "磁盘",
87+
"total": "总计",
88+
"type": "类型",
89+
"usage": "使用率",
90+
"used": "已使用"
91+
},
92+
"memory": {
93+
"free": "空闲",
94+
"title": "内存",
95+
"total": "总量",
96+
"usage": "使用率",
97+
"used": "已使用"
98+
},
99+
"service": "服务",
100+
"system": "系统"
81101
}
102+
},
103+
"table": {
104+
"created_time": "创建时间",
105+
"id": "序号",
106+
"mark": "备注",
107+
"operation": "操作",
108+
"updated_time": "更新时间"
82109
}
83110
}

apps/web-antd/src/views/monitor/server/index.vue

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts" setup>
22
import { computed, onMounted, ref } from 'vue';
33
4+
import { $t } from '@vben/locales';
5+
46
import { useVbenVxeGrid } from '#/adapter/vxe-table';
57
import { getServerMonitor } from '#/api';
68
@@ -91,13 +93,13 @@ const fetchServerData = async () => {
9193
const [Grid, gridApi] = useVbenVxeGrid({
9294
gridOptions: {
9395
columns: [
94-
{ field: 'dir', title: '路径' },
95-
{ field: 'type', title: '类型' },
96-
{ field: 'device', title: '设备' },
97-
{ field: 'total', title: '总计' },
98-
{ field: 'free', title: '空闲' },
99-
{ field: 'used', title: '已使用' },
100-
{ field: 'usage', title: '使用率' },
96+
{ field: 'dir', title: $t('page.monitor.server.disk.dir') },
97+
{ field: 'type', title: $t('page.monitor.server.disk.type') },
98+
{ field: 'device', title: $t('page.monitor.server.disk.device') },
99+
{ field: 'total', title: $t('page.monitor.server.disk.total') },
100+
{ field: 'free', title: $t('page.monitor.server.disk.free') },
101+
{ field: 'used', title: $t('page.monitor.server.disk.used') },
102+
{ field: 'usage', title: $t('page.monitor.server.disk.usage') },
101103
],
102104
stripe: true,
103105
pagerConfig: {
@@ -120,43 +122,64 @@ onMounted(async () => {
120122
<div class="mt-6 flex w-full space-x-6 px-6">
121123
<div class="flex-1">
122124
<a-statistic
123-
title="使用率"
125+
:title="$t('page.monitor.server.cpu.usage')"
124126
:value="cpuData.usage"
125127
:value-style="usageStyle('cpu')"
126128
suffix=" %"
127129
/>
128130
</div>
129131
<div class="flex-1">
130132
<a-statistic
131-
title="当前频率"
133+
:title="$t('page.monitor.server.cpu.current_freq')"
132134
:value="cpuData.current_freq"
133135
suffix=" MHz"
134136
/>
135137
</div>
136138
<div class="flex-1">
137-
<a-statistic title="逻辑核心数" :value="cpuData.logical_num" />
139+
<a-statistic
140+
:title="$t('page.monitor.server.cpu.logical_num')"
141+
:value="cpuData.logical_num"
142+
/>
138143
</div>
139144
<div class="flex-1">
140-
<a-statistic title="物理核心数" :value="cpuData.physical_num" />
145+
<a-statistic
146+
:title="$t('page.monitor.server.cpu.physical_num')"
147+
:value="cpuData.physical_num"
148+
/>
141149
</div>
142150
</div>
143151
</a-card>
144152
</div>
145153
<div class="flex-1">
146-
<a-card :loading="loading" title="内存">
154+
<a-card
155+
:loading="loading"
156+
:title="$t('page.monitor.server.memory.title')"
157+
>
147158
<div class="mt-6 flex w-full space-x-6 px-6">
148159
<div class="flex-1">
149-
<a-statistic title="总量" :value="memData.total" suffix=" GB" />
160+
<a-statistic
161+
:title="$t('page.monitor.server.memory.total')"
162+
:value="memData.total"
163+
suffix=" GB"
164+
/>
150165
</div>
151166
<div class="flex-1">
152-
<a-statistic title="已使用" :value="memData.used" suffix=" GB" />
167+
<a-statistic
168+
:title="$t('page.monitor.server.memory.used')"
169+
:value="memData.used"
170+
suffix=" GB"
171+
/>
153172
</div>
154173
<div class="flex-1">
155-
<a-statistic title="空闲" :value="memData.free" suffix=" GB" />
174+
<a-statistic
175+
:title="$t('page.monitor.server.memory.free')"
176+
:value="memData.free"
177+
suffix=" GB"
178+
/>
156179
</div>
157180
<div class="flex-1">
158181
<a-statistic
159-
title="使用率"
182+
:title="$t('page.monitor.server.memory.usage')"
160183
:value="memData.usage"
161184
:value-style="usageStyle('memory')"
162185
suffix=" %"
@@ -167,7 +190,7 @@ onMounted(async () => {
167190
</div>
168191
</div>
169192
<div class="mt-6 w-full space-y-6">
170-
<a-card :loading="loading" title="服务">
193+
<a-card :loading="loading" :title="$t('page.monitor.server.service')">
171194
<a-descriptions>
172195
<a-descriptions-item
173196
v-for="item in serviceData"
@@ -178,7 +201,7 @@ onMounted(async () => {
178201
</a-descriptions-item>
179202
</a-descriptions>
180203
</a-card>
181-
<a-card :loading="loading" title="系统">
204+
<a-card :loading="loading" :title="$t('page.monitor.server.system')">
182205
<a-descriptions size="middle" :column="4">
183206
<a-descriptions-item
184207
v-for="item in osData"
@@ -189,7 +212,7 @@ onMounted(async () => {
189212
</a-descriptions-item>
190213
</a-descriptions>
191214
</a-card>
192-
<a-card :loading="loading" title="磁盘">
215+
<a-card :loading="loading" :title="$t('page.monitor.server.disk.title')">
193216
<Grid />
194217
</a-card>
195218
</div>

0 commit comments

Comments
 (0)