update: translate dashboard

This commit is contained in:
Mohammad Foroughi
2022-10-30 07:20:40 +03:30
parent ab0a7f9fd9
commit 9289ce691b
4 changed files with 78 additions and 28 deletions

View File

@@ -33,13 +33,13 @@ function safeBase64(str) {
function formatSecond(second) {
if (second < 60) {
return second.toFixed(0) + ' ';
return second.toFixed(0) + ' s';
} else if (second < 3600) {
return (second / 60).toFixed(0) + ' 分钟';
return (second / 60).toFixed(0) + ' m';
} else if (second < 3600 * 24) {
return (second / 3600).toFixed(0) + ' 小时';
return (second / 3600).toFixed(0) + ' h';
} else {
return (second / 3600 / 24).toFixed(0) + ' ';
return (second / 3600 / 24).toFixed(0) + ' d';
}
}

View File

@@ -35,7 +35,7 @@
:stroke-color="status.mem.color"
:percent="status.mem.percent"></a-progress>
<div>
内存: [[ sizeFormat(status.mem.current) ]] / [[ sizeFormat(status.mem.total) ]]
{{ i18n "pages.index.memory"}}: [[ sizeFormat(status.mem.current) ]] / [[ sizeFormat(status.mem.total) ]]
</div>
</a-col>
</a-row>
@@ -55,7 +55,7 @@
:stroke-color="status.disk.color"
:percent="status.disk.percent"></a-progress>
<div>
硬盘: [[ sizeFormat(status.disk.current) ]] / [[ sizeFormat(status.disk.total) ]]
{{ i18n "pages.index.hard"}}: [[ sizeFormat(status.disk.current) ]] / [[ sizeFormat(status.disk.total) ]]
</div>
</a-col>
</a-row>
@@ -68,7 +68,7 @@
<a-row>
<a-col :sm="24" :md="12">
<a-card hoverable>
xray 状态:
{{ i18n "pages.index.xrayStatus" }}:
<a-tag :color="status.xray.color">[[ status.xray.state ]]</a-tag>
<a-tooltip v-if="status.xray.state === State.Error">
<template slot="title">
@@ -77,16 +77,16 @@
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
<a-tag color="green" @click="openSelectV2rayVersion">[[ status.xray.version ]]</a-tag>
<a-tag color="blue" @click="openSelectV2rayVersion">切换版本</a-tag>
<a-tag color="blue" @click="openSelectV2rayVersion">{{ i18n "pages.index.xraySwitch"}}</a-tag>
</a-card>
</a-col>
<a-col :sm="24" :md="12">
<a-card hoverable>
运行时间:
{{ i18n "pages.index.operationHours" }}:
<a-tag color="#87d068">[[ formatSecond(status.uptime) ]]</a-tag>
<a-tooltip>
<template slot="title">
系统自启动以来的运行时间
{{ i18n "pages.index.operationHoursDesc" }}
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
@@ -94,15 +94,15 @@
</a-col>
<a-col :sm="24" :md="12">
<a-card hoverable>
系统负载: [[ status.loads[0] ]] | [[ status.loads[1] ]] | [[ status.loads[2] ]]
{{ i18n "pages.index.systemLoad" }}: [[ status.loads[0] ]] | [[ status.loads[1] ]] | [[ status.loads[2] ]]
</a-card>
</a-col>
<a-col :sm="24" :md="12">
<a-card hoverable>
tcp / udp 连接数: [[ status.tcpCount ]] / [[ status.udpCount ]]
tcp / udp {{ i18n "pages.index.connectionCount" }}: [[ status.tcpCount ]] / [[ status.udpCount ]]
<a-tooltip>
<template slot="title">
所有网卡的总连接数
{{ i18n "pages.index.connectionCountDesc" }}
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
@@ -116,7 +116,7 @@
[[ sizeFormat(status.netIO.up) ]] / S
<a-tooltip>
<template slot="title">
所有网卡的总上传速度
{{ i18n "pages.index.upSpeed" }}
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
@@ -126,7 +126,7 @@
[[ sizeFormat(status.netIO.down) ]] / S
<a-tooltip>
<template slot="title">
所有网卡的总下载速度
{{ i18n "pages.index.downSpeed" }}
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
@@ -142,7 +142,7 @@
[[ sizeFormat(status.netTraffic.sent) ]]
<a-tooltip>
<template slot="title">
系统启动以来所有网卡的总上传流量
{{ i18n "pages.index.totalSent" }}
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
@@ -152,7 +152,7 @@
[[ sizeFormat(status.netTraffic.recv) ]]
<a-tooltip>
<template slot="title">
系统启动以来所有网卡的总下载流量
{{ i18n "pages.index.totalReceive" }}
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
@@ -164,11 +164,11 @@
</transition>
</a-layout-content>
</a-layout>
<a-modal id="version-modal" v-model="versionModal.visible" title="切换版本"
<a-modal id="version-modal" v-model="versionModal.visible" title='{{ i18n "pages.index.xraySwitch" }}'
:closable="true" @ok="() => versionModal.visible = false"
ok-text="确定" cancel-text="取消">
<h2>点击你想切换的版本</h2>
<h2>请谨慎选择,旧版本可能配置不兼容</h2>
ok-text='{{ i18n "confirm" }}' cancel-text='{{ i18n "cancel"}}'>
<h2>{{ i18n "pages.index.xraySwitchClick"}}</h2>
<h2>{{ i18n "pages.index.xraySwitchClickDesk"}}</h2>
<template v-for="version, index in versionModal.versions">
<a-tag :color="index % 2 == 0 ? 'blue' : 'green'"
style="margin: 10px" @click="switchV2rayVersion(version)">
@@ -277,10 +277,10 @@
status: new Status(),
versionModal,
spinning: false,
loadingTip: '加载中',
loadingTip: '{{ i18n "loading"}}',
},
methods: {
loading(spinning, tip = '加载中') {
loading(spinning, tip = '{{ i18n "loading"}}') {
this.spinning = spinning;
this.loadingTip = tip;
},
@@ -304,13 +304,13 @@
},
switchV2rayVersion(version) {
this.$confirm({
title: '切换 xray 版本',
content: '是否切换 xray 版本至' + ` ${version}?`,
okText: '确定',
cancelText: '取消',
title: '{{ i18n "pages.index.xraySwitchVersionDialog"}}',
content: '{{ i18n "pages.index.xraySwitchVersionDialogDesc"}}' + ` ${version}?`,
okText: '{{ i18n "confirm"}}',
cancelText: '{{ i18n "cancel"}}',
onOk: async () => {
versionModal.hide();
this.loading(true, '安装中,请不要刷新此页面');
this.loading(true, '{{ i18n "pages.index.dontRefresh"}}');
await HttpUtil.post(`/server/installXray/${version}`);
this.loading(false);
},

View File

@@ -11,6 +11,12 @@
"enable" = "enable"
"protocol" = "protocol"
"loading" = "Loading"
"second" = "second"
"minute" = "minute"
"hour" = "hour"
"day" = "day"
[menu]
"dashboard" = "System Status"
"inbounds" = "Inbounds"
@@ -31,6 +37,25 @@
[pages.index]
"title" = "system status"
"memory" = "memory"
"hard" = "hard disk"
"xrayStatus" = "xray Status"
"xraySwitch" = "Switch Version"
"xraySwitchClick" = "Click on the version you want to switch"
"xraySwitchClickDesk" = "Please choose carefully, older versions may have incompatible configurations"
"operationHours" = "Operation Hours"
"operationHoursDesc" = "The running time of the system since it was started"
"systemLoad" = "System Load"
"connectionCount" = "Connection Count"
"connectionCountDesc" = "The total number of connections for all network cards"
"upSpeed" = "Total upload speed for all network cards"
"downSpeed" = "Total download speed for all network cards"
"totalSent" = "Total upload traffic of all network cards since system startup"
"totalReceive" = "Total download traffic of all network cards since system startup"
"xraySwitchVersionDialog" = "switch xray version"
"xraySwitchVersionDialogDesc" = "whether to switch the xray version to"
"dontRefresh" = "Installation is in progress, please do not refresh this page"
[pages.inbounds]
"title" = "Inbounds"

View File

@@ -11,6 +11,12 @@
"enable" = "启用"
"protocol" = "协议"
"loading" = "加载中"
"second" = "秒"
"minute" = "分钟"
"hour" = "小时"
"day" = "天"
[menu]
"dashboard" = "系统状态"
"inbounds" = "入站列表"
@@ -30,6 +36,25 @@
[pages.index]
"title" = "系统状态"
"memory" = "内存"
"hard" = "硬盘"
"xrayStatus" = "xray 状态"
"xraySwitch" = "切换版本"
"xraySwitchClick" = "点击你想切换的版本"
"xraySwitchClickDesk" = "请谨慎选择,旧版本可能配置不兼容"
"operationHours" = "运行时间"
"operationHoursDesc" = "系统自启动以来的运行时间"
"systemLoad" = "系统负载"
"connectionCount" = "连接数"
"connectionCountDesc" = "所有网卡的总连接数"
"upSpeed" = "所有网卡的总上传速度"
"downSpeed" = "所有网卡的总下载速度"
"totalSent" = "系统启动以来所有网卡的总上传流量"
"totalReceive" = "系统启动以来所有网卡的总下载流量"
"xraySwitchVersionDialog" = "切换 xray 版本"
"xraySwitchVersionDialogDesc" = "是否切换 xray 版本至"
"dontRefresh" = "安装中,请不要刷新此页面"
[pages.inbounds]
"title" = "入站列表"