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
@@ -26,7 +26,7 @@
<div class="result-title">
<span class="result-index">#{{ result.result_index }}</span>
<span class="relevance-badge" :class="getRelevanceClass(result.relevance_level)">
{{ result.relevance_level }}
{{ getRelevanceLabel(result.relevance_level) }}
</span>
<span class="knowledge-title">{{ result.knowledge_title }}</span>
</div>
@@ -37,7 +37,7 @@
<!-- Empty State -->
<div v-else class="empty-state">
没有找到搜索结果
{{ $t('chat.noSearchResults') }}
</div>
</div>
</template>
@@ -47,12 +47,15 @@ import { ref, defineProps, computed } from 'vue';
import type { SearchResultsData, SearchResultItem, RelevanceLevel } from '@/types/tool-results';
import { getMatchTypeIcon } from '@/utils/tool-icons';
import ContentPopup from './ContentPopup.vue';
import { useI18n } from 'vue-i18n';
const props = defineProps<{
data: SearchResultsData;
arguments?: Record<string, any> | string;
}>();
const { t } = useI18n();
const results = computed(() => props.data.results || []);
const kbCounts = computed(() => props.data.kb_counts);
@@ -105,6 +108,16 @@ const getRelevanceClass = (level: RelevanceLevel): string => {
};
return classMap[level] || 'weak';
};
const getRelevanceLabel = (level: RelevanceLevel): string => {
const labelMap: Record<RelevanceLevel, string> = {
'高相关': t('chat.relevanceHigh'),
'中相关': t('chat.relevanceMedium'),
'低相关': t('chat.relevanceLow'),
'弱相关': t('chat.relevanceWeak'),
};
return labelMap[level] || level;
};
</script>
<style lang="less" scoped>