feat(i18n): replace hardcoded Chinese strings with i18n calls across frontend
Replace all user-visible hardcoded Chinese strings in Vue/TS source files
with proper i18n function calls and add corresponding translation keys
to all 4 locale files (zh-CN, en-US, ko-KR, ru-RU).
Changes:
- Replace 80+ hardcoded Chinese strings across 30+ source files
- Add ~450 new translation keys per locale file
- Cover components, views, utils, hooks, and API modules
- Remove Chinese fallback patterns (|| '中文') from existing t() calls
- Add mermaid toolbar and ollama date format translations
Intentionally preserved (backend API values / backward compatibility):
- FAQ CSV column headers and parsing constants
- RelevanceLevel type and Record key mappings
- Graph database engine status comparison ('未启用')
- Language name labels ('简体中文')
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="section-content">
|
||||
<div class="section-header">
|
||||
<h3 class="section-title">{{ $t('organization.share.title') }}</h3>
|
||||
<p class="section-desc">{{ $t('organization.share.agentShareDesc') || '将智能体共享到空间,空间成员可使用该智能体' }}</p>
|
||||
<p class="section-desc">{{ $t('organization.share.agentShareDesc') }}</p>
|
||||
</div>
|
||||
<!-- 共享范围说明:当传入 agent 时展示,仅提示 + 变更同步说明,不列具体开关 -->
|
||||
<div v-if="agent?.config" class="share-scope-block">
|
||||
|
||||
@@ -1756,7 +1756,7 @@ onBeforeRouteUpdate((to, from, next) => {
|
||||
</span>
|
||||
</span>
|
||||
<span class="mention-chip__name" :title="item.name">{{ item.name }}</span>
|
||||
<span class="mention-chip__remove" @click.stop="removeSelectedItem(item)" aria-label="移除">×</span>
|
||||
<span class="mention-chip__remove" @click.stop="removeSelectedItem(item)" :aria-label="$t('common.remove')">×</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="model-option">
|
||||
<t-icon name="check-circle-filled" class="model-icon" />
|
||||
<span class="model-name">{{ model.name }}</span>
|
||||
<t-tag v-if="model.is_builtin" size="small" theme="primary">内置</t-tag>
|
||||
<t-tag v-if="model.is_builtin" size="small" theme="primary">{{ $t('model.builtinTag') }}</t-tag>
|
||||
<t-tag v-if="model.is_default" size="small" theme="success">{{ $t('model.defaultTag') }}</t-tag>
|
||||
</div>
|
||||
</t-option>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<t-loading size="small" />
|
||||
</div>
|
||||
<div v-else-if="templates.length === 0" class="template-empty">
|
||||
{{ $t('promptTemplate.noTemplates') || '暂无模板' }}
|
||||
{{ $t('promptTemplate.noTemplates') }}
|
||||
</div>
|
||||
<div v-else class="template-list">
|
||||
<div
|
||||
|
||||
@@ -119,7 +119,7 @@ const menuVisible = ref(false)
|
||||
|
||||
// 用户信息
|
||||
const userInfo = ref({
|
||||
username: '用户',
|
||||
username: t('common.defaultUser'),
|
||||
email: 'user@example.com',
|
||||
avatar: ''
|
||||
})
|
||||
|
||||
@@ -154,7 +154,7 @@ watch(() => props.details?.chunkLoading, (val) => {
|
||||
const hasError = Boolean(props.details?.chunkLoadError);
|
||||
if (hasError && currentLength <= pendingChunksBeforeLoad) {
|
||||
page = Math.max(1, pendingRequestedPage - 1);
|
||||
MessagePlugin.warning(props.details?.chunkLoadError || '分块加载失败,请继续下滑重试');
|
||||
MessagePlugin.warning(props.details?.chunkLoadError);
|
||||
}
|
||||
}
|
||||
pendingRequestedPage = null;
|
||||
@@ -407,11 +407,11 @@ const getDisplayTitle = () => {
|
||||
const getTypeLabel = () => {
|
||||
switch (props.details.type) {
|
||||
case 'url':
|
||||
return t('knowledgeBase.typeURL') || '网页';
|
||||
return t('knowledgeBase.typeURL');
|
||||
case 'manual':
|
||||
return t('knowledgeBase.typeManual') || '手动创建';
|
||||
return t('knowledgeBase.typeManual');
|
||||
case 'file':
|
||||
return props.details.file_type ? props.details.file_type.toUpperCase() : t('knowledgeBase.typeFile') || '文件';
|
||||
return props.details.file_type ? props.details.file_type.toUpperCase() : t('knowledgeBase.typeFile');
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@@ -435,12 +435,12 @@ const getTypeTheme = () => {
|
||||
const getContentLabel = () => {
|
||||
switch (props.details.type) {
|
||||
case 'url':
|
||||
return t('knowledgeBase.webContent') || '网页内容';
|
||||
return t('knowledgeBase.webContent');
|
||||
case 'manual':
|
||||
return t('knowledgeBase.documentContent') || '文档内容';
|
||||
return t('knowledgeBase.documentContent');
|
||||
case 'file':
|
||||
default:
|
||||
return t('knowledgeBase.fileContent') || '文件内容';
|
||||
return t('knowledgeBase.fileContent');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -448,12 +448,12 @@ const getContentLabel = () => {
|
||||
const getTimeLabel = () => {
|
||||
switch (props.details.type) {
|
||||
case 'url':
|
||||
return t('knowledgeBase.importTime') || '导入时间';
|
||||
return t('knowledgeBase.importTime');
|
||||
case 'manual':
|
||||
return t('knowledgeBase.createTime') || '创建时间';
|
||||
return t('knowledgeBase.createTime');
|
||||
case 'file':
|
||||
default:
|
||||
return t('knowledgeBase.uploadTime') || '上传时间';
|
||||
return t('knowledgeBase.uploadTime');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -467,7 +467,7 @@ const getChunkMeta = (item: any) => {
|
||||
if (!item) return '';
|
||||
const parts = [];
|
||||
if (item.char_count) {
|
||||
parts.push(`${item.char_count} ${t('knowledgeBase.characters') || '字符'}`);
|
||||
parts.push(`${item.char_count} ${t('knowledgeBase.characters')}`);
|
||||
}
|
||||
if (item.token_count) {
|
||||
parts.push(`${item.token_count} tokens`);
|
||||
@@ -521,27 +521,27 @@ const deletingQuestion = ref<{ chunkIndex: number; questionId: string } | null>(
|
||||
// 删除生成的问题
|
||||
const handleDeleteQuestion = async (item: any, chunkIndex: number, question: GeneratedQuestion) => {
|
||||
if (!item || !item.id) {
|
||||
MessagePlugin.error(t('common.error') || '操作失败');
|
||||
MessagePlugin.error(t('common.error'));
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否是旧格式数据(无法删除)
|
||||
if (question.id.startsWith('legacy-')) {
|
||||
MessagePlugin.warning(t('knowledgeBase.legacyQuestionCannotDelete') || '旧格式问题无法删除,请重新生成问题');
|
||||
MessagePlugin.warning(t('knowledgeBase.legacyQuestionCannotDelete'));
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmDialog = DialogPlugin.confirm({
|
||||
header: t('common.confirmDelete') || '确认删除',
|
||||
body: t('knowledgeBase.confirmDeleteQuestion') || '确定要删除这个问题吗?删除后将同时移除对应的向量索引。',
|
||||
confirmBtn: t('common.confirm') || '确认',
|
||||
cancelBtn: t('common.cancel') || '取消',
|
||||
header: t('common.confirmDelete'),
|
||||
body: t('knowledgeBase.confirmDeleteQuestion'),
|
||||
confirmBtn: t('common.confirm'),
|
||||
cancelBtn: t('common.cancel'),
|
||||
onConfirm: async () => {
|
||||
confirmDialog.hide();
|
||||
deletingQuestion.value = { chunkIndex, questionId: question.id };
|
||||
try {
|
||||
await deleteGeneratedQuestion(item.id, question.id);
|
||||
MessagePlugin.success(t('common.deleteSuccess') || '删除成功');
|
||||
MessagePlugin.success(t('common.deleteSuccess'));
|
||||
|
||||
// 更新本地数据
|
||||
const metadata = typeof item.metadata === 'string' ? JSON.parse(item.metadata) : item.metadata;
|
||||
@@ -556,7 +556,7 @@ const handleDeleteQuestion = async (item: any, chunkIndex: number, question: Gen
|
||||
// 通知父组件刷新数据
|
||||
emit('questionDeleted', { chunkId: item.id, questionId: question.id });
|
||||
} catch (error: any) {
|
||||
MessagePlugin.error(error?.message || t('common.deleteFailed') || '删除失败');
|
||||
MessagePlugin.error(error?.message || t('common.deleteFailed'));
|
||||
} finally {
|
||||
deletingQuestion.value = null;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ const toggleParentContext = async (item: any, index: number) => {
|
||||
parentContextCache.value = new Map(parentContextCache.value);
|
||||
}
|
||||
} catch (err) {
|
||||
MessagePlugin.error(t('knowledgeBase.parentContextLoadFailed') || '加载父上下文失败');
|
||||
MessagePlugin.error(t('knowledgeBase.parentContextLoadFailed'));
|
||||
return;
|
||||
} finally {
|
||||
parentContextLoading.value.delete(index);
|
||||
@@ -681,7 +681,7 @@ const handleDetailsScroll = () => {
|
||||
|
||||
<!-- URL类型专属区域 -->
|
||||
<div v-else-if="details.type === 'url'" class="url_box">
|
||||
<span class="label">{{ $t('knowledgeBase.urlSource') || '来源网址' }}</span>
|
||||
<span class="label">{{ $t('knowledgeBase.urlSource') }}</span>
|
||||
<div class="url_link_box">
|
||||
<a :href="details.source" target="_blank" class="url_link">
|
||||
<t-icon name="link" size="14px" />
|
||||
@@ -693,7 +693,7 @@ const handleDetailsScroll = () => {
|
||||
|
||||
<!-- 手动创建类型专属区域 -->
|
||||
<div v-else-if="details.type === 'manual'" class="manual_box">
|
||||
<span class="label">{{ $t('knowledgeBase.documentTitle') || '文档标题' }}</span>
|
||||
<span class="label">{{ $t('knowledgeBase.documentTitle') }}</span>
|
||||
<div class="manual_title_box">
|
||||
<span class="manual_title">{{ details.title }}</span>
|
||||
</div>
|
||||
@@ -704,7 +704,7 @@ const handleDetailsScroll = () => {
|
||||
<div class="title-row">
|
||||
<span class="label">{{ getContentLabel() }}</span>
|
||||
<span v-if="details.total > 0" class="chunk-count">
|
||||
{{ $t('knowledgeBase.chunkCount', { count: details.total }) || `共 ${details.total} 个片段` }}
|
||||
{{ $t('knowledgeBase.chunkCount', { count: details.total }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="meta-row">
|
||||
@@ -718,7 +718,7 @@ const handleDetailsScroll = () => {
|
||||
@click="viewMode = 'preview'"
|
||||
class="view-mode-btn"
|
||||
>
|
||||
{{ $t('preview.tab') || '预览' }}
|
||||
{{ $t('preview.tab') }}
|
||||
</t-button>
|
||||
<t-button
|
||||
v-if="!canPreview()"
|
||||
@@ -728,7 +728,7 @@ const handleDetailsScroll = () => {
|
||||
@click="viewMode = 'merged'"
|
||||
class="view-mode-btn"
|
||||
>
|
||||
{{ $t('knowledgeBase.viewMerged') || '全文' }}
|
||||
{{ $t('knowledgeBase.viewMerged') }}
|
||||
</t-button>
|
||||
<t-button
|
||||
size="small"
|
||||
@@ -737,7 +737,7 @@ const handleDetailsScroll = () => {
|
||||
@click="viewMode = 'chunks'"
|
||||
class="view-mode-btn"
|
||||
>
|
||||
{{ $t('knowledgeBase.viewChunks') || '分块' }}
|
||||
{{ $t('knowledgeBase.viewChunks') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -760,7 +760,7 @@ const handleDetailsScroll = () => {
|
||||
:class="getChunkClass(index)"
|
||||
>
|
||||
<div class="chunk-header">
|
||||
<span class="chunk-index">{{ $t('knowledgeBase.segment') || '片段' }} {{ index + 1 }}</span>
|
||||
<span class="chunk-index">{{ $t('knowledgeBase.segment') }} {{ index + 1 }}</span>
|
||||
<div class="chunk-header-right">
|
||||
<t-tag
|
||||
v-if="hasParentChunk(item)"
|
||||
@@ -768,7 +768,7 @@ const handleDetailsScroll = () => {
|
||||
theme="primary"
|
||||
variant="light"
|
||||
>
|
||||
{{ $t('knowledgeBase.childChunk') || '子块' }}
|
||||
{{ $t('knowledgeBase.childChunk') }}
|
||||
</t-tag>
|
||||
<t-tag
|
||||
v-if="getGeneratedQuestions(item).length > 0"
|
||||
@@ -776,7 +776,7 @@ const handleDetailsScroll = () => {
|
||||
theme="success"
|
||||
variant="light"
|
||||
>
|
||||
{{ $t('knowledgeBase.questions') || '问题' }} {{ getGeneratedQuestions(item).length }}
|
||||
{{ $t('knowledgeBase.questions') }} {{ getGeneratedQuestions(item).length }}
|
||||
</t-tag>
|
||||
<span class="chunk-meta">{{ getChunkMeta(item) }}</span>
|
||||
</div>
|
||||
@@ -788,7 +788,7 @@ const handleDetailsScroll = () => {
|
||||
<div class="parent-context-toggle" @click="toggleParentContext(item, index)">
|
||||
<t-icon v-if="!parentContextLoading.has(index)" :name="isParentExpanded(index) ? 'chevron-down' : 'chevron-right'" size="14px" />
|
||||
<t-loading v-else size="small" style="width: 14px; height: 14px;" />
|
||||
<span>{{ $t('knowledgeBase.viewParentContext') || '查看父块上下文' }}</span>
|
||||
<span>{{ $t('knowledgeBase.viewParentContext') }}</span>
|
||||
</div>
|
||||
<div v-show="isParentExpanded(index)" class="parent-context-content">
|
||||
<div class="md-content" v-html="processMarkdown(getParentContent(item))"></div>
|
||||
@@ -799,7 +799,7 @@ const handleDetailsScroll = () => {
|
||||
<div v-if="getGeneratedQuestions(item).length > 0" class="questions-section">
|
||||
<div class="questions-toggle" @click="toggleQuestions(index)">
|
||||
<t-icon :name="isExpanded(index) ? 'chevron-down' : 'chevron-right'" size="14px" />
|
||||
<span>{{ $t('knowledgeBase.generatedQuestions') || '生成的问题' }} ({{ getGeneratedQuestions(item).length }})</span>
|
||||
<span>{{ $t('knowledgeBase.generatedQuestions') }} ({{ getGeneratedQuestions(item).length }})</span>
|
||||
</div>
|
||||
<div v-show="isExpanded(index)" class="questions-list">
|
||||
<div
|
||||
|
||||
@@ -684,7 +684,7 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<template #empty>
|
||||
<div style="padding: 20px; text-align: center; color: var(--td-text-color-placeholder);">
|
||||
{{ $t('manualEditor.noDocumentKnowledgeBases') || '暂无可用的文档型知识库,请先创建一个文档型知识库' }}
|
||||
{{ $t('manualEditor.noDocumentKnowledgeBases') }}
|
||||
</div>
|
||||
</template>
|
||||
</t-select>
|
||||
|
||||
@@ -453,7 +453,7 @@ const delCard = (index: number, item: any) => {
|
||||
total.value--;
|
||||
}
|
||||
} else {
|
||||
MessagePlugin.error("删除失败,请稍后再试!");
|
||||
MessagePlugin.error(t('chat.deleteSessionFailed'));
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -495,7 +495,7 @@ const getMessageList = async (isLoadMore = false) => {
|
||||
// Display all sessions globally without filtering
|
||||
res.data.forEach((item: any) => {
|
||||
let obj = {
|
||||
title: item.title ? item.title : "新会话",
|
||||
title: item.title ? item.title : t('menu.newSession'),
|
||||
path: `chat/${item.id}`,
|
||||
id: item.id,
|
||||
isMore: false,
|
||||
@@ -678,7 +678,7 @@ const gotopage = async (path: string) => {
|
||||
}
|
||||
// 清理所有状态和本地存储
|
||||
authStore.logout();
|
||||
MessagePlugin.success('已退出登录');
|
||||
MessagePlugin.success(t('menu.logoutSuccess'));
|
||||
router.push('/login');
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user