feat: 完成UserUsageStatsModal和ChangeRoleModal组件国际化

- 添加用户使用统计模态框的完整国际化支持
  * 时间选择器选项(最近24小时/7天/30天/90天)
  * 统计卡片(请求数/输入Token/输出Token/总费用)
  * API Keys表格表头和状态显示
  * 使用趋势图表占位符和无数据状态

- 添加角色变更模态框的完整国际化支持
  * 角色选择表单和描述文本
  * 动态警告消息(授予/移除管理员权限)
  * 按钮状态和成功提示消息

- 更新三种语言文件(zh-cn/en/zh-tw)添加新的翻译键值
- 集成Vue I18n组合式API支持动态参数替换
- 保持响应式翻译和用户体验的一致性
This commit is contained in:
Wangnov
2025-09-09 21:26:15 +08:00
parent 5706c32933
commit 26d8c98c9d
5 changed files with 336 additions and 44 deletions

View File

@@ -789,6 +789,102 @@ export default {
loadUsersError: 'Failed to load users',
toggleStatusError: 'Failed to toggleStatus',
disableKeysError: 'Failed to disableKeys'
},
// User Usage Stats Modal
usageStatsModal: {
title: '使用统计',
titleWithUser: '使用统计 - {displayName}',
// Time period selection
periodSelection: {
day: '最近24小时',
week: '最近7天',
month: '最近30天',
quarter: '最近90天'
},
// Loading state
loadingStats: '正在加载使用统计...',
// Summary cards
summaryCards: {
requests: '请求数',
inputTokens: '输入Token',
outputTokens: '输出Token',
totalCost: '总费用'
},
// API Keys table
apiKeysTable: {
title: 'API Keys 使用情况',
headers: {
apiKey: 'API Key',
status: '状态',
requests: '请求数',
tokens: 'Token数',
cost: '费用',
lastUsed: '最后使用'
},
status: {
active: '活跃',
disabled: '已禁用'
},
tokensFormat: {
input: '输入',
output: '输出'
},
never: '从未使用'
},
// Usage trend chart
usageTrend: {
title: '使用趋势',
chartTitle: '使用图表',
dailyTrends: '最近 {period} 的日使用趋势',
chartNote: '(可集成 Chart.js、D3.js 或类似图表库)'
},
// No data state
noData: {
title: '暂无使用数据',
description: '该用户在所选时间段内尚未发起任何API请求。'
},
// Buttons
close: '关闭'
},
// Change Role Modal
changeRoleModal: {
title: '修改用户角色',
// User info display
currentRole: '当前角色:{role}',
// Role selection form
newRole: '新角色',
roles: {
user: '用户',
userDesc: '具有基本权限的普通用户',
admin: '管理员',
adminDesc: '拥有管理用户和系统的完整权限'
},
// Warning messages
roleChangeWarning: {
title: '角色变更警告',
grantAdmin: '授予管理员权限将使该用户拥有系统的完整访问权限包括管理其他用户及其API密钥的能力。',
removeAdmin: '移除管理员权限将限制该用户只能管理自己的API密钥和查看自己的使用统计。'
},
// Buttons
cancel: '取消',
updateRole: '更新角色',
updating: '更新中...',
// Success message
roleUpdated: '用户角色已更新为 {role}'
}
},