feat: add comprehensive i18n support across all pages

- Add i18n support to admin sidebar, breadcrumbs, and nav-footer
- Add i18n support to admin pages: system-settings, users, versions, risk-control, sessions, cloud-variables, cloud-constants
- Add i18n support to auth pages: login, register
- Add i18n support to install and profile pages
- Add i18n support to agent pages: dashboard, finance, users, apps, cards
- Replace all hard-coded Chinese text with i18n translation keys
- Add comprehensive translation keys to zh.json and en.json
- Fix date formatting to use locale-agnostic toLocaleDateString()
- Pass t function as parameter for i18n in non-component files
This commit is contained in:
2026-05-07 23:06:58 +08:00
parent f1f2a9dc9d
commit c816f4d85c
26 changed files with 1817 additions and 658 deletions
+14 -11
View File
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { Loader2, Users } from 'lucide-vue-next'
import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import api from '@/services/api'
const { t } = useI18n()
interface User {
id: number
username: string
@@ -22,7 +25,7 @@ onMounted(async () => {
users.value = data || []
}
catch (error) {
console.error('获取用户列表失败:', error)
console.error('Load users failed:', error)
}
finally {
loading.value = false
@@ -32,7 +35,7 @@ onMounted(async () => {
function formatDate(dateStr: string | null) {
if (!dateStr)
return '-'
return new Date(dateStr).toLocaleDateString('zh-CN')
return new Date(dateStr).toLocaleDateString()
}
</script>
@@ -40,10 +43,10 @@ function formatDate(dateStr: string | null) {
<div class="space-y-6">
<div>
<h1 class="text-2xl font-bold">
用户管理
{{ t('agent.users.title') }}
</h1>
<p class="text-muted-foreground">
管理您应用下的用户
{{ t('agent.users.description') }}
</p>
</div>
@@ -55,7 +58,7 @@ function formatDate(dateStr: string | null) {
<div v-else-if="users.length === 0" class="text-center py-12 text-muted-foreground">
<Users class="size-16 mx-auto mb-4 opacity-30" />
<p>暂无用户记录</p>
<p>{{ t('agent.users.noUsers') }}</p>
</div>
<div v-else class="overflow-x-auto">
@@ -63,19 +66,19 @@ function formatDate(dateStr: string | null) {
<thead class="bg-muted/50">
<tr>
<th class="px-4 py-3 text-left text-sm font-medium">
用户名
{{ t('agent.users.username') }}
</th>
<th class="px-4 py-3 text-left text-sm font-medium">
邮箱
{{ t('agent.users.email') }}
</th>
<th class="px-4 py-3 text-left text-sm font-medium">
状态
{{ t('agent.users.status') }}
</th>
<th class="px-4 py-3 text-left text-sm font-medium">
注册时间
{{ t('agent.users.registerTime') }}
</th>
<th class="px-4 py-3 text-left text-sm font-medium">
最后登录
{{ t('agent.users.lastLogin') }}
</th>
</tr>
</thead>
@@ -92,7 +95,7 @@ function formatDate(dateStr: string | null) {
:class="user.status === 'active' ? 'bg-green-500/10 text-green-500' : ''"
variant="outline"
>
{{ user.status === 'active' ? '正常' : user.status }}
{{ user.status === 'active' ? t('agent.users.active') : user.status }}
</UiBadge>
</td>
<td class="px-4 py-3 text-sm text-muted-foreground">