/** * scripts/merge-kb-workspace-i18n.mjs * 合并 kbWorkspace 作业面 i18n 键至各语言 locales 下 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: { sidebar: { groupsTitle: 'Groups', loadingGroups: 'Loading groups...', emptyGroups: 'No knowledge base groups yet.', noDescription: 'No description', }, summary: { currentGroup: 'Current group', documentCount: 'Documents', pendingSync: 'Pending sync', uploadFailed: 'Upload failures', cleanFailed: 'Clean failures', syncFailed: 'Sync failures', }, filters: { all: 'All', upload: 'Upload', clean: 'Clean', sync: 'Sync' }, common: { processing: 'Processing...', delete: 'Delete', close: 'Close', cancel: 'Cancel', retry: 'Retry', remove: 'Remove', none: 'None', countUnit: 'items', failureReason: 'Reason: {reason}', perPage: 'Per page', prevPage: 'Previous', nextPage: 'Next', }, documents: { title: 'Documents', infoTip: 'Basic document entries in this group. Uploading files creates documents and starts cleaning automatically.', uploadPath: 'Upload path', uploadFile: 'Upload file', batchClean: 'Clean data', batchCleanCount: 'Clean data ({count})', batchSync: 'Batch sync', batchSyncCount: 'Batch sync ({count})', batchDelete: 'Batch delete', batchDeleteCount: 'Batch delete ({count})', historyBatches: 'History batches', searchPlaceholder: 'Search by file name', clearSearch: 'Clear search', selectGroup: 'Please select a knowledge base group.', loadingDocuments: 'Loading documents...', emptyNoDocs: 'No documents in this group. Upload a file above to create the first record.', emptyNoSearchMatch: 'No documents match the current search and filters.', emptyNoFilterMatch: 'No documents match the current filters.', versionCount: 'Versions: {count}', currentVersion: 'Current: v{version}', viewRecord: 'View history', uploadVersion: 'Upload version', syncDify: 'Sync to Dify', syncingDify: 'Syncing...', updatedAt: 'Updated: {time}', selectedCount: 'Selected {selected} · Total {total}', showingRange: 'Showing {start}-{end}', pageInfo: 'Page {page} / {totalPages} · {total} items', documentFallback: 'Document #{id}', }, pathUpload: { progressTitle: 'Path upload progress', uploading: 'Uploading', completed: 'Completed', batchHint: 'Recommended {batchSize} files per batch, auto-continue every {seconds}s.', total: 'Total {count}', pending: 'Pending {count}', uploaded: 'Uploaded {count}', failed: 'Failed {count}', success: 'Success {count}', pendingProcess: 'Pending {count}', currentFile: 'Current file: {name}', details: 'Upload details', viewHistory: 'View history', retryFailedFiles: 'Retry failed files', retryAllFailed: 'Retry all failed files', selectAllFiltered: 'Select all filtered', deselectAllFiltered: 'Deselect all', selectAll: 'Select all', deselectAll: 'Deselect all', batchLabel: 'Batch #{id}', createdAt: 'Created: {time}', finishedAt: ' · Finished: {time}', noBatchMessage: 'No batch description', batchDelete: 'Batch delete', batchDeleteCount: 'Batch delete ({count})', deleting: 'Deleting...', emptyHistory: 'No path upload history yet.', }, recordModal: { title: 'Document history', viewing: 'Viewing: {name}', loading: 'Loading document history...', versionsTitle: 'Versions', versionsCount: '{count} items', versionsEmpty: 'No versions yet. Upload a version to see it here.', syncTitle: 'Dify sync records', syncEmpty: 'No Dify sync records. Click "Sync to Dify" to create one.', versionLabel: 'Version: {id}', sizeBytes: 'Size: {size} bytes', }, markdownModal: { readingVersion: 'Loading current version...', previewText: 'Preview text', cleanMarkdown: 'Cleaned Markdown', loading: 'Loading cleaned Markdown...', placeholder: 'No Markdown yet. Paste or edit content here.', saving: 'Saving...', save: 'Save Markdown', editorTitle: 'Markdown editor', }, sourceInfoModal: { title: 'Source file info', viewing: 'Viewing: {name}', loading: 'Loading source file info...', empty: 'No source file info. Upload a version to see it here.', currentVersion: 'Current version', opening: 'Opening...', fileName: 'File: {name}', fileSize: 'Size: {size}', fileType: 'Type: {ext}', }, failureModal: { summary: '{count} failure records in this group, {pageSize} per page.', empty: 'No failure data.', currentVersion: 'Current version:', noVersion: 'No version', resubmit: 'Resubmit', reclean: 'Re-clean', resync: 'Re-sync', pageInfo: 'Page {page} / {totalPages}', }, pathUploadModal: { title: 'Upload path', subtitle: 'Select a local folder. Files are imported in batches and enter the cleaning workflow automatically.', localPickerTitle: 'Local folder picker', localPickerHint: 'You can add folders multiple times. Browsers cannot read arbitrary pasted paths.', pickFolder: 'Select local folder', pathListLabel: 'Path list', pathListPlaceholder: 'Paths fill in after folder selection; paste notes for multiple paths if needed.', pendingFiles: 'Pending files', selectedRoots: 'Selected roots: {paths}', noRoots: 'None', pickFolderFirst: 'Select a local folder before confirming upload.', confirmUpload: 'Confirm upload', }, pathUploadHistoryModal: { title: 'Path upload history', subtitle: 'View batch results, failed files, and retry options.', }, }, 'zh-CN': { sidebar: { groupsTitle: '分组列表', loadingGroups: '正在加载分组...', emptyGroups: '暂无知识库分组。', noDescription: '暂无描述', }, summary: { currentGroup: '当前知识库分组', documentCount: '文档数量', pendingSync: '待同步数量', uploadFailed: '上传失败数量', cleanFailed: '清洗失败数量', syncFailed: '同步失败数量', }, filters: { all: '全部', upload: '上传', clean: '清洗', sync: '同步' }, common: { processing: '处理中...', delete: '删除', close: '关闭', cancel: '取消', retry: '重试', remove: '移除', none: '暂无', countUnit: '条', failureReason: '失败原因:{reason}', perPage: '每页', prevPage: '上一页', nextPage: '下一页', }, documents: { title: '文档列表', infoTip: '当前分组下的基础文档条目,上传文件后将自动创建文档并开始清洗流程。', uploadPath: '上传路径', uploadFile: '上传文件', batchClean: '清洗数据', batchCleanCount: '清洗数据({count})', batchSync: '批量同步', batchSyncCount: '批量同步({count})', batchDelete: '批量删除', batchDeleteCount: '批量删除({count})', historyBatches: '历史批次', searchPlaceholder: '按文件名称模糊搜索', clearSearch: '清空搜索', selectGroup: '请选择一个知识库分组。', loadingDocuments: '正在加载文档...', emptyNoDocs: '当前分组暂无文档,可直接在上方创建第一条文档记录。', emptyNoSearchMatch: '当前搜索和筛选条件下暂无匹配文档。', emptyNoFilterMatch: '当前筛选条件下暂无匹配文档。', versionCount: '版本数:{count}', currentVersion: ' · 当前版本:v{version} · ', viewRecord: '查看记录', uploadVersion: '上传版本', syncDify: '同步 Dify', syncingDify: '同步中...', updatedAt: '更新时间:{time}', selectedCount: '已选 {selected} 条 · 共 {total} 条', showingRange: '当前显示 {start}-{end} 条', pageInfo: '第 {page} / {totalPages} 页 · 共 {total} 条', documentFallback: '文档 #{id}', }, pathUpload: { progressTitle: '路径上传进度', uploading: '上传中', completed: '已完成', batchHint: '建议每批 {batchSize} 条,间隔 {seconds} 秒自动继续。', total: '总计 {count}', pending: '待上传 {count}', uploaded: '已上传 {count}', failed: '失败 {count}', success: '成功 {count}', pendingProcess: '待处理 {count}', currentFile: '当前文件:{name}', details: '上传详情', viewHistory: '查看历史', retryFailedFiles: '重试失败文件', retryAllFailed: '重试全部失败文件', selectAllFiltered: '全选当前筛选', deselectAllFiltered: '取消全选', selectAll: '全选', deselectAll: '取消全选', batchLabel: '批次 #{id}', createdAt: '创建时间:{time}', finishedAt: ' · 完成时间:{time}', noBatchMessage: '暂无批次说明', batchDelete: '批量删除', batchDeleteCount: '批量删除 ({count})', deleting: '删除中...', emptyHistory: '当前暂无上传路径历史批次。', }, recordModal: { title: '文档记录', viewing: '当前查看:{name}', loading: '正在加载文档记录...', versionsTitle: '版本记录', versionsCount: '{count} 条', versionsEmpty: '暂无版本记录,上传版本后会显示在这里。', syncTitle: 'Dify 同步记录', syncEmpty: '暂无 Dify 同步记录,手动点击“同步 Dify”后会显示在这里。', versionLabel: '版本:{id}', sizeBytes: '大小:{size} bytes', }, markdownModal: { readingVersion: '正在读取当前版本...', previewText: '预览文本', cleanMarkdown: '清洗 Markdown', loading: '正在加载清洗后的 Markdown...', placeholder: '当前文档尚未生成 Markdown,可在此粘贴或编辑内容。', saving: '保存中...', save: '保存 Markdown', editorTitle: 'Markdown 编辑器', }, sourceInfoModal: { title: '源文件信息', viewing: '当前查看:{name}', loading: '正在加载源文件信息...', empty: '暂无源文件信息,上传版本后会显示在这里。', currentVersion: '当前版本', opening: '正在打开...', fileName: '文件名:{name}', fileSize: '大小:{size}', fileType: '类型:{ext}', }, failureModal: { summary: '当前分组共 {count} 条失败记录,每页 {pageSize} 条。', empty: '当前没有失败数据。', currentVersion: '当前版本:', noVersion: '暂无版本', resubmit: '重新提交', reclean: '重新清洗', resync: '重新同步', pageInfo: '第 {page} / {totalPages} 页', }, pathUploadModal: { title: '上传路径', subtitle: '选择本地目录后,系统会按批次将该路径下文件导入当前分组并自动进入清洗流程。', localPickerTitle: '本地路径选择', localPickerHint: '支持多次选择目录追加文件;当前浏览器安全限制下,手动粘贴任意本机路径不能直接读取文件内容。', pickFolder: '选择本地目录', pathListLabel: '路径清单', pathListPlaceholder: '目录选择后会自动填充路径清单;如需记录多路径,可在此粘贴备注。', pendingFiles: '待上传文件', selectedRoots: '已选根路径:{paths}', noRoots: '暂无', pickFolderFirst: '请选择本地目录后再确认上传。', confirmUpload: '确认上传', }, pathUploadHistoryModal: { title: '上传路径历史批次', subtitle: '查看每次路径上传的批次结果、失败文件与重试入口。', }, }, 'zh-TW': { sidebar: { groupsTitle: '分組列表', loadingGroups: '正在載入分組...', emptyGroups: '暫無知識庫分組。', noDescription: '暫無描述', }, summary: { currentGroup: '當前知識庫分組', documentCount: '文檔數量', pendingSync: '待同步數量', uploadFailed: '上傳失敗數量', cleanFailed: '清洗失敗數量', syncFailed: '同步失敗數量', }, filters: { all: '全部', upload: '上傳', clean: '清洗', sync: '同步' }, common: { processing: '處理中...', delete: '刪除', close: '關閉', cancel: '取消', retry: '重試', remove: '移除', none: '暫無', countUnit: '條', failureReason: '失敗原因:{reason}', perPage: '每頁', prevPage: '上一頁', nextPage: '下一頁', }, documents: { title: '文檔列表', infoTip: '當前分組下的基礎文檔條目,上傳文件後將自動創建文檔並開始清洗流程。', uploadPath: '上傳路徑', uploadFile: '上傳文件', batchClean: '清洗數據', batchCleanCount: '清洗數據({count})', batchSync: '批量同步', batchSyncCount: '批量同步({count})', batchDelete: '批量刪除', batchDeleteCount: '批量刪除({count})', historyBatches: '歷史批次', searchPlaceholder: '按文件名稱模糊搜索', clearSearch: '清空搜索', selectGroup: '請選擇一個知識庫分組。', loadingDocuments: '正在載入文檔...', emptyNoDocs: '當前分組暫無文檔,可直接在上方創建第一條文檔記錄。', emptyNoSearchMatch: '當前搜索和篩選條件下暫無匹配文檔。', emptyNoFilterMatch: '當前篩選條件下暫無匹配文檔。', versionCount: '版本數:{count}', currentVersion: ' · 當前版本:v{version} · ', viewRecord: '查看記錄', uploadVersion: '上傳版本', syncDify: '同步 Dify', syncingDify: '同步中...', updatedAt: '更新時間:{time}', selectedCount: '已選 {selected} 條 · 共 {total} 條', showingRange: '當前顯示 {start}-{end} 條', pageInfo: '第 {page} / {totalPages} 頁 · 共 {total} 條', documentFallback: '文檔 #{id}', }, pathUpload: { progressTitle: '路徑上傳進度', uploading: '上傳中', completed: '已完成', batchHint: '建議每批 {batchSize} 條,間隔 {seconds} 秒自動繼續。', total: '總計 {count}', pending: '待上傳 {count}', uploaded: '已上傳 {count}', failed: '失敗 {count}', success: '成功 {count}', pendingProcess: '待處理 {count}', currentFile: '當前文件:{name}', details: '上傳詳情', viewHistory: '查看歷史', retryFailedFiles: '重試失敗文件', retryAllFailed: '重試全部失敗文件', selectAllFiltered: '全選當前篩選', deselectAllFiltered: '取消全選', selectAll: '全選', deselectAll: '取消全選', batchLabel: '批次 #{id}', createdAt: '創建時間:{time}', finishedAt: ' · 完成時間:{time}', noBatchMessage: '暫無批次說明', batchDelete: '批量刪除', batchDeleteCount: '批量刪除 ({count})', deleting: '刪除中...', emptyHistory: '當前暫無上傳路徑歷史批次。', }, recordModal: { title: '文檔記錄', viewing: '當前查看:{name}', loading: '正在載入文檔記錄...', versionsTitle: '版本記錄', versionsCount: '{count} 條', versionsEmpty: '暫無版本記錄,上傳版本後會顯示在這裡。', syncTitle: 'Dify 同步記錄', syncEmpty: '暫無 Dify 同步記錄,手動點擊「同步 Dify」後會顯示在這裡。', versionLabel: '版本:{id}', sizeBytes: '大小:{size} bytes', }, markdownModal: { readingVersion: '正在讀取當前版本...', previewText: '預覽文本', cleanMarkdown: '清洗 Markdown', loading: '正在載入清洗後的 Markdown...', placeholder: '當前文檔尚未生成 Markdown,可在此粘貼或編輯內容。', saving: '保存中...', save: '保存 Markdown', editorTitle: 'Markdown 編輯器', }, sourceInfoModal: { title: '源文件信息', viewing: '當前查看:{name}', loading: '正在載入源文件信息...', empty: '暫無源文件信息,上傳版本後會顯示在這裡。', currentVersion: '當前版本', opening: '正在打開...', fileName: '文件名:{name}', fileSize: '大小:{size}', fileType: '類型:{ext}', }, failureModal: { summary: '當前分組共 {count} 條失敗記錄,每頁 {pageSize} 條。', empty: '當前沒有失敗數據。', currentVersion: '當前版本:', noVersion: '暫無版本', resubmit: '重新提交', reclean: '重新清洗', resync: '重新同步', pageInfo: '第 {page} / {totalPages} 頁', }, pathUploadModal: { title: '上傳路徑', subtitle: '選擇本地目錄後,系統會按批次將該路徑下文件導入當前分組並自動進入清洗流程。', localPickerTitle: '本地路徑選擇', localPickerHint: '支持多次選擇目錄追加文件;當前瀏覽器安全限制下,手動粘貼任意本機路徑不能直接讀取文件內容。', pickFolder: '選擇本地目錄', pathListLabel: '路徑清單', pathListPlaceholder: '目錄選擇後會自動填充路徑清單;如需記錄多路徑,可在此粘貼備註。', pendingFiles: '待上傳文件', selectedRoots: '已選根路徑:{paths}', noRoots: '暫無', pickFolderFirst: '請選擇本地目錄後再確認上傳。', confirmUpload: '確認上傳', }, pathUploadHistoryModal: { title: '上傳路徑歷史批次', subtitle: '查看每次路徑上傳的批次結果、失敗文件與重試入口。', }, }, th: { sidebar: { groupsTitle: 'รายการกลุ่ม', loadingGroups: 'กำลังโหลดกลุ่ม...', emptyGroups: 'ยังไม่มีกลุ่มคลังความรู้', noDescription: 'ไม่มีคำอธิบาย', }, summary: { currentGroup: 'กลุ่มปัจจุบัน', documentCount: 'จำนวนเอกสาร', pendingSync: 'รอซิงค์', uploadFailed: 'อัปโหลดล้มเหลว', cleanFailed: 'ทำความสะอาดล้มเหลว', syncFailed: 'ซิงค์ล้มเหลว', }, filters: { all: 'ทั้งหมด', upload: 'อัปโหลด', clean: 'ทำความสะอาด', sync: 'ซิงค์' }, common: { processing: 'กำลังดำเนินการ...', delete: 'ลบ', close: 'ปิด', cancel: 'ยกเลิก', retry: 'ลองใหม่', remove: 'นำออก', none: 'ไม่มี', countUnit: 'รายการ', failureReason: 'สาเหตุ: {reason}', perPage: 'ต่อหน้า', prevPage: 'ก่อนหน้า', nextPage: 'ถัดไป', }, documents: { title: 'รายการเอกสาร', infoTip: 'รายการเอกสารพื้นฐานในกลุ่มนี้ การอัปโหลดไฟล์จะสร้างเอกสารและเริ่มทำความสะอาดอัตโนมัติ', uploadPath: 'อัปโหลดจาก path', uploadFile: 'อัปโหลดไฟล์', batchClean: 'ทำความสะอาดข้อมูล', batchCleanCount: 'ทำความสะอาดข้อมูล ({count})', batchSync: 'ซิงค์เป็นชุด', batchSyncCount: 'ซิงค์เป็นชุด ({count})', batchDelete: 'ลบเป็นชุด', batchDeleteCount: 'ลบเป็นชุด ({count})', historyBatches: 'ประวัติ batch', searchPlaceholder: 'ค้นหาตามชื่อไฟล์', clearSearch: 'ล้างการค้นหา', selectGroup: 'โปรดเลือกกลุ่มคลังความรู้', loadingDocuments: 'กำลังโหลดเอกสาร...', emptyNoDocs: 'ยังไม่มีเอกสารในกลุ่มนี้ อัปโหลดไฟล์ด้านบนเพื่อสร้างรายการแรก', emptyNoSearchMatch: 'ไม่พบเอกสารที่ตรงกับการค้นหาและตัวกรอง', emptyNoFilterMatch: 'ไม่พบเอกสารที่ตรงกับตัวกรอง', versionCount: 'เวอร์ชัน: {count}', currentVersion: ' · เวอร์ชันปัจจุบัน: v{version} · ', viewRecord: 'ดูประวัติ', uploadVersion: 'อัปโหลดเวอร์ชัน', syncDify: 'ซิงค์ไป Dify', syncingDify: 'กำลังซิงค์...', updatedAt: 'อัปเดต: {time}', selectedCount: 'เลือก {selected} · ทั้งหมด {total}', showingRange: 'แสดง {start}-{end}', pageInfo: 'หน้า {page} / {totalPages} · {total} รายการ', documentFallback: 'เอกสาร #{id}', }, pathUpload: { progressTitle: 'ความคืบหน้าการอัปโหลด path', uploading: 'กำลังอัปโหลด', completed: 'เสร็จสิ้น', batchHint: 'แนะนำ {batchSize} ไฟล์ต่อ batch ทำต่ออัตโนมัติทุก {seconds} วินาที', total: 'ทั้งหมด {count}', pending: 'รออัปโหลด {count}', uploaded: 'อัปโหลดแล้ว {count}', failed: 'ล้มเหลว {count}', success: 'สำเร็จ {count}', pendingProcess: 'รอดำเนินการ {count}', currentFile: 'ไฟล์ปัจจุบัน: {name}', details: 'รายละเอียดการอัปโหลด', viewHistory: 'ดูประวัติ', retryFailedFiles: 'ลองใหม่ไฟล์ที่ล้มเหลว', retryAllFailed: 'ลองใหม่ไฟล์ล้มเหลวทั้งหมด', selectAllFiltered: 'เลือกทั้งหมดที่กรอง', deselectAllFiltered: 'ยกเลิกการเลือก', selectAll: 'เลือกทั้งหมด', deselectAll: 'ยกเลิกการเลือก', batchLabel: 'Batch #{id}', createdAt: 'สร้างเมื่อ: {time}', finishedAt: ' · เสร็จเมื่อ: {time}', noBatchMessage: 'ไม่มีคำอธิบาย batch', batchDelete: 'ลบเป็นชุด', batchDeleteCount: 'ลบเป็นชุด ({count})', deleting: 'กำลังลบ...', emptyHistory: 'ยังไม่มีประวัติการอัปโหลด path', }, recordModal: { title: 'ประวัติเอกสาร', viewing: 'กำลังดู: {name}', loading: 'กำลังโหลดประวัติเอกสาร...', versionsTitle: 'เวอร์ชัน', versionsCount: '{count} รายการ', versionsEmpty: 'ยังไม่มีเวอร์ชัน อัปโหลดเวอร์ชันเพื่อดูที่นี่', syncTitle: 'บันทึกซิงค์ Dify', syncEmpty: 'ยังไม่มีบันทึกซิงค์ Dify คลิก "ซิงค์ไป Dify" เพื่อสร้าง', versionLabel: 'เวอร์ชัน: {id}', sizeBytes: 'ขนาด: {size} bytes', }, markdownModal: { readingVersion: 'กำลังโหลดเวอร์ชันปัจจุบัน...', previewText: 'ข้อความตัวอย่าง', cleanMarkdown: 'Markdown ที่ทำความสะอาดแล้ว', loading: 'กำลังโหลด Markdown...', placeholder: 'ยังไม่มี Markdown วางหรือแก้ไขเนื้อหาได้ที่นี่', saving: 'กำลังบันทึก...', save: 'บันทึก Markdown', editorTitle: 'ตัวแก้ไข Markdown', }, sourceInfoModal: { title: 'ข้อมูลไฟล์ต้นฉบับ', viewing: 'กำลังดู: {name}', loading: 'กำลังโหลดข้อมูลไฟล์ต้นฉบับ...', empty: 'ยังไม่มีข้อมูลไฟล์ต้นฉบับ อัปโหลดเวอร์ชันเพื่อดูที่นี่', currentVersion: 'เวอร์ชันปัจจุบัน', opening: 'กำลังเปิด...', fileName: 'ไฟล์: {name}', fileSize: 'ขนาด: {size}', fileType: 'ประเภท: {ext}', }, failureModal: { summary: 'กลุ่มนี้มี {count} รายการล้มเหลว {pageSize} รายการต่อหน้า', empty: 'ไม่มีข้อมูลล้มเหลว', currentVersion: 'เวอร์ชันปัจจุบัน:', noVersion: 'ไม่มีเวอร์ชัน', resubmit: 'ส่งใหม่', reclean: 'ทำความสะอาดใหม่', resync: 'ซิงค์ใหม่', pageInfo: 'หน้า {page} / {totalPages}', }, pathUploadModal: { title: 'อัปโหลด path', subtitle: 'เลือกโฟลเดอร์ในเครื่อง ระบบจะนำเข้าไฟล์เป็น batch และเข้าสู่ workflow ทำความสะอาดอัตโนมัติ', localPickerTitle: 'เลือกโฟลเดอร์ในเครื่อง', localPickerHint: 'เลือกโฟลเดอร์ได้หลายครั้ง เบราว์เซอร์ไม่สามารถอ่าน path ที่วางเองได้', pickFolder: 'เลือกโฟลเดอร์ในเครื่อง', pathListLabel: 'รายการ path', pathListPlaceholder: 'path จะเติมหลังเลือกโฟลเดอร์ วางหมายเหตุหลาย path ได้ที่นี่', pendingFiles: 'ไฟล์รออัปโหลด', selectedRoots: 'root ที่เลือก: {paths}', noRoots: 'ไม่มี', pickFolderFirst: 'โปรดเลือกโฟลเดอร์ในเครื่องก่อนยืนยันอัปโหลด', confirmUpload: 'ยืนยันอัปโหลด', }, pathUploadHistoryModal: { title: 'ประวัติ batch อัปโหลด path', subtitle: 'ดูผลลัพธ์ batch ไฟล์ล้มเหลว และตัวเลือกลองใหม่', }, }, }; 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 kbWorkspace i18n into ${locale}/kb.json`); }