fix(i18n): complete multilingual support for TDesign components and locale key synchronization

- Synchronize 2641 i18n keys across all 4 locales (en-US, zh-CN, ko-KR, ru-RU)
- Add TDesign ConfigProvider with dynamic locale to ensure all UI
  components (select, input, empty states, dialogs) display in the
  user's chosen language
- Fix provider dropdown in model editor: use i18n keys with API fallback
- Fix connection test messages: always use i18n for user-facing feedback
- Add explicit placeholders to t-select components in settings pages
- Add missing i18n keys: theme.selectTheme, organization role selectors,
  lkeap provider translations
This commit is contained in:
ochan.kwon
2026-03-06 22:27:50 +09:00
committed by lyingbug
parent 6c69de2df1
commit 10614df567
10 changed files with 1050 additions and 150 deletions
+25 -4
View File
@@ -1,11 +1,32 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import ManualKnowledgeEditor from '@/components/manual-knowledge-editor.vue' import ManualKnowledgeEditor from '@/components/manual-knowledge-editor.vue'
// TDesign locale configs
import enUSConfig from 'tdesign-vue-next/esm/locale/en_US'
import zhCNConfig from 'tdesign-vue-next/esm/locale/zh_CN'
import koKRConfig from 'tdesign-vue-next/esm/locale/ko_KR'
import ruRUConfig from 'tdesign-vue-next/esm/locale/ru_RU'
const { locale } = useI18n()
const tdLocaleMap: Record<string, object> = {
'en-US': enUSConfig,
'zh-CN': zhCNConfig,
'ko-KR': koKRConfig,
'ru-RU': ruRUConfig,
}
const tdGlobalConfig = computed(() => tdLocaleMap[locale.value] || enUSConfig)
</script> </script>
<template> <template>
<div id="app"> <t-config-provider :globalConfig="tdGlobalConfig">
<RouterView /> <div id="app">
<ManualKnowledgeEditor /> <RouterView />
</div> <ManualKnowledgeEditor />
</div>
</t-config-provider>
</template> </template>
<style> <style>
body, body,
+31 -12
View File
@@ -274,7 +274,7 @@ interface Props {
modelData?: ModelFormData | null modelData?: ModelFormData | null
} }
const { t } = useI18n() const { t, te } = useI18n()
const uiStore = useUIStore() const uiStore = useUIStore()
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
@@ -381,13 +381,22 @@ const loadProviders = async () => {
} }
// 根据当前模型类型过滤的 Provider 列表 // 根据当前模型类型过滤的 Provider 列表
// API 返回的 defaultUrls/modelTypes 数据优先,但 label/description 使用 i18n
const providerOptions = computed(() => { const providerOptions = computed(() => {
// 优先使用 API 返回的数据 // API 数据可用时,用 API 的结构数据 + i18n 的显示文本
if (apiProviderOptions.value.length > 0) { if (apiProviderOptions.value.length > 0) {
return apiProviderOptions.value return apiProviderOptions.value.map(p => ({
...p,
label: te(`model.editor.providers.${p.value}.label`)
? t(`model.editor.providers.${p.value}.label`)
: p.label,
description: te(`model.editor.providers.${p.value}.description`)
? t(`model.editor.providers.${p.value}.description`)
: p.description,
}))
} }
// 回退到硬编码值,按 modelTypes 过滤 // 回退到硬编码值,按 modelTypes 过滤
return fallbackProviderOptions.value.filter(p => return fallbackProviderOptions.value.filter(p =>
p.modelTypes.includes(props.modelType) p.modelTypes.includes(props.modelType)
) )
}) })
@@ -716,14 +725,17 @@ const checkOllamaDimension = async () => {
dimensionMessage.value = t('model.editor.dimensionDetected', { value: result.dimension }) dimensionMessage.value = t('model.editor.dimensionDetected', { value: result.dimension })
MessagePlugin.success(dimensionMessage.value) MessagePlugin.success(dimensionMessage.value)
} else { } else {
dimensionMessage.value = result.message || t('model.editor.dimensionFailed') if (result.message) {
console.debug('Backend dimension message:', result.message)
}
dimensionMessage.value = t('model.editor.dimensionFailed')
MessagePlugin.warning(dimensionMessage.value) MessagePlugin.warning(dimensionMessage.value)
} }
} catch (error: any) { } catch (error: any) {
console.error('检测 Ollama 模型维度失败:', error) console.error('Ollama dimension check failed:', error)
dimensionChecked.value = true dimensionChecked.value = true
dimensionSuccess.value = false dimensionSuccess.value = false
dimensionMessage.value = error.message || t('model.editor.dimensionFailed') dimensionMessage.value = t('model.editor.dimensionFailed')
MessagePlugin.error(dimensionMessage.value) MessagePlugin.error(dimensionMessage.value)
} finally { } finally {
checking.value = false checking.value = false
@@ -798,18 +810,24 @@ const checkRemoteAPI = async () => {
remoteChecked.value = true remoteChecked.value = true
remoteAvailable.value = result.available || false remoteAvailable.value = result.available || false
remoteMessage.value = result.message || (result.available ? t('model.editor.connectionSuccess') : t('model.editor.connectionFailed')) // Always use i18n for display; backend message is for debugging only
if (result.message) {
console.debug('Backend message:', result.message)
}
remoteMessage.value = result.available
? t('model.editor.connectionSuccess')
: t('model.editor.connectionFailed')
if (result.available) { if (result.available) {
MessagePlugin.success(remoteMessage.value) MessagePlugin.success(remoteMessage.value)
} else { } else {
MessagePlugin.error(remoteMessage.value) MessagePlugin.error(remoteMessage.value)
} }
} catch (error: any) { } catch (error: any) {
console.error('Remote API 校验失败:', error) console.error('Remote API check failed:', error)
remoteChecked.value = true remoteChecked.value = true
remoteAvailable.value = false remoteAvailable.value = false
remoteMessage.value = error.message || t('model.editor.connectionConfigError') remoteMessage.value = t('model.editor.connectionConfigError')
MessagePlugin.error(remoteMessage.value) MessagePlugin.error(remoteMessage.value)
} finally { } finally {
checking.value = false checking.value = false
@@ -947,7 +965,8 @@ const startDownload = async (modelName: string) => {
downloading.value = false downloading.value = false
downloadProgress.value = 0 downloadProgress.value = 0
currentDownloadModel.value = '' currentDownloadModel.value = ''
MessagePlugin.error(error.message || t('model.editor.downloadStartFailed')) console.error('Download start failed:', error)
MessagePlugin.error(t('model.editor.downloadStartFailed'))
} }
} }
+20 -7
View File
@@ -1035,6 +1035,7 @@ export default {
reset: 'Reset', reset: 'Reset',
clear: 'Clear', clear: 'Clear',
website: 'Official Website', website: 'Official Website',
github: 'GitHub',
on: 'On', on: 'On',
off: 'Off', off: 'Off',
resetToDefault: 'Reset to default', resetToDefault: 'Reset to default',
@@ -1210,9 +1211,6 @@ export default {
agentEnabled: 'Agent Mode enabled', agentEnabled: 'Agent Mode enabled',
agentDisabled: 'Agent Mode disabled', agentDisabled: 'Agent Mode disabled',
agentNotReadyDetail: 'Agent is not ready. Please configure the following: {reasons}', agentNotReadyDetail: 'Agent is not ready. Please configure the following: {reasons}',
agentMissingAllowedTools: 'Allowed tools',
agentMissingSummaryModel: 'Chat Model (Summary Model)',
agentMissingRerankModel: 'Rerank Model',
webSearchNotConfigured: 'Web search engine is not configured. Please configure a provider and credentials in settings.', webSearchNotConfigured: 'Web search engine is not configured. Please configure a provider and credentials in settings.',
webSearchEnabled: 'Web search enabled', webSearchEnabled: 'Web search enabled',
webSearchDisabled: 'Web search disabled', webSearchDisabled: 'Web search disabled',
@@ -1281,7 +1279,10 @@ export default {
}, },
messages: { messages: {
deleted: 'Knowledge base deleted', deleted: 'Knowledge base deleted',
deleteFailed: 'Failed to delete knowledge base' deleteFailed: 'Failed to delete knowledge base',
file: 'File',
knowledgeBase: 'Knowledge Base',
noResult: 'No results',
}, },
detail: { detail: {
title: 'Shared Knowledge Base', title: 'Shared Knowledge Base',
@@ -1327,7 +1328,7 @@ export default {
completedDetail: 'All {total} files uploaded. Refreshing list to show parsing status...', completedDetail: 'All {total} files uploaded. Refreshing list to show parsing status...',
refreshing: 'Refreshing list to show parsing status...', refreshing: 'Refreshing list to show parsing status...',
errorTip: 'Some files failed to upload. Please check the notifications.', errorTip: 'Some files failed to upload. Please check the notifications.',
unknownKb: 'Knowledge Base {id}' unknownKb: 'Knowledge Base {id}',
} }
}, },
knowledgeEditor: { knowledgeEditor: {
@@ -1403,9 +1404,13 @@ export default {
separate: 'Separate' separate: 'Separate'
}, },
standardQuestion: 'Primary Question', standardQuestion: 'Primary Question',
standardQuestionDesc: 'Set the standard phrasing of the question — this is the most common way users ask it.',
answers: 'Answers', answers: 'Answers',
answersDesc: 'Provide complete and accurate answer content. Multiple answers can be added to cover different scenarios.',
similarQuestions: 'Similar Questions', similarQuestions: 'Similar Questions',
similarQuestionsDesc: 'Add questions with the same meaning but different phrasing to help the system better match user queries.',
negativeQuestions: 'Negative Examples', negativeQuestions: 'Negative Examples',
negativeQuestionsDesc: 'Add questions that should not match this answer, to exclude false positives.',
categoryLabel: 'FAQ Category', categoryLabel: 'FAQ Category',
categoryButton: 'Switch Category', categoryButton: 'Switch Category',
editorCreate: 'Create FAQ Entry', editorCreate: 'Create FAQ Entry',
@@ -1708,8 +1713,6 @@ export default {
noMatchFound: 'No matching content found', noMatchFound: 'No matching content found',
deleteSessionFailed: 'Delete failed, please try again later!', deleteSessionFailed: 'Delete failed, please try again later!',
}, },
noMatchFound: 'No matching content found',
deleteSessionFailed: 'Delete failed, please try again later!',
tenant: { tenant: {
title: 'Tenant Information', title: 'Tenant Information',
currentTenant: 'Current Tenant', currentTenant: 'Current Tenant',
@@ -1868,6 +1871,7 @@ export default {
fileSizeExceeded: 'File size cannot exceed {size}MB!', fileSizeExceeded: 'File size cannot exceed {size}MB!',
unsupportedFileType: 'Unsupported file type!', unsupportedFileType: 'Unsupported file type!',
invalidFileType: 'Invalid file type!', invalidFileType: 'Invalid file type!',
invalidImageLink: 'Invalid image link',
missingKbId: 'Missing knowledge base ID', missingKbId: 'Missing knowledge base ID',
tokenNotFound: 'Login token not found, please log in again', tokenNotFound: 'Login token not found, please log in again',
streamFailed: 'Stream connection failed', streamFailed: 'Stream connection failed',
@@ -2059,8 +2063,13 @@ export default {
label: 'LongCat AI', label: 'LongCat AI',
description: 'LongCat-Flash-Chat, LongCat-Flash-Thinking, etc.', description: 'LongCat-Flash-Chat, LongCat-Flash-Thinking, etc.',
}, },
lkeap: {
label: 'Tencent Cloud LKEAP',
description: 'DeepSeek-R1, DeepSeek-V3 series with chain-of-thought',
},
}, },
}, },
builtinTag: 'Built-in',
}, },
language: { language: {
zhCN: '简体中文', zhCN: '简体中文',
@@ -2085,6 +2094,7 @@ export default {
light: 'Light', light: 'Light',
dark: 'Dark', dark: 'Dark',
system: 'Follow System', system: 'Follow System',
selectTheme: 'Select theme',
}, },
platform: { platform: {
subtitle: 'Enterprise-level Intelligent Document Retrieval Framework', subtitle: 'Enterprise-level Intelligent Document Retrieval Framework',
@@ -2134,9 +2144,11 @@ export default {
notReady: 'Not Ready', notReady: 'Not Ready',
hint: 'Once configuration is complete, the status will change to "Ready". You can then enable Agent mode in the chat.', hint: 'Once configuration is complete, the status will change to "Ready". You can then enable Agent mode in the chat.',
missingThinkingModel: 'Thinking model', missingThinkingModel: 'Thinking model',
missingSummaryModel: 'Chat Model (Summary Model)',
missingRerankModel: 'Rerank model', missingRerankModel: 'Rerank model',
missingAllowedTools: 'Allowed tools', missingAllowedTools: 'Allowed tools',
pleaseConfigure: 'Please configure {items}', pleaseConfigure: 'Please configure {items}',
goToConfig: 'Go to configure chat model',
goConfigureModels: 'Configure models →' goConfigureModels: 'Configure models →'
}, },
maxIterations: { maxIterations: {
@@ -2537,6 +2549,7 @@ export default {
} }
}, },
promptTemplate: { promptTemplate: {
noTemplates: 'No templates available',
selectTemplate: 'Select Template', selectTemplate: 'Select Template',
useTemplate: 'Use Template', useTemplate: 'Use Template',
withKnowledgeBase: 'KB', withKnowledgeBase: 'KB',
+12 -2
View File
@@ -135,6 +135,11 @@ export default {
createdAt: "생성일시", createdAt: "생성일시",
updatedAt: "수정일시", updatedAt: "수정일시",
clickToViewFull: "전체 텍스트와 세그먼트를 보려면 카드를 클릭하세요.", clickToViewFull: "전체 텍스트와 세그먼트를 보려면 카드를 클릭하세요.",
rebuildDocument: "지식 재구축",
rebuildConfirm: '문서 "{fileName}"을(를) 재구축하시겠습니까? 기존 청크가 삭제되고 다시 파싱됩니다.',
rebuildSubmitted: "재구축 작업이 제출되었습니다",
rebuildFailed: "재구축 실패, 나중에 다시 시도해주세요",
rebuildInProgress: "현재 문서가 파싱 중입니다. 나중에 다시 시도해주세요",
characters: "자", characters: "자",
segment: "조각", segment: "조각",
chunkCount: "총 {count}개 조각", chunkCount: "총 {count}개 조각",
@@ -882,6 +887,7 @@ export default {
reset: "초기화", reset: "초기화",
clear: "지우기", clear: "지우기",
website: "공식 웹사이트", website: "공식 웹사이트",
github: 'GitHub',
on: "켜기", on: "켜기",
off: "끄기", off: "끄기",
resetToDefault: "기본값 복원", resetToDefault: "기본값 복원",
@@ -1539,6 +1545,10 @@ export default {
label: "LongCat AI", label: "LongCat AI",
description: "LongCat-Flash-Chat, LongCat-Flash-Thinking, etc.", description: "LongCat-Flash-Chat, LongCat-Flash-Thinking, etc.",
}, },
lkeap: {
label: "텐센트 클라우드 LKEAP",
description: "DeepSeek-R1, DeepSeek-V3 시리즈, 사고 체인 지원",
},
}, },
}, },
builtinTag: '내장', builtinTag: '내장',
@@ -1566,6 +1576,7 @@ export default {
light: "라이트", light: "라이트",
dark: "다크", dark: "다크",
system: "시스템 설정", system: "시스템 설정",
selectTheme: "테마 선택",
}, },
platform: { platform: {
subtitle: "엔터프라이즈급 지능형 문서 검색 프레임워크", subtitle: "엔터프라이즈급 지능형 문서 검색 프레임워크",
@@ -1814,6 +1825,7 @@ export default {
faq: "FAQ 설정", faq: "FAQ 설정",
graph: "지식 그래프", graph: "지식 그래프",
share: "공유관리", share: "공유관리",
storage: "스토리지 엔진",
}, },
basic: { basic: {
title: "기본 정보", title: "기본 정보",
@@ -2224,8 +2236,6 @@ export default {
placeholder: "시스템 Prompt를 입력하거나 비워두면 기본 Prompt가 사용됩니다...", placeholder: "시스템 Prompt를 입력하거나 비워두면 기본 Prompt가 사용됩니다...",
tabHintDetail: "통합 시스템 프롬프트 (비워두면 시스템 기본값 사용, {'{{'}web_search_status{'}}'} 자리 표시자로 웹 검색 동작을 동적 제어)", tabHintDetail: "통합 시스템 프롬프트 (비워두면 시스템 기본값 사용, {'{{'}web_search_status{'}}'} 자리 표시자로 웹 검색 동작을 동적 제어)",
tabHint: "웹 검색 활성화 여부에 따라 시스템 Prompt를 개별적으로 설정합니다.", tabHint: "웹 검색 활성화 여부에 따라 시스템 Prompt를 개별적으로 설정합니다.",
tabWebOn: "웹 검색 활성화됨",
tabWebOff: "웹 검색 비활성화됨",
}, },
reset: { reset: {
header: "기본 Prompt 복원", header: "기본 Prompt 복원",
File diff suppressed because it is too large Load Diff
+6
View File
@@ -880,6 +880,7 @@ export default {
reset: "重置", reset: "重置",
clear: "清空", clear: "清空",
website: "官方网站", website: "官方网站",
github: 'GitHub',
on: "开启", on: "开启",
off: "关闭", off: "关闭",
resetToDefault: "恢复默认", resetToDefault: "恢复默认",
@@ -1521,6 +1522,10 @@ export default {
label: "LongCat AI", label: "LongCat AI",
description: "LongCat-Flash-Chat, LongCat-Flash-Thinking, etc.", description: "LongCat-Flash-Chat, LongCat-Flash-Thinking, etc.",
}, },
lkeap: {
label: "腾讯云 LKEAP",
description: "DeepSeek-R1, DeepSeek-V3 系列模型,支持思维链",
},
}, },
}, },
builtinTag: "内置", builtinTag: "内置",
@@ -1548,6 +1553,7 @@ export default {
light: "浅色", light: "浅色",
dark: "深色", dark: "深色",
system: "跟随系统", system: "跟随系统",
selectTheme: "选择主题",
}, },
platform: { platform: {
subtitle: "企业级智能文档检索框架", subtitle: "企业级智能文档检索框架",
@@ -681,7 +681,7 @@
</p> </p>
<div class="upgrade-form-item"> <div class="upgrade-form-item">
<label>{{ $t('organization.upgrade.selectRole') }}</label> <label>{{ $t('organization.upgrade.selectRole') }}</label>
<t-select v-model="upgradeForm.requested_role" :options="upgradeRoleOptions" /> <t-select v-model="upgradeForm.requested_role" :options="upgradeRoleOptions" :placeholder="$t('organization.upgrade.selectRole')" />
</div> </div>
<div class="upgrade-form-item"> <div class="upgrade-form-item">
<label>{{ $t('organization.upgrade.reason') }}</label> <label>{{ $t('organization.upgrade.reason') }}</label>
@@ -725,7 +725,7 @@
<div class="add-member-field"> <div class="add-member-field">
<label>{{ $t('organization.addMember.selectRole') }}</label> <label>{{ $t('organization.addMember.selectRole') }}</label>
<t-select v-model="addMemberRole" :options="addMemberRoleOptions" /> <t-select v-model="addMemberRole" :options="addMemberRoleOptions" :placeholder="$t('organization.addMember.selectRole')" />
</div> </div>
</div> </div>
</t-dialog> </t-dialog>
@@ -37,6 +37,7 @@
<t-select <t-select
v-model="localTheme" v-model="localTheme"
style="width: 280px;" style="width: 280px;"
:placeholder="$t('theme.selectTheme')"
@change="handleThemeChange" @change="handleThemeChange"
> >
<t-option value="light" :label="$t('theme.light')">{{ $t('theme.light') }}</t-option> <t-option value="light" :label="$t('theme.light')">{{ $t('theme.light') }}</t-option>
@@ -28,7 +28,7 @@
<p class="desc">{{ $t('settings.storage.defaultEngineDesc') }}</p> <p class="desc">{{ $t('settings.storage.defaultEngineDesc') }}</p>
</div> </div>
<div class="setting-control"> <div class="setting-control">
<t-select v-model="config.default_provider" style="width: 280px;"> <t-select v-model="config.default_provider" style="width: 280px;" :placeholder="$t('settings.storage.defaultEngine')">
<t-option value="local" :label="$t('settings.storage.engineLocal')" /> <t-option value="local" :label="$t('settings.storage.engineLocal')" />
<t-option value="minio" label="MinIO" /> <t-option value="minio" label="MinIO" />
<t-option value="cos" :label="$t('settings.storage.engineCos')" /> <t-option value="cos" :label="$t('settings.storage.engineCos')" />
@@ -103,6 +103,7 @@
v-model="localCompressionMethod" v-model="localCompressionMethod"
@change="handleCompressionMethodChange" @change="handleCompressionMethodChange"
style="width: 280px;" style="width: 280px;"
:placeholder="t('webSearchSettings.compressionLabel')"
> >
<t-option value="none" :label="t('webSearchSettings.compressionNone')"> <t-option value="none" :label="t('webSearchSettings.compressionNone')">
{{ t('webSearchSettings.compressionNone') }} {{ t('webSearchSettings.compressionNone') }}