Files
syops/frontend/scripts/merge-kb-runtime-i18n.mjs

407 lines
28 KiB
JavaScript

/**
* scripts/merge-kb-runtime-i18n.mjs
* 合并 kbWorkspace 运行时文案(status / workflow / errors / msg)至各语言 kb.json
*/
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const localesRoot = path.resolve(__dirname, '../src/locales');
const patches = {
en: {
status: {
draft: 'Pending upload',
uploaded: 'Uploaded',
processing: 'Cleaning',
cleaned: 'Cleaned',
ready: 'Ready',
synced: 'Synced',
syncing: 'Syncing',
failed: 'Failed',
queued: 'Queued',
running: 'Running',
success: 'Success',
cancelled: 'Cancelled',
idle: 'Not started',
done: 'Completed',
pendingClean: 'Pending clean',
pendingSync: 'Pending sync',
cleaning: 'Cleaning',
uploading: 'Uploading',
unknown: 'Unknown status',
unnamedDocument: 'Untitled document',
},
workflow: { upload: 'Upload', clean: 'Clean', sync: 'Sync' },
failureModal: {
uploadData: 'Upload failures',
cleanData: 'Clean failures',
syncData: 'Sync failures',
generic: 'Failure data',
stageUploadFailed: 'Upload failed',
stageCleanFailed: 'Clean failed',
stageSyncFailed: 'Sync failed',
},
errors: {
unreadableClean: 'Historical failure reason is unreadable. Click "Clean data" to retry.',
unreadableSync: 'Historical sync failure is unreadable. Please retry sync.',
unreadableUpload: 'Historical upload failure is unreadable. Please re-upload.',
legacyCleanRecovered: 'Legacy clean task was recovered manually. Click "Clean data" to retry.',
sourceFileNotFound: 'Source file not found. Re-upload before cleaning.',
cleanTimeout: 'Clean timed out. Retry later or check if the source file is corrupted.',
duplicateFile: 'Upload failed: file already exists.',
apiRequestFailed: 'Knowledge base API request failed.',
localFolder: 'Local folder',
fileFallback: 'File {index}',
uploadFailed: 'Upload failed',
},
msg: {
operationFailed: 'Operation failed',
loadGroupsFailed: 'Failed to load groups',
loadDocumentsFailed: 'Failed to load documents',
loadJobsFailed: 'Failed to load jobs',
readSourceFailed: 'Failed to read source file',
noVersion: 'No version',
readMarkdownFailed: 'Failed to read cleaned Markdown',
saveMarkdownFailed: 'Failed to save Markdown',
markdownSaved: 'Cleaned Markdown saved',
deleteDocumentFailed: 'Failed to delete document',
documentDeleted: 'Document deleted',
selectDocumentsToSync: 'Please select documents to sync',
batchSyncResult: 'Batch sync submitted: {success} succeeded, {fail} failed. {detail}',
batchSyncSuccess: 'Batch sync submitted: {success} succeeded',
selectDocumentsToClean: 'Please select documents to clean',
noDocumentsToClean: 'No selected documents can be cleaned',
batchCleanResult: 'Batch clean submitted: {success} succeeded, {fail} failed. {detail}',
batchCleanSuccess: 'Batch clean submitted: {success} succeeded',
selectDocumentsToDelete: 'Please select documents to delete',
batchDeleteResult: 'Batch delete completed: {success} succeeded, {fail} failed. {detail}',
batchDeleteSuccess: 'Batch delete completed: {success} succeeded',
reselectFile: 'Please re-select a file for "{name}"',
recleanFailed: 'Re-clean failed',
recleanSubmitted: 'Re-clean submitted: {name}',
resyncFailed: 'Re-sync failed: {detail}',
resyncSubmitted: 'Re-sync submitted: {name}',
processingFile: 'Processing file...',
uploadFailed: 'File upload failed',
versionUploaded: 'Version "{file}" uploaded, clean queued',
uploadingProgress: 'Uploading {current}/{total}: {file}',
createDocumentFailed: 'Failed to create document',
uploadVersionFailed: 'Failed to upload version',
uploadCleanupFailed: 'Upload failed and empty document could not be removed ({detail})',
uploadSummary: 'Upload done: {success} succeeded, {fail} failed. {detail}',
uploadAllSuccess: 'Uploaded {count} file(s), clean tasks queued',
syncDifyFailed: 'Sync to Dify failed: {detail}',
syncDifyFailedGeneric: 'Sync to Dify failed',
syncSubmitted: 'Sync task submitted',
pathUploadBusy: 'Upload in progress, please wait',
selectGroupFirst: 'Please select a group first',
selectPathFiles: 'Please select at least one local folder or file',
createPathJobFailed: 'Failed to create path upload job',
pathStageFailed: 'Path file staging failed',
pathUploadDone: 'Path files uploaded and clean submitted',
deletePathFileConfirm: 'Delete path file "{path}"?',
deletePathFileFailed: 'Failed to delete path file',
pathRecordDeletedWithDoc: 'Path record deleted with document',
pathRecordDeleted: 'Path record deleted',
selectPathFilesToDelete: 'Please select files to delete',
batchDeletePathConfirm: 'Delete {count} selected path file(s)?',
batchDeletePathResult: 'Batch delete: {success} succeeded, {fail} failed. {detail}',
batchDeletePathSuccess: 'Batch delete: {success} succeeded',
retryPathFailed: 'Failed to retry files',
retryPathOne: 'Failed file resubmitted',
retryPathAll: 'Failed files resubmitted',
pathUploadProgress: 'Path upload: total {total}, pending {pending}, uploaded {uploaded}, failed {failed}',
deleteDocumentConfirm: 'Delete document "{name}"?',
batchDeleteDocumentsConfirm: 'Delete {count} selected document(s)? Dify documents will also be removed.',
markdownFailedWithReason: 'Clean failed, no Markdown yet. Reason: {reason}',
markdownFailedRetry: 'Clean failed, no Markdown yet. Please re-clean.',
markdownProcessing: 'Document is being cleaned, no Markdown yet.',
markdownPendingClean: 'Document pending clean, no Markdown yet.',
markdownNotGenerated: 'No Markdown generated for this document yet.',
},
},
'zh-CN': {
status: {
draft: '待上传', uploaded: '已上传', processing: '清洗中', cleaned: '已清洗', ready: '已就绪',
synced: '已同步', syncing: '同步中', failed: '失败', queued: '排队中', running: '进行中',
success: '成功', cancelled: '已取消', idle: '未开始', done: '已完成', pendingClean: '待清洗',
pendingSync: '待同步', cleaning: '清洗中', uploading: '上传中', unknown: '未知状态', unnamedDocument: '未命名文档',
},
workflow: { upload: '上传', clean: '清洗', sync: '同步' },
failureModal: {
uploadData: '上传失败数据', cleanData: '清洗失败数据', syncData: '同步失败数据', generic: '失败数据',
stageUploadFailed: '上传失败', stageCleanFailed: '清洗失败', stageSyncFailed: '同步失败',
},
errors: {
unreadableClean: '历史失败任务原因不可读,请重新点击“清洗数据”发起清洗',
unreadableSync: '历史同步失败原因不可读,请重新发起同步',
unreadableUpload: '历史上传失败原因不可读,请重新上传文件',
legacyCleanRecovered: '历史遗留清洗任务已人工回收,请重新点击“清洗数据”发起清洗',
sourceFileNotFound: '原始文件不存在,请重新上传后再清洗',
cleanTimeout: '文件清洗超时,请稍后重试;若多次失败,请检查源文件是否损坏',
duplicateFile: '上传失败,文件已存在',
apiRequestFailed: '知识库接口请求失败',
localFolder: '本地目录',
fileFallback: '文件{index}',
uploadFailed: '上传失败',
},
msg: {
operationFailed: '操作失败',
loadGroupsFailed: '加载知识库分组失败',
loadDocumentsFailed: '加载文档列表失败',
loadJobsFailed: '加载任务列表失败',
readSourceFailed: '读取原始文件失败',
noVersion: '暂无版本',
readMarkdownFailed: '读取清洗后的 Markdown 失败',
saveMarkdownFailed: '保存 Markdown 失败',
markdownSaved: '清洗后的 Markdown 已保存',
deleteDocumentFailed: '删除文档失败',
documentDeleted: '文档已删除',
selectDocumentsToSync: '请先选择要批量同步的文档',
batchSyncResult: '批量同步任务已提交:成功 {success} 条,失败 {fail} 条。{detail}',
batchSyncSuccess: '批量同步任务已提交:共成功 {success} 条',
selectDocumentsToClean: '请先选择要清洗的文档',
noDocumentsToClean: '当前所选文档没有可重新清洗的项',
batchCleanResult: '批量清洗任务已提交:成功 {success} 条,失败 {fail} 条。{detail}',
batchCleanSuccess: '批量清洗任务已提交:共成功 {success} 条',
selectDocumentsToDelete: '请先选择要批量删除的文档',
batchDeleteResult: '批量删除完成:成功 {success} 条,失败 {fail} 条。{detail}',
batchDeleteSuccess: '批量删除完成:共成功 {success} 条',
reselectFile: '请重新为「{name}」选择文件后提交',
recleanFailed: '重新清洗失败',
recleanSubmitted: '已重新提交清洗:{name}',
resyncFailed: '重新同步失败:{detail}',
resyncSubmitted: '已重新提交同步:{name}',
processingFile: '开始处理文件...',
uploadFailed: '文件上传失败',
versionUploaded: '版本文件「{file}」上传成功,清洗已排队',
uploadingProgress: '正在上传 {current}/{total}: {file}',
createDocumentFailed: '创建文档失败',
uploadVersionFailed: '上传文档版本失败',
uploadCleanupFailed: '上传失败后未能自动清理空文档({detail})',
uploadSummary: '上传完成:成功 {success} 个,失败 {fail} 个。{detail}',
uploadAllSuccess: '成功上传 {count} 个文件,清洗任务已排队',
syncDifyFailed: '同步到 Dify 失败:{detail}',
syncDifyFailedGeneric: '同步到 Dify 失败',
syncSubmitted: '同步任务已提交,等待后台处理',
pathUploadBusy: '有文件正在上传请稍等再试~',
selectGroupFirst: '请先选择知识库分组',
selectPathFiles: '请先选择至少一个本地目录或文件',
createPathJobFailed: '创建上传路径任务失败',
pathStageFailed: '路径文件暂存失败',
pathUploadDone: '路径文件已逐个上传并提交清洗',
deletePathFileConfirm: '确认删除路径文件「{path}」吗?',
deletePathFileFailed: '删除路径上传文件失败',
pathRecordDeletedWithDoc: '已删除路径记录,并同步删除对应文档',
pathRecordDeleted: '已删除路径记录',
selectPathFilesToDelete: '请先选择要删除的文件',
batchDeletePathConfirm: '确认批量删除已选中的 {count} 条路径文件吗?',
batchDeletePathResult: '批量删除完成:成功 {success} 条,失败 {fail} 条。{detail}',
batchDeletePathSuccess: '批量删除完成:共成功 {success} 条',
retryPathFailed: '重试失败文件失败',
retryPathOne: '已重新提交该失败文件',
retryPathAll: '已重新提交失败文件',
pathUploadProgress: '路径上传进度:总计 {total} 条,待上传 {pending} 条,已上传 {uploaded} 条,失败 {failed} 条',
deleteDocumentConfirm: '确认删除文档「{name}」吗?',
batchDeleteDocumentsConfirm: '确认批量删除已选中的 {count} 条文档吗?会同步删除 Dify 对应文档。',
markdownFailedWithReason: '当前文档清洗失败,尚未生成 Markdown。失败原因:{reason}',
markdownFailedRetry: '当前文档清洗失败,尚未生成 Markdown,请重新清洗后重试',
markdownProcessing: '当前文档正在清洗中,暂未生成 Markdown,请稍后再试',
markdownPendingClean: '当前文档待清洗,暂未生成 Markdown,请先发起清洗',
markdownNotGenerated: '当前文档尚未生成 Markdown',
},
},
'zh-TW': {
status: {
draft: '待上傳', uploaded: '已上傳', processing: '清洗中', cleaned: '已清洗', ready: '已就緒',
synced: '已同步', syncing: '同步中', failed: '失敗', queued: '排隊中', running: '進行中',
success: '成功', cancelled: '已取消', idle: '未開始', done: '已完成', pendingClean: '待清洗',
pendingSync: '待同步', cleaning: '清洗中', uploading: '上傳中', unknown: '未知狀態', unnamedDocument: '未命名文檔',
},
workflow: { upload: '上傳', clean: '清洗', sync: '同步' },
failureModal: {
uploadData: '上傳失敗數據', cleanData: '清洗失敗數據', syncData: '同步失敗數據', generic: '失敗數據',
stageUploadFailed: '上傳失敗', stageCleanFailed: '清洗失敗', stageSyncFailed: '同步失敗',
},
errors: {
unreadableClean: '歷史失敗任務原因不可讀,請重新點擊「清洗數據」發起清洗',
unreadableSync: '歷史同步失敗原因不可讀,請重新發起同步',
unreadableUpload: '歷史上傳失敗原因不可讀,請重新上傳文件',
legacyCleanRecovered: '歷史遺留清洗任務已人工回收,請重新點擊「清洗數據」發起清洗',
sourceFileNotFound: '原始文件不存在,請重新上傳後再清洗',
cleanTimeout: '文件清洗超時,請稍後重試;若多次失敗,請檢查源文件是否損壞',
duplicateFile: '上傳失敗,文件已存在',
apiRequestFailed: '知識庫接口請求失敗',
localFolder: '本地目錄',
fileFallback: '文件{index}',
uploadFailed: '上傳失敗',
},
msg: {
operationFailed: '操作失敗',
loadGroupsFailed: '載入知識庫分組失敗',
loadDocumentsFailed: '載入文檔列表失敗',
loadJobsFailed: '載入任務列表失敗',
readSourceFailed: '讀取原始文件失敗',
noVersion: '暫無版本',
readMarkdownFailed: '讀取清洗後的 Markdown 失敗',
saveMarkdownFailed: '保存 Markdown 失敗',
markdownSaved: '清洗後的 Markdown 已保存',
deleteDocumentFailed: '刪除文檔失敗',
documentDeleted: '文檔已刪除',
selectDocumentsToSync: '請先選擇要批量同步的文檔',
batchSyncResult: '批量同步任務已提交:成功 {success} 條,失敗 {fail} 條。{detail}',
batchSyncSuccess: '批量同步任務已提交:共成功 {success} 條',
selectDocumentsToClean: '請先選擇要清洗的文檔',
noDocumentsToClean: '當前所選文檔沒有可重新清洗的項',
batchCleanResult: '批量清洗任務已提交:成功 {success} 條,失敗 {fail} 條。{detail}',
batchCleanSuccess: '批量清洗任務已提交:共成功 {success} 條',
selectDocumentsToDelete: '請先選擇要批量刪除的文檔',
batchDeleteResult: '批量刪除完成:成功 {success} 條,失敗 {fail} 條。{detail}',
batchDeleteSuccess: '批量刪除完成:共成功 {success} 條',
reselectFile: '請重新為「{name}」選擇文件後提交',
recleanFailed: '重新清洗失敗',
recleanSubmitted: '已重新提交清洗:{name}',
resyncFailed: '重新同步失敗:{detail}',
resyncSubmitted: '已重新提交同步:{name}',
processingFile: '開始處理文件...',
uploadFailed: '文件上傳失敗',
versionUploaded: '版本文件「{file}」上傳成功,清洗已排隊',
uploadingProgress: '正在上傳 {current}/{total}: {file}',
createDocumentFailed: '創建文檔失敗',
uploadVersionFailed: '上傳文檔版本失敗',
uploadCleanupFailed: '上傳失敗後未能自動清理空文檔({detail})',
uploadSummary: '上傳完成:成功 {success} 個,失敗 {fail} 個。{detail}',
uploadAllSuccess: '成功上傳 {count} 個文件,清洗任務已排隊',
syncDifyFailed: '同步到 Dify 失敗:{detail}',
syncDifyFailedGeneric: '同步到 Dify 失敗',
syncSubmitted: '同步任務已提交,等待後台處理',
pathUploadBusy: '有文件正在上傳請稍等再試~',
selectGroupFirst: '請先選擇知識庫分組',
selectPathFiles: '請先選擇至少一個本地目錄或文件',
createPathJobFailed: '創建上傳路徑任務失敗',
pathStageFailed: '路徑文件暫存失敗',
pathUploadDone: '路徑文件已逐個上傳並提交清洗',
deletePathFileConfirm: '確認刪除路徑文件「{path}」嗎?',
deletePathFileFailed: '刪除路徑上傳文件失敗',
pathRecordDeletedWithDoc: '已刪除路徑記錄,並同步刪除對應文檔',
pathRecordDeleted: '已刪除路徑記錄',
selectPathFilesToDelete: '請先選擇要刪除的文件',
batchDeletePathConfirm: '確認批量刪除已選中的 {count} 條路徑文件嗎?',
batchDeletePathResult: '批量刪除完成:成功 {success} 條,失敗 {fail} 條。{detail}',
batchDeletePathSuccess: '批量刪除完成:共成功 {success} 條',
retryPathFailed: '重試失敗文件失敗',
retryPathOne: '已重新提交該失敗文件',
retryPathAll: '已重新提交失敗文件',
pathUploadProgress: '路徑上傳進度:總計 {total} 條,待上傳 {pending} 條,已上傳 {uploaded} 條,失敗 {failed} 條',
deleteDocumentConfirm: '確認刪除文檔「{name}」嗎?',
batchDeleteDocumentsConfirm: '確認批量刪除已選中的 {count} 條文檔嗎?會同步刪除 Dify 對應文檔。',
markdownFailedWithReason: '當前文檔清洗失敗,尚未生成 Markdown。失敗原因:{reason}',
markdownFailedRetry: '當前文檔清洗失敗,尚未生成 Markdown,請重新清洗後重試',
markdownProcessing: '當前文檔正在清洗中,暫未生成 Markdown,請稍後再試',
markdownPendingClean: '當前文檔待清洗,暫未生成 Markdown,請先發起清洗',
markdownNotGenerated: '當前文檔尚未生成 Markdown',
},
},
th: {
status: {
draft: 'รออัปโหลด', uploaded: 'อัปโหลดแล้ว', processing: 'กำลังทำความสะอาด', cleaned: 'ทำความสะอาดแล้ว', ready: 'พร้อม',
synced: 'ซิงค์แล้ว', syncing: 'กำลังซิงค์', failed: 'ล้มเหลว', queued: 'อยู่ในคิว', running: 'กำลังดำเนินการ',
success: 'สำเร็จ', cancelled: 'ยกเลิกแล้ว', idle: 'ยังไม่เริ่ม', done: 'เสร็จสิ้น', pendingClean: 'รอทำความสะอาด',
pendingSync: 'รอซิงค์', cleaning: 'กำลังทำความสะอาด', uploading: 'กำลังอัปโหลด', unknown: 'สถานะไม่ทราบ', unnamedDocument: 'เอกสารไม่มีชื่อ',
},
workflow: { upload: 'อัปโหลด', clean: 'ทำความสะอาด', sync: 'ซิงค์' },
failureModal: {
uploadData: 'ข้อมูลอัปโหลดล้มเหลว', cleanData: 'ข้อมูลทำความสะอาดล้มเหลว', syncData: 'ข้อมูลซิงค์ล้มเหลว', generic: 'ข้อมูลล้มเหลว',
stageUploadFailed: 'อัปโหลดล้มเหลว', stageCleanFailed: 'ทำความสะอาดล้มเหลว', stageSyncFailed: 'ซิงค์ล้มเหลว',
},
errors: {
unreadableClean: 'ไม่สามารถอ่านสาเหตุความล้มเหลวในอดีตได้ กด "ทำความสะอาดข้อมูล" เพื่อลองใหม่',
unreadableSync: 'ไม่สามารถอ่านสาเหตุซิงค์ล้มเหลวในอดีตได้ โปรดซิงค์ใหม่',
unreadableUpload: 'ไม่สามารถอ่านสาเหตุอัปโหลดล้มเหลวในอดีตได้ โปรดอัปโหลดใหม่',
legacyCleanRecovered: 'งานทำความสะอาดเก่าถูกกู้คืนด้วยตนเอง กด "ทำความสะอาดข้อมูล" เพื่อลองใหม่',
sourceFileNotFound: 'ไม่พบไฟล์ต้นฉบับ โปรดอัปโหลดใหม่ก่อนทำความสะอาด',
cleanTimeout: 'ทำความสะอาดหมดเวลา ลองใหม่ภายหลังหรือตรวจสอบไฟล์ต้นฉบับ',
duplicateFile: 'อัปโหลดล้มเหลว: มีไฟล์นี้อยู่แล้ว',
apiRequestFailed: 'คำขอ API คลังความรู้ล้มเหลว',
localFolder: 'โฟลเดอร์ในเครื่อง',
fileFallback: 'ไฟล์ {index}',
uploadFailed: 'อัปโหลดล้มเหลว',
},
msg: {
operationFailed: 'ดำเนินการล้มเหลว',
loadGroupsFailed: 'โหลดกลุ่มล้มเหลว',
loadDocumentsFailed: 'โหลดเอกสารล้มเหลว',
loadJobsFailed: 'โหลดงานล้มเหลว',
readSourceFailed: 'อ่านไฟล์ต้นฉบับล้มเหลว',
noVersion: 'ไม่มีเวอร์ชัน',
readMarkdownFailed: 'อ่าน Markdown ที่ทำความสะอาดแล้วล้มเหลว',
saveMarkdownFailed: 'บันทึก Markdown ล้มเหลว',
markdownSaved: 'บันทึก Markdown ที่ทำความสะอาดแล้ว',
deleteDocumentFailed: 'ลบเอกสารล้มเหลว',
documentDeleted: 'ลบเอกสารแล้ว',
selectDocumentsToSync: 'โปรดเลือกเอกสารที่จะซิงค์เป็นชุด',
batchSyncResult: 'ส่งซิงค์เป็นชุด: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchSyncSuccess: 'ส่งซิงค์เป็นชุด: สำเร็จ {success}',
selectDocumentsToClean: 'โปรดเลือกเอกสารที่จะทำความสะอาด',
noDocumentsToClean: 'เอกสารที่เลือกไม่มีรายการที่ทำความสะอาดได้',
batchCleanResult: 'ส่งทำความสะอาดเป็นชุด: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchCleanSuccess: 'ส่งทำความสะอาดเป็นชุด: สำเร็จ {success}',
selectDocumentsToDelete: 'โปรดเลือกเอกสารที่จะลบเป็นชุด',
batchDeleteResult: 'ลบเป็นชุดเสร็จ: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchDeleteSuccess: 'ลบเป็นชุดเสร็จ: สำเร็จ {success}',
reselectFile: 'โปรดเลือกไฟล์ใหม่สำหรับ "{name}"',
recleanFailed: 'ทำความสะอาดใหม่ล้มเหลว',
recleanSubmitted: 'ส่งทำความสะอาดใหม่: {name}',
resyncFailed: 'ซิงค์ใหม่ล้มเหลว: {detail}',
resyncSubmitted: 'ส่งซิงค์ใหม่: {name}',
processingFile: 'เริ่มประมวลผลไฟล์...',
uploadFailed: 'อัปโหลดไฟล์ล้มเหลว',
versionUploaded: 'อัปโหลดเวอร์ชัน "{file}" แล้ว งานทำความสะอาดอยู่ในคิว',
uploadingProgress: 'กำลังอัปโหลด {current}/{total}: {file}',
createDocumentFailed: 'สร้างเอกสารล้มเหลว',
uploadVersionFailed: 'อัปโหลดเวอร์ชันเอกสารล้มเหลว',
uploadCleanupFailed: 'อัปโหลดล้มเหลวและลบเอกสารว่างไม่ได้ ({detail})',
uploadSummary: 'อัปโหลดเสร็จ: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
uploadAllSuccess: 'อัปโหลด {count} ไฟล์สำเร็จ งานทำความสะอาดอยู่ในคิว',
syncDifyFailed: 'ซิงค์ไป Dify ล้มเหลว: {detail}',
syncDifyFailedGeneric: 'ซิงค์ไป Dify ล้มเหลว',
syncSubmitted: 'ส่งงานซิงค์แล้ว',
pathUploadBusy: 'กำลังอัปโหลด โปรดรอสักครู่',
selectGroupFirst: 'โปรดเลือกกลุ่มก่อน',
selectPathFiles: 'โปรดเลือกโฟลเดอร์หรือไฟล์ในเครื่องอย่างน้อยหนึ่งรายการ',
createPathJobFailed: 'สร้างงานอัปโหลด path ล้มเหลว',
pathStageFailed: 'จัดเก็บไฟล์ path ชั่วคราวล้มเหลว',
pathUploadDone: 'อัปโหลดไฟล์ path และส่งทำความสะอาดแล้ว',
deletePathFileConfirm: 'ลบไฟล์ path "{path}"?',
deletePathFileFailed: 'ลบไฟล์ path ล้มเหลว',
pathRecordDeletedWithDoc: 'ลบบันทึก path และเอกสารที่เกี่ยวข้องแล้ว',
pathRecordDeleted: 'ลบบันทึก path แล้ว',
selectPathFilesToDelete: 'โปรดเลือกไฟล์ที่จะลบ',
batchDeletePathConfirm: 'ลบไฟล์ path ที่เลือก {count} รายการ?',
batchDeletePathResult: 'ลบเป็นชุด: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchDeletePathSuccess: 'ลบเป็นชุด: สำเร็จ {success}',
retryPathFailed: 'ลองใหม่ไฟล์ล้มเหลวไม่สำเร็จ',
retryPathOne: 'ส่งไฟล์ที่ล้มเหลวใหม่แล้ว',
retryPathAll: 'ส่งไฟล์ล้มเหลวทั้งหมดใหม่แล้ว',
pathUploadProgress: 'อัปโหลด path: ทั้งหมด {total}, รอ {pending}, อัปโหลด {uploaded}, ล้มเหลว {failed}',
deleteDocumentConfirm: 'ลบเอกสาร "{name}"?',
batchDeleteDocumentsConfirm: 'ลบเอกสารที่เลือก {count} รายการ? จะลบใน Dify ด้วย',
markdownFailedWithReason: 'ทำความสะอาดล้มเหลว ยังไม่มี Markdown. สาเหตุ: {reason}',
markdownFailedRetry: 'ทำความสะอาดล้มเหลว ยังไม่มี Markdown โปรดทำความสะอาดใหม่',
markdownProcessing: 'กำลังทำความสะอาด ยังไม่มี Markdown',
markdownPendingClean: 'รอทำความสะอาด ยังไม่มี Markdown',
markdownNotGenerated: 'ยังไม่มี Markdown สำหรับเอกสารนี้',
},
},
};
for (const [locale, patch] of Object.entries(patches)) {
const filePath = path.join(localesRoot, locale, 'kb.json');
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
data.kbWorkspace = { ...data.kbWorkspace, ...patch };
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
console.log(`Merged runtime i18n into ${locale}/kb.json`);
}