feat: Integrate vue-i18n for multilingual support across components

- Added vue-i18n integration to various components for dynamic text translation.
- Updated text placeholders, button labels, and error messages to utilize translation functions.
- Enhanced user experience by providing localized content in the Knowledge Base, chat components, and settings.
- Removed hardcoded strings and replaced them with translation keys for better maintainability and scalability.
This commit is contained in:
wizardchen
2025-11-13 19:34:33 +08:00
parent ae58801baf
commit 59f3d22169
62 changed files with 3967 additions and 5348 deletions
+5 -4
View File
@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import type { UserInfo, TenantInfo, KnowledgeBaseInfo } from '@/api/auth'
import i18n from '@/i18n'
export const useAuthStore = defineStore('auth', () => {
// 状态
@@ -99,7 +100,7 @@ export const useAuthStore = defineStore('auth', () => {
try {
user.value = JSON.parse(storedUser)
} catch (e) {
console.error('解析用户信息失败:', e)
console.error(i18n.global.t('authStore.errors.parseUserFailed'), e)
}
}
@@ -107,7 +108,7 @@ export const useAuthStore = defineStore('auth', () => {
try {
tenant.value = JSON.parse(storedTenant)
} catch (e) {
console.error('解析租户信息失败:', e)
console.error(i18n.global.t('authStore.errors.parseTenantFailed'), e)
}
}
@@ -124,7 +125,7 @@ export const useAuthStore = defineStore('auth', () => {
const parsed = JSON.parse(storedKnowledgeBases)
knowledgeBases.value = Array.isArray(parsed) ? parsed : []
} catch (e) {
console.error('解析知识库列表失败:', e)
console.error(i18n.global.t('authStore.errors.parseKnowledgeBasesFailed'), e)
knowledgeBases.value = []
}
}
@@ -133,7 +134,7 @@ export const useAuthStore = defineStore('auth', () => {
try {
currentKnowledgeBase.value = JSON.parse(storedCurrentKb)
} catch (e) {
console.error('解析当前知识库失败:', e)
console.error(i18n.global.t('authStore.errors.parseCurrentKnowledgeBaseFailed'), e)
}
}
}