Skip to content

Commit 61d247a

Browse files
committed
feat: 新增繁体中文、俄语、法语、韩语等多种语言
1 parent 4eeaec9 commit 61d247a

18 files changed

Lines changed: 2161 additions & 910 deletions

app/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const monitorData = useState<MonitorInfo[]>('monitorData')
33
const { locale } = useI18n()
44
55
const echartsLocale = computed(() => {
6-
if (locale.value === 'zh-cn') return 'ZH'
6+
if (locale.value.startsWith('zh')) return 'ZH'
77
return 'EN'
88
})
99

app/components/AppFooter.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<script lang="ts" setup>
22
const { t } = useI18n()
3-
const localePath = useLocalePath()
43
54
const currentYear = new Date().getFullYear()
6-
7-
85
</script>
96

107
<template>
@@ -23,7 +20,9 @@ const currentYear = new Date().getFullYear()
2320
</div>
2421
</div>
2522

26-
<div class="mt-6 flex flex-col gap-2 pt-4 text-xs text-[--color-text-3] sm:flex-row sm:items-center sm:justify-between">
23+
<div
24+
class="mt-6 flex flex-col gap-2 pt-4 text-xs text-[--color-text-3] sm:flex-row sm:items-center sm:justify-between"
25+
>
2726
<p>
2827
Copyright &copy; {{ currentYear }}
2928
<ALink target="_blank" href="https://github.com/ikxin/kms-tools">

app/components/CommonActivate.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ watch(
3737
watch(
3838
() => locale.value,
3939
val => {
40-
if (val === 'zh-cn') {
40+
if (val.startsWith('zh')) {
4141
rankVal.value = 2
4242
} else {
4343
rankVal.value = 1

app/pages/activate.vue

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,25 @@ const { t } = useI18n()
88
const path = computed(() => route.path.slice(1).split('/'))
99
1010
const drawerVisible = ref(false)
11+
const isDesktop = useMediaQuery('(min-width: 768px)')
1112
1213
if (!path.value.at(-1)) {
1314
navigateTo(localePath('/activate/windows'))
1415
}
1516
17+
watch(
18+
isDesktop,
19+
value => {
20+
if (value) {
21+
drawerVisible.value = false
22+
}
23+
},
24+
{
25+
immediate: true,
26+
flush: 'post'
27+
}
28+
)
29+
1630
watch(
1731
() => route.path,
1832
() => {
@@ -35,68 +49,69 @@ function handleRainyunAdClick() {
3549

3650
<template>
3751
<!-- Mobile: floating left-edge tab -->
38-
<div
39-
v-show="!drawerVisible"
40-
class="fixed left-0 top-1/3 z-[100] -translate-y-1/2 cursor-pointer rounded-r-lg bg-[rgb(var(--primary-6))] px-1 py-4 text-white shadow-lg md:hidden"
41-
@click="drawerVisible = true"
42-
>
43-
<Icon name="material-symbols:chevron-right" class="text-base" />
44-
</div>
45-
46-
<!-- Mobile: left-side drawer -->
47-
<ADrawer
48-
v-model:visible="drawerVisible"
49-
placement="left"
50-
:width="240"
51-
:title="t('label.activate')"
52-
:footer="false"
53-
>
54-
<AMenu
55-
:selected-keys="path"
56-
:default-open-keys="['system', 'software']"
57-
class="select-none !border-none [&_.arco-menu-icon>i]:inline-block"
52+
<template v-if="!isDesktop">
53+
<div
54+
v-show="!drawerVisible"
55+
class="fixed left-0 top-1/3 z-[100] -translate-y-1/2 cursor-pointer rounded-r-lg bg-[rgb(var(--primary-6))] px-1 py-4 text-white shadow-lg md:hidden"
56+
@click="drawerVisible = true"
5857
>
59-
<ASubMenu key="system">
60-
<template #icon><Icon name="icons:system" /></template>
61-
<template #title>{{ t('label.system') }}</template>
62-
<AMenuItem key="windows" @click="handleMenuClick('windows')">
63-
<template #icon><Icon name="icons:windows" /></template>
64-
Windows
65-
</AMenuItem>
66-
<AMenuItem
67-
key="windows-server"
68-
@click="handleMenuClick('windows-server')"
69-
>
70-
<template #icon><Icon name="icons:windows-server" /></template>
71-
Windows Server
72-
</AMenuItem>
73-
</ASubMenu>
74-
<ASubMenu key="software">
75-
<template #icon><Icon name="icons:software" /></template>
76-
<template #title>{{ t('label.software') }}</template>
77-
<AMenuItem key="office" @click="handleMenuClick('office')">
78-
<template #icon><Icon name="icons:office" /></template>
79-
Office
80-
</AMenuItem>
81-
</ASubMenu>
82-
</AMenu>
58+
<Icon name="material-symbols:chevron-right" class="text-base" />
59+
</div>
8360

84-
<div
85-
class="hover:bg-[var(--color-fill-2)]/50 group relative mt-4 flex rounded-lg bg-[var(--color-bg-2)] p-2 ring-1 ring-[var(--color-border)] transition"
61+
<!-- Mobile: left-side drawer -->
62+
<ADrawer
63+
v-model:visible="drawerVisible"
64+
placement="left"
65+
:width="240"
66+
:title="t('label.activate')"
67+
:footer="false"
68+
unmount-on-close
8669
>
87-
<button
88-
type="button"
89-
class="flex w-full flex-col items-start gap-y-2 text-left"
90-
@click="handleRainyunAdClick"
70+
<AMenu
71+
:selected-keys="path"
72+
:default-open-keys="['system', 'software']"
73+
class="select-none !border-none [&_.arco-menu-icon>i]:inline-block"
9174
>
92-
<img
93-
src="/images/rainyun_1.png"
94-
alt="RainYun"
95-
class="h-auto w-full rounded-md object-cover"
96-
/>
97-
</button>
98-
</div>
99-
</ADrawer>
75+
<ASubMenu key="system">
76+
<template #icon><Icon name="icons:system" /></template>
77+
<template #title>{{ t('label.system') }}</template>
78+
<AMenuItem key="windows" @click="handleMenuClick('windows')">
79+
<template #icon><Icon name="icons:windows" /></template>
80+
Windows
81+
</AMenuItem>
82+
<AMenuItem
83+
key="windows-server"
84+
@click="handleMenuClick('windows-server')"
85+
>
86+
<template #icon><Icon name="icons:windows-server" /></template>
87+
Windows Server
88+
</AMenuItem>
89+
</ASubMenu>
90+
<ASubMenu key="software">
91+
<template #icon><Icon name="icons:software" /></template>
92+
<template #title>{{ t('label.software') }}</template>
93+
<AMenuItem key="office" @click="handleMenuClick('office')">
94+
<template #icon><Icon name="icons:office" /></template>
95+
Office
96+
</AMenuItem>
97+
</ASubMenu>
98+
</AMenu>
99+
100+
<div class="group relative flex rounded-md transition">
101+
<button
102+
type="button"
103+
class="flex w-full flex-col items-start gap-y-2 text-left"
104+
@click="handleRainyunAdClick"
105+
>
106+
<img
107+
src="/images/rainyun_1.png"
108+
alt="RainYun"
109+
class="h-auto w-full rounded-md object-cover"
110+
/>
111+
</button>
112+
</div>
113+
</ADrawer>
114+
</template>
100115

101116
<!-- Mobile: page content -->
102117
<div class="flex w-full flex-col gap-4 md:hidden">
@@ -150,9 +165,7 @@ function handleRainyunAdClick() {
150165
</AMenu>
151166

152167
<div class="p-2 pt-0">
153-
<div
154-
class="hover:bg-[var(--color-fill-2)]/50 group relative flex rounded-lg bg-[var(--color-bg-2)] p-2 ring-1 ring-[var(--color-border)] transition"
155-
>
168+
<div class="group relative flex rounded-md transition">
156169
<button
157170
type="button"
158171
class="flex w-full flex-col items-start gap-y-2 text-left"

app/pages/check/index.vue

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ type ParsedOutput = {
4141
4242
const requestParamLabelMap: Record<string, string> = {
4343
'Protocol version': 'pages.check.result.request-params.protocol-version',
44-
'Client is a virtual machine': 'pages.check.result.request-params.client-is-vm',
44+
'Client is a virtual machine':
45+
'pages.check.result.request-params.client-is-vm',
4546
'Licensing status': 'pages.check.result.request-params.licensing-status',
46-
'Remaining time (0 = forever)': 'pages.check.result.request-params.remaining-time',
47+
'Remaining time (0 = forever)':
48+
'pages.check.result.request-params.remaining-time',
4749
'Application ID': 'pages.check.result.request-params.application-id',
4850
'SKU ID (aka Activation ID)': 'pages.check.result.request-params.sku-id',
4951
'KMS ID (aka KMS counted ID)': 'pages.check.result.request-params.kms-id',
@@ -58,7 +60,8 @@ const requestParamLabelMap: Record<string, string> = {
5860
}
5961
6062
const responseParamLabelMap: Record<string, string> = {
61-
'Size of KMS Response': 'pages.check.result.response-params.kms-response-size',
63+
'Size of KMS Response':
64+
'pages.check.result.response-params.kms-response-size',
6265
'KMS ePID': 'pages.check.result.response-params.kms-epid',
6366
'KMS HwId': 'pages.check.result.response-params.kms-hwid',
6467
'Client machine ID': 'pages.check.result.response-params.client-machine-id',
@@ -126,7 +129,10 @@ const parsedOutput = computed<ParsedOutput>(() => {
126129
const rpcLines =
127130
rpcStart >= 0
128131
? lines
129-
.slice(rpcStart, responseStart > rpcStart ? responseStart : lines.length)
132+
.slice(
133+
rpcStart,
134+
responseStart > rpcStart ? responseStart : lines.length
135+
)
130136
.filter(line => line.trim())
131137
: []
132138
@@ -280,7 +286,9 @@ const handleSubmit = async (data: {
280286
resultInfo.visible = true
281287
resultInfo.loading = false
282288
} catch (err) {
283-
resultInfo.message = String(err || t('pages.check.result.unknown-request-error'))
289+
resultInfo.message = String(
290+
err || t('pages.check.result.unknown-request-error')
291+
)
284292
resultInfo.type = 'error'
285293
resultInfo.visible = true
286294
resultInfo.loading = false
@@ -341,7 +349,9 @@ const handleSubmit = async (data: {
341349
: 'border-[rgb(var(--primary-6))] bg-[rgb(var(--primary-1))]'
342350
"
343351
>
344-
<div class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
352+
<div
353+
class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between"
354+
>
345355
<div class="flex min-w-0 flex-col gap-1">
346356
<div class="flex items-center gap-2">
347357
<Icon
@@ -354,22 +364,28 @@ const handleSubmit = async (data: {
354364
"
355365
class="text-lg"
356366
/>
357-
<span class="text-base font-semibold text-[var(--color-text-1)]">
367+
<span
368+
class="text-base font-semibold text-[var(--color-text-1)]"
369+
>
358370
{{ statusMeta.title }}
359371
</span>
360372
</div>
361-
<span class="text-sm text-[var(--color-text-2)]">{{ statusMeta.desc }}</span>
373+
<span class="text-sm text-[var(--color-text-2)]">{{
374+
statusMeta.desc
375+
}}</span>
362376
</div>
363-
<ATag bordered :color="statusMeta.color">{{ resultInfo.type.toUpperCase() }}</ATag>
377+
<ATag bordered :color="statusMeta.color">{{
378+
resultInfo.type.toUpperCase()
379+
}}</ATag>
364380
</div>
365381

366382
<div
367383
v-if="parsedOutput.connectionLine"
368384
class="mt-3 rounded bg-[var(--color-fill-2)] px-3 py-2 font-mono text-xs text-[var(--color-text-2)]"
369385
>
370-
<span class="mr-1 text-[var(--color-text-3)]">{{
371-
t('pages.check.result.connection-title')
372-
}}:</span>
386+
<span class="mr-1 text-[var(--color-text-3)]"
387+
>{{ t('pages.check.result.connection-title') }}:</span
388+
>
373389
{{ parsedOutput.connectionLine }}
374390
</div>
375391
</ACard>
@@ -445,7 +461,8 @@ const handleSubmit = async (data: {
445461
>
446462
<pre
447463
class="max-h-72 overflow-auto whitespace-pre rounded bg-[var(--color-fill-1)] p-3 font-mono text-xs leading-5 text-[var(--color-text-2)]"
448-
>{{ rpcText }}</pre>
464+
>{{ rpcText }}</pre
465+
>
449466
</ACard>
450467

451468
<ACollapse>
@@ -454,7 +471,10 @@ const handleSubmit = async (data: {
454471
:header="t('pages.check.result.raw-title')"
455472
class="overflow-hidden [&_.arco-collapse-item-content]:bg-[var(--color-bg-2)] [&_.arco-collapse-item-content]:px-4 [&_.arco-collapse-item-content]:py-3"
456473
>
457-
<pre class="max-h-72 overflow-auto whitespace-pre rounded bg-[var(--color-fill-1)] p-3 font-mono text-xs leading-5 text-[var(--color-text-2)]">{{ rawOutputText }}</pre>
474+
<pre
475+
class="max-h-72 overflow-auto whitespace-pre rounded bg-[var(--color-fill-1)] p-3 font-mono text-xs leading-5 text-[var(--color-text-2)]"
476+
>{{ rawOutputText }}</pre
477+
>
458478
</ACollapseItem>
459479
</ACollapse>
460480
</div>

app/pages/monitor.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const monitorData = useState<MonitorInfo[]>('monitorData')
77
const { t, locale } = useI18n()
88
99
const timeLocale = computed(() => {
10-
if (locale.value === 'zh-cn') return 'zh-CN'
10+
if (locale.value === 'zh-tw') return 'zh-TW'
11+
if (locale.value.startsWith('zh')) return 'zh-CN'
1112
return 'en-US'
1213
})
1314

0 commit comments

Comments
 (0)