refactor(i18n): 移除多语言支持及相关组件,切换登录页文本为中文
- 删除英文和中文语言文件,去除国际化配置 - 移除语言切换组件 LangSwitch.vue - 登录页中静态替换多语言文本为中文文本 - 站点头部登录、退出等文案替换为中文 - 更新 Nuxt 配置,移除 i18n 模块和相关配置 - 保持核心功能不变,只保留中文语言显示
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<template>
|
||||
<a-dropdown :trigger="['click']" placement="bottomRight">
|
||||
<a-button type="text" class="lang-btn">
|
||||
<template #icon>
|
||||
<GlobalOutlined />
|
||||
</template>
|
||||
<span class="current-lang">{{ currentLocaleName }}</span>
|
||||
<DownOutlined class="ml-1" />
|
||||
</a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="switchLocale">
|
||||
<a-menu-item v-for="loc in availableLocales" :key="loc.code">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<span>{{ loc.name }}</span>
|
||||
<CheckOutlined v-if="loc.code === currentLocale" class="text-green-500" />
|
||||
</div>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { GlobalOutlined, DownOutlined, CheckOutlined } from '@ant-design/icons-vue'
|
||||
|
||||
const { locale: currentLocale, locales, setLocale } = useI18n()
|
||||
|
||||
const availableLocales = computed(() => {
|
||||
return (locales.value as Array<{ code: string; name: string }>).map((l) => ({
|
||||
code: l.code,
|
||||
name: l.name
|
||||
}))
|
||||
})
|
||||
|
||||
const currentLocaleName = computed(() => {
|
||||
const found = availableLocales.value.find((l) => l.code === currentLocale.value)
|
||||
return found?.name || currentLocale.value
|
||||
})
|
||||
|
||||
async function switchLocale({ key }: { key: string }) {
|
||||
await setLocale(key)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.lang-btn {
|
||||
@apply text-gray-300 hover:text-white;
|
||||
}
|
||||
|
||||
.current-lang {
|
||||
@apply text-sm;
|
||||
}
|
||||
</style>
|
||||
@@ -44,7 +44,7 @@
|
||||
<!-- PC 端:登录/头像 -->
|
||||
<div class="hidden md:flex items-center gap-3">
|
||||
<template v-if="!isAuthed">
|
||||
<a-button type="primary" @click="navigateTo('/login')">{{ $t('nav.login') }}</a-button>
|
||||
<a-button type="primary" @click="navigateTo('/login')">{{ '登录' }}</a-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 用户头像 -->
|
||||
@@ -66,7 +66,7 @@
|
||||
<a-menu-item key="admin">⚙️ 后台管理</a-menu-item>
|
||||
</template>
|
||||
<a-menu-divider />
|
||||
<a-menu-item key="logout">{{ $t('nav.logout') }}</a-menu-item>
|
||||
<a-menu-item key="logout">{{ '退出登录' }}</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
@@ -84,7 +84,7 @@
|
||||
</a-layout-header>
|
||||
</a-affix>
|
||||
|
||||
<a-drawer v-model:open="open" :title="$t('nav.navigation') || '导航'" placement="right">
|
||||
<a-drawer v-model:open="open" :title="'导航' || '导航'" placement="right">
|
||||
<a-menu mode="inline" :selected-keys="selectedKeys">
|
||||
<template v-for="item in nav" :key="item.key">
|
||||
<a-sub-menu v-if="item.children && item.children.length" :key="item.key">
|
||||
@@ -103,11 +103,11 @@
|
||||
</template>
|
||||
</a-menu>
|
||||
<div class="mt-4">
|
||||
<a-button v-if="!isAuthed" block type="primary" @click="onNav('/login')">{{ $t('nav.login') || '登录' }}</a-button>
|
||||
<a-button v-if="!isAuthed" block type="primary" @click="onNav('/login')">{{ '登录' || '登录' }}</a-button>
|
||||
<template v-else>
|
||||
<a-button block type="primary" class="mb-2" @click="onNav('/profile')">个人中心</a-button>
|
||||
<a-button v-if="isSuperAdmin" block @click="onNav('/admin')">⚙️ 后台管理</a-button>
|
||||
<a-button block danger class="mt-2" @click="logout">{{ $t('nav.logout') || '退出登录' }}</a-button>
|
||||
<a-button block danger class="mt-2" @click="logout">{{ '退出登录' || '退出登录' }}</a-button>
|
||||
</template>
|
||||
</div>
|
||||
</a-drawer>
|
||||
|
||||
Reference in New Issue
Block a user