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