Skip to content

Commit

Permalink
feat: complete translation fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ikxin committed Aug 22, 2024
1 parent 0f91b07 commit 995f95f
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 122 deletions.
2 changes: 1 addition & 1 deletion service/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface RunVlmcsParams {
host: string
port?: number
app?: number
protocol?: number
edition?: number
}

export interface RunVlmcsResult {
Expand Down
4 changes: 2 additions & 2 deletions service/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { RunVlmcsParams, RunVlmcsResult } from './types'
export const runVlmcs = ({
host,
port = 1688,
app = 26,
protocol = 6,
edition = 26,
}: RunVlmcsParams) => {
return new Promise<RunVlmcsResult>(resolve => {
const before = Date.now()
execFile(
`./service/binaries/vlmcs-${platform()}-${arch()}`,
[`${host}:${port}`, `-${protocol}`, `-l ${app}`],
[`${host}:${port}`, `-${protocol}`, `-l ${edition}`],
{ timeout: 10 * 1000 },
(err, stdout) => {
resolve({
Expand Down
12 changes: 6 additions & 6 deletions src/components/common-activate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const { copy, copied } = useClipboard({
</div>
</template>
<AForm :model="formData" auto-label-width>
<AFormItem :label="t('label.version')" field="edition" required>
<AFormItem :label="t('label.edition')" field="edition" required>
<ASelect v-model="formData.edition">
<template v-for="item in editionData" :key="item.version">
<AOptgroup :label="item.version">
Expand All @@ -69,32 +69,32 @@ const { copy, copied } = useClipboard({
</template>
</ASelect>
</AFormItem>
<AFormItem :label="t('label.service')" field="host" required>
<AFormItem :label="t('label.host')" field="host" required>
<ASelect v-model="formData.host">
<template v-for="item in monitors" :key="item.id">
<AOption :label="item.host" />
</template>
</ASelect>
</AFormItem>
<AFormItem :label="t('label.license')" field="gvlk" required>
<AFormItem :label="t('label.gvlk')" field="gvlk" required>
<AInput v-model="formData.gvlk" disabled />
</AFormItem>
<AFormItem label="CMD Script">
<AFormItem :label="t('label.script')" required>
<ATextarea v-model="content" auto-size />
</AFormItem>
<AFormItem>
<ASpace size="small">
<a :href="fileUrl" :download="file.name">
<AButton type="primary">
{{ t('button.download-script') }}
{{ t('label.download') }}
</AButton>
</a>
<AButton
type="secondary"
:status="copied ? 'success' : 'normal'"
@click="copy()"
>
{{ copied ? t('button.copy-script') : t('button.copy-script') }}
{{ copied ? t('label.copy-success') : t('label.copy') }}
</AButton>
</ASpace>
</AFormItem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/custom-footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const { t } = useI18n()
<div>
Code with by
<ALink target="_blank" href="https://www.ikxin.com">
{{ t('name.author') }}
{{ t('label.author') }}
</ALink>
</div>
</ASpace>
Expand Down
16 changes: 8 additions & 8 deletions src/components/custom-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,27 @@ const navSelected = ref([!pathName?.[0] ? 'home' : pathName?.[0]])
const themeItems = computed(() => [
{
lable: t('label.light-theme'),
value: 'light',
icon: 'i-icons:light-mode',
lable: t('label.auto'),
value: 'auto',
icon: 'i-icons:auto-mode',
},
{
lable: t('label.dark-theme'),
lable: t('label.dark'),
value: 'dark',
icon: 'i-icons:dark-mode',
},
{
lable: t('label.auto-theme'),
value: 'auto',
icon: 'i-icons:auto-mode',
lable: t('label.light'),
value: 'light',
icon: 'i-icons:light-mode',
},
])
const themeIcon = computed(() => {
return themeItems.value.find(item => item.value === appStore.theme)?.icon
})
const themeChange = val => (appStore.theme = val)
const themeChange = (val: any) => (appStore.theme = val)
const locales: LocaleItem[] = [
{
Expand Down
56 changes: 20 additions & 36 deletions src/locales/zh-cn.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,30 @@
{
"label": {
"author": "一纸忘忧",
"activate": "激活",
"check": "检测",
"check": "检查",
"monitor": "监控",
"auto-theme": "跟随系统",
"light-theme": "浅色模式",
"dark-theme": "深色模式",
"zh-cn": "简体中文",
"zh-tw": "繁体中文",
"en": "英语",
"operating-system": "操作系统",
"auto": "自动",
"dark": "深色模式",
"light": "浅色模式",
"system": "系统",
"software": "软件",
"edition": "发行版本",
"cpuarch": "CPU 架构",
"license": "许可证",
"product": "产品",
"service": "KMS 服务器",
"version": "系统版本",
"x64": "64 位",
"x86": "32 位",
"domain": "域名",
"host": "KMS 服务器",
"port": "端口",
"protocol": "协议"
},
"name": {
"author": "一纸忘忧"
},
"placeholder": {
"domain": "请输入域名",
"port": "请输入端口",
"protocol": "请选择协议",
"software": "请选择软件",
"edition": "请选择版本",
"product": "请选择产品",
"service": "请选择 kms 服务器",
"version": "请选择版本"
},
"button": {
"copy-script": "复制脚本",
"generate-script": "生成脚本",
"download-script": "下载脚本",
"submit": "提交"
"gvlk": "许可证",
"script": "CMD 脚本",
"copy": "复制",
"copy-success": "复制成功",
"download": "下载",
"protocol": "请求协议",
"submit": "提交",
"rate": "成功率",
"delay": "平均延迟",
"total": "总请求",
"success-total": "成功数",
"fail-total": "失败数",
"updated-at": "更新时间"
},
"title": {
"kms-check": "KMS 服务器检测"
Expand Down
2 changes: 1 addition & 1 deletion src/views/activate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const selectedKeys = ref(pathName)
>
<ASubMenu key="system">
<template #icon><i class="i-icons:system text-base" /></template>
<template #title>{{ t('label.operating-system') }}</template>
<template #title>{{ t('label.system') }}</template>
<AMenuItem
key="windows"
@click="router.push({ path: '/activate/windows' })"
Expand Down
118 changes: 61 additions & 57 deletions src/views/monitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,72 @@ import { useMonitorStore } from '@/store/monitor'
import { TableColumnData } from '@arco-design/web-vue'
import dayjs from 'dayjs'
const columns: TableColumnData[] = [
{
dataIndex: 'host',
title: '服务器',
minWidth: 160,
},
{
dataIndex: 'port',
title: '端口',
width: 80,
},
{
dataIndex: 'rate',
title: '成功率',
width: 100,
align: 'center',
sortable: {
sortDirections: ['ascend', 'descend'],
const { t } = useI18n()
const columns = computed<TableColumnData[]>(() => {
return [
{
dataIndex: 'host',
title: t('label.host'),
minWidth: 160,
},
{
dataIndex: 'port',
title: t('label.port'),
width: 80,
},
{
dataIndex: 'rate',
title: t('label.rate'),
width: 100,
align: 'center',
sortable: {
sortDirections: ['ascend', 'descend'],
},
render({ record }) {
return `${(record.rate * 100).toFixed(2)} %`
},
},
{
dataIndex: 'delay',
title: t('label.delay'),
width: 120,
align: 'center',
sortable: {
sortDirections: ['ascend', 'descend'],
},
render({ record }) {
return `${record.delay.toFixed(2)} ms`
},
},
render({ record }) {
return `${(record.rate * 100).toFixed(2)} %`
{
dataIndex: 'total',
title: t('label.total'),
width: 80,
align: 'center',
},
},
{
dataIndex: 'delay',
title: '平均延迟',
width: 120,
align: 'center',
sortable: {
sortDirections: ['ascend', 'descend'],
{
dataIndex: 'success',
title: t('label.success-total'),
width: 80,
align: 'center',
},
render({ record }) {
return `${record.delay.toFixed(2)} ms`
{
dataIndex: 'fail',
title: t('label.fail-total'),
width: 80,
align: 'center',
},
},
{
dataIndex: 'total',
title: '总请求',
width: 80,
align: 'center',
},
{
dataIndex: 'success',
title: '成功数',
width: 80,
align: 'center',
},
{
dataIndex: 'fail',
title: '失败数',
width: 80,
align: 'center',
},
{
dataIndex: 'updatedAt',
title: '更新时间',
width: 170,
render({ record }) {
return dayjs(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')
{
dataIndex: 'updatedAt',
title: t('label.updated-at'),
width: 170,
render({ record }) {
return dayjs(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')
},
},
},
]
]
})
const monitorStore = useMonitorStore()
</script>
Expand Down
16 changes: 6 additions & 10 deletions src/views/tools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,22 @@ const formData = ref({
host: 'kms.8b5.cn',
port: '1688',
protocol: '6',
software: '1',
edition: '1',
})
const formRules = computed((): Record<string, FieldRule | FieldRule[]> => {
return {
host: {
required: true,
message: t('placeholder.domain'),
},
port: {
required: true,
message: t('placeholder.port'),
},
protocol: {
required: true,
message: t('placeholder.protocol'),
},
software: {
edition: {
required: true,
message: t('placeholder.software'),
},
}
})
Expand Down Expand Up @@ -83,14 +79,14 @@ const handleSubmit = async (data: {
@submit="handleSubmit"
auto-label-width
>
<AFormItem :label="t('label.domain')" field="host">
<AFormItem :label="t('label.host')" field="host">
<AInput v-model="formData.host"></AInput>
</AFormItem>
<AFormItem :label="t('label.port')" field="port">
<AInput v-model="formData.port"></AInput>
</AFormItem>
<AFormItem :label="t('label.software')" field="software">
<ASelect v-model="formData.software">
<AFormItem :label="t('label.edition')" field="edition">
<ASelect v-model="formData.edition">
<AOption
v-for="(value, key) in appItems"
:key="key"
Expand All @@ -108,7 +104,7 @@ const handleSubmit = async (data: {
</AFormItem>
<AFormItem>
<AButton html-type="submit" type="primary">
{{ t('button.submit') }}
{{ t('label.submit') }}
</AButton>
</AFormItem>
</AForm>
Expand Down

0 comments on commit 995f95f

Please sign in to comment.