mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
feat: 完成多个组件的国际化支持与文本替换
- 更新 AccountForm.vue 中的占位符文本为 i18n 语言包中的键 - 修改 ConfirmModal.vue 中的确认和取消按钮文本为 i18n 语言包中的键 - 更新 CustomDropdown.vue 中的占位符文本为 i18n 语言包中的键 - 修改 app.js 中的应用标题为英文版本 - 更新 router/index.js 中的日志输出为英文 - 在 accounts.js 和 apiKeys.js 中的错误处理信息中引入 i18n 键以提升多语言一致性 - 更新 dashboard.js 中的系统状态和错误日志为 i18n 键 - 在 DashboardView.vue 中的多个文本替换为 i18n 语言包中的键
This commit is contained in:
@@ -204,7 +204,9 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
await fetchClaudeConsoleAccounts()
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error(response.message || '创建Claude Console账户失败')
|
||||
throw new Error(
|
||||
response.message || i18n.global.t('common.errors.createClaudeConsoleAccountFailed')
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
@@ -284,7 +286,9 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
await fetchAzureOpenAIAccounts()
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error(response.message || '创建Azure OpenAI账户失败')
|
||||
throw new Error(
|
||||
response.message || i18n.global.t('common.errors.createAzureOpenAIAccountFailed')
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
@@ -344,7 +348,9 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
await fetchClaudeConsoleAccounts()
|
||||
return response
|
||||
} else {
|
||||
throw new Error(response.message || '更新Claude Console账户失败')
|
||||
throw new Error(
|
||||
response.message || i18n.global.t('common.errors.updateClaudeConsoleAccountFailed')
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
@@ -424,7 +430,9 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
await fetchAzureOpenAIAccounts()
|
||||
return response
|
||||
} else {
|
||||
throw new Error(response.message || '更新Azure OpenAI账户失败')
|
||||
throw new Error(
|
||||
response.message || i18n.global.t('common.errors.updateAzureOpenAIAccountFailed')
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
@@ -624,7 +632,9 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
if (response.success) {
|
||||
return response.data // 返回整个对象,包含authUrl和sessionId
|
||||
} else {
|
||||
throw new Error(response.message || '生成Setup Token URL失败')
|
||||
throw new Error(
|
||||
response.message || i18n.global.t('common.errors.generateSetupTokenUrlFailed')
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
@@ -642,7 +652,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
if (response.success) {
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error(response.message || '交换Setup Token授权码失败')
|
||||
throw new Error(response.message || i18n.global.t('common.errors.exchangeSetupTokenFailed'))
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
|
||||
@@ -145,7 +145,7 @@ export const useApiKeysStore = defineStore('apiKeys', () => {
|
||||
throw new Error(response.message || i18n.global.t('apiKeys.operationFailed'))
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取API Key统计失败:', err)
|
||||
console.error(i18n.global.t('common.errors.getApiKeyStatsFailed'), err)
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ export const useApiKeysStore = defineStore('apiKeys', () => {
|
||||
throw new Error(response.message || i18n.global.t('apiKeys.operationFailed'))
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取标签失败:', err)
|
||||
console.error(i18n.global.t('common.errors.getTagsFailed'), err)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ export const useApiStatsStore = defineStore('apistats', () => {
|
||||
})
|
||||
|
||||
if (validIds.length === 0) {
|
||||
throw new Error('所有 API Key 都无效')
|
||||
throw new Error(i18n.global.t('common.errors.allApiKeysInvalid'))
|
||||
}
|
||||
|
||||
apiIds.value = validIds
|
||||
|
||||
@@ -107,7 +107,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载OEM设置失败:', error)
|
||||
console.error(i18n.global.t('common.errors.loadOemSettingsFailed'), error)
|
||||
} finally {
|
||||
oemLoading.value = false
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ref, computed } from 'vue'
|
||||
import { apiClient } from '@/config/api'
|
||||
import { showToast } from '@/utils/toast'
|
||||
import i18n from '@/i18n'
|
||||
import i18n from '@/i18n'
|
||||
|
||||
export const useDashboardStore = defineStore('dashboard', () => {
|
||||
// 状态
|
||||
@@ -43,7 +42,7 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
realtimeTPM: 0,
|
||||
metricsWindow: 5,
|
||||
isHistoricalMetrics: false,
|
||||
systemStatus: '正常',
|
||||
systemStatus: i18n.global.t('system.status.normal'),
|
||||
uptime: 0,
|
||||
systemTimezone: 8 // 默认 UTC+8
|
||||
})
|
||||
@@ -200,7 +199,9 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
realtimeTPM: realtimeMetrics.tpm || 0,
|
||||
metricsWindow: realtimeMetrics.windowMinutes || 5,
|
||||
isHistoricalMetrics: realtimeMetrics.isHistorical || false,
|
||||
systemStatus: systemHealth.redisConnected ? '正常' : '异常',
|
||||
systemStatus: systemHealth.redisConnected
|
||||
? i18n.global.t('system.status.normal')
|
||||
: i18n.global.t('system.status.abnormal'),
|
||||
uptime: systemHealth.uptime || 0,
|
||||
systemTimezone: dashboardResponse.data.systemTimezone || 8
|
||||
}
|
||||
@@ -220,7 +221,7 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载仪表板数据失败:', error)
|
||||
console.error(i18n.global.t('common.errors.loadDashboardFailed'), error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -308,7 +309,7 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
trendData.value = response.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载使用趋势失败:', error)
|
||||
console.error(i18n.global.t('common.errors.loadUsageTrendFailed'), error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +400,7 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
dashboardModelStats.value = response.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载模型统计失败:', error)
|
||||
console.error(i18n.global.t('common.errors.loadModelStatsFailed'), error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +502,7 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载API Keys趋势失败:', error)
|
||||
console.error(i18n.global.t('common.errors.loadApiKeysTrendFailed'), error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user