refactor: 调整i18n文本目录结构

- 目录调整: i18n文本由单文件改为多文件
- 组件修改: 对应组件内的文本key做出对应修改
- WIP: 其他语言适配逐步完成...
This commit is contained in:
2025-12-08 17:03:31 +08:00
parent 29bea6d16b
commit a9fc4a7bda
26 changed files with 633 additions and 290 deletions

View File

@ -11,18 +11,13 @@
<v-app-bar-nav-icon @click="drawer = !drawer" />
<v-app-bar-title class="text-h6">
<template v-if="menuItems.length > 0 && menuItems[selectedIndex]">
{{ menuItems[selectedIndex].title || $t('appTitle') }}
{{ menuItems[selectedIndex].title || $t('common.app-title') }}
</template>
</v-app-bar-title>
<v-spacer />
<v-menu
v-model="languageMenu"
:close-on-content-click="true"
location="bottom end"
offset="8"
>
<v-menu v-model="languageMenu" :close-on-content-click="true" location="bottom end" offset="8">
<template #activator="{ props }">
<v-btn
v-bind="props"
@ -75,12 +70,7 @@
:value="index"
:variant="locale === lang.code ? 'flat' : 'outlined'"
>
<v-icon
v-if="locale === lang.code"
class="mr-2"
icon="mdi-check"
size="small"
/>
<v-icon v-if="locale === lang.code" class="mr-2" icon="mdi-check" size="small" />
{{ lang.label }}
</v-chip>
</v-chip-group>
@ -89,20 +79,15 @@
</v-menu>
</v-app-bar>
<v-navigation-drawer
v-model="drawer"
app
class="drawer-transition"
:width="drawerWidth"
>
<v-navigation-drawer v-model="drawer" app class="drawer-transition" :width="drawerWidth">
<div class="fill-height d-flex flex-column">
<v-list-item class="pa-4">
<v-list-item-title class="text-h6 text-primary">
{{ $t('calculator') }}
{{ $t('common.calculator') }}
</v-list-item-title>
<v-list-item-subtitle>
{{ $t('appTitle') }}
{{ $t('common.app-title') }}
</v-list-item-subtitle>
</v-list-item>
@ -135,7 +120,7 @@
variant="text"
@click="showAboutDialog = true"
>
{{ $t('about') }}
{{ $t('common.about') }}
</v-btn>
</div>
@ -143,14 +128,8 @@
</v-navigation-drawer>
<v-dialog
v-model="showAboutDialog"
max-width="500px"
>
<v-card
class="mx-auto"
prepend-icon="mdi-information-outline"
>
<v-dialog v-model="showAboutDialog" max-width="500px">
<v-card class="mx-auto" prepend-icon="mdi-information-outline">
<template #title>
<v-card-title class="text-h5">
{{ appInfo.appName }}
@ -172,7 +151,7 @@
</v-card-text>
<div class="mb-3">
{{ $t('officialWebsite') }}:
{{ $t('common.official-website') }}:
<v-btn
color="primary"
:href="appInfo.officialWebsite"
@ -184,26 +163,20 @@
>
{{ appInfo.officialWebsite }}
</v-btn>
</div></template>
</div>
</template>
<v-card-actions>
<v-spacer />
<v-btn
color="primary"
variant="text"
@click="showAboutDialog = false"
>
{{ $t('close') }}
<v-btn color="primary" variant="text" @click="showAboutDialog = false">
{{ $t('common.close') }}
</v-btn>
</v-card-actions>
</v-card></v-dialog>
<v-main>
<v-container
class="pa-6"
fluid
/>
<v-container class="pa-6" fluid />
<router-view v-slot="{ Component }">
<v-fade-transition hide-on-leave>
<component :is="Component" />
@ -240,18 +213,18 @@
// 应用信息
const appInfo = computed(() => {
return {
appName: t('appTitle'),
appName: t('common.app-title'),
version: '1.0.0',
author: t('companyName'),
description: t('appDescription'),
copyright: `© ${new Date().getFullYear()} ${t('companyName')}. ${t('allRightsReserved')}`,
author: t('common.company-name'),
description: t('common.app-description'),
copyright: `© ${new Date().getFullYear()} ${t('common.company-name')}. ${t('common.all-rights-reserved')}`,
officialWebsite: 'http://www.jinshen.cn',
}
})
// 动态设置网页标题
const pageTitle = computed(() => {
return t('appTitle')
return t('common.app-title')
})
// 监听窗口变化
@ -378,7 +351,8 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: calc(100vw - 120px); /* 为导航按钮和语言按钮留出空间 */
max-width: calc(100vw - 120px);
/* 为导航按钮和语言按钮留出空间 */
}
}