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
+6 -4
View File
@@ -16,11 +16,13 @@ import useKnowledgeBase from '@/hooks/useKnowledgeBase'
import UploadMask from '@/components/upload-mask.vue'
import { getKnowledgeBaseById } from '@/api/knowledge-base/index'
import { MessagePlugin } from 'tdesign-vue-next'
import { useI18n } from 'vue-i18n'
let { requestMethod } = useKnowledgeBase()
const route = useRoute();
let ismask = ref(false)
let uploadInput = ref();
const { t } = useI18n();
// 获取当前知识库ID
const getCurrentKbId = (): string | null => {
@@ -32,7 +34,7 @@ const checkKnowledgeBaseInitialization = async (): Promise<boolean> => {
const currentKbId = getCurrentKbId();
if (!currentKbId) {
MessagePlugin.error("缺少知识库ID");
MessagePlugin.error(t('knowledgeBase.missingId'));
return false;
}
@@ -41,12 +43,12 @@ const checkKnowledgeBaseInitialization = async (): Promise<boolean> => {
const kb = kbResponse.data;
if (!kb.embedding_model_id || !kb.summary_model_id) {
MessagePlugin.warning("该知识库尚未完成初始化配置,请先前往设置页面配置模型信息后再上传文件");
MessagePlugin.warning(t('knowledgeBase.notInitialized'));
return false;
}
return true;
} catch (error) {
MessagePlugin.error("获取知识库信息失败,无法上传文件");
MessagePlugin.error(t('knowledgeBase.getInfoFailed'));
return false;
}
}
@@ -91,7 +93,7 @@ const handleGlobalDrop = async (event: DragEvent) => {
}
});
} else {
MessagePlugin.warning('请拖拽文件而不是文本或链接');
MessagePlugin.warning(t('knowledgeBase.dragFileNotText'));
}
}