const fs = require('fs'); const path = require('path'); const en = { "pageTitle_delivery": "Delivery & Dispatch", "pageTitle_jobOrder": "Job Orders", "pageTitle_forecast": "Forecast & Planning", "pageTitle_warehouse": "Inventory & Warehouse", "pageTitle_equipmentBoard": "Equipment Usage Board", "pageTitle_processBoard": "Process Real-time Board", "pageTitle_jobOrderBoard": "Job Order Real-time Board", "pageTitle_purchase": "Purchase", "all": "All", "noData": "No data", "exportExcel": "Export Excel", "show": "Show", "laneX": "Lane X", "today": "Today", "yesterday": "Yesterday", "selectDate": "Select Date", "refresh": "Refresh", "otherBoards": "Other Boards", "autoRefresh": "Auto Refresh", "on": "On", "off": "Off", "intervalSeconds": "Interval (sec)", "minutes": "minutes", "minutesWithVal": "{{val}} min", "minuteAbbr": "min", "delivery_staffPerfDateError": "Staff performance start date cannot be later than end date", "delivery_ordersByDate": "Delivery Orders by Date", "delivery_ordersByDate_export": "Delivery_Orders_By_Date", "delivery_orderCount": "Order Count", "delivery_topItemsByCount": "Top Items by Delivery Count", "delivery_item": "Item", "delivery_itemPlaceholder": "Leave empty for all", "delivery_staffPerformanceTitle": "Staff Delivery Performance (Daily Pick Count & Duration)", "delivery_startDate": "Start Date", "delivery_endDate": "End Date", "delivery_store": "Store", "delivery_staff": "Staff", "delivery_staffPlaceholder": "Leave empty for all", "delivery_staffPerfCaption": "Per-person pick count & total duration for period", "delivery_colStaff": "Staff", "delivery_colPickCount": "Pick Count", "delivery_colTotalMin": "Total Min", "delivery_colAvgMin": "Avg Min/Order", "delivery_dailyByStaff": "Daily by Staff", "delivery_noDataDesc": "No delivery data available for the selected period.", "jo_byStatus": "Job Orders by Status", "jo_byStatus_export": "Job_Orders_By_Status", "jo_datePlanStart": "Date (Plan Start)", "jo_createdVsCompleted": "Job Orders Created vs Completed by Date", "jo_createdVsCompleted_export": "Job_Orders_Created_vs_Completed", "jo_detailSection": "Job Order Material / Process / Equipment", "jo_materialPendingPicked": "Material Pending / Picked (by Plan Date)", "jo_materialPendingPicked_export": "Material_Pending_vs_Picked", "jo_processPendingCompleted": "Process Pending / Completed (by Plan Date)", "jo_processPendingCompleted_export": "Process_Pending_vs_Completed", "jo_equipmentWorkingWorked": "Equipment In Use / Used (by Job Order)", "jo_equipmentWorkingWorked_export": "Equipment_In_Use_vs_Used", "board_jobOrderLive": "Job Order Live Board", "board_equipmentUsage": "Equipment Usage Board", "board_processLive": "Process Live Board", "board_jobOrderChart": "Job Order Chart", "forecast_plannedOutputByDate": "Planned Daily Output by Item (Forecast)", "forecast_plannedOutputByDate_export": "Planned_Daily_Output_By_Item", "forecast_itemCode": "Item Code", "forecast_noScheduleData": "No scheduling data for this date range.", "forecast_productionSchedule": "Production Schedule by Date (Estimated Output)", "forecast_productionSchedule_export": "Production_Schedule_By_Date", "warehouse_stockTxnByDate": "Stock Transactions by Date (In / Out / Total)", "warehouse_stockTxnByDate_export": "Stock_Transactions_By_Date", "warehouse_stockInOutByDate": "Stock In vs Out by Date", "warehouse_stockInOutByDate_export": "Stock_In_vs_Out", "warehouse_balanceTrend": "Stock Balance Trend", "warehouse_balanceTrend_export": "Stock_Balance_Trend", "warehouse_consumptionTrend": "Monthly Consumption Trend (Outbound)", "warehouse_consumptionTrend_export": "Monthly_Consumption_Trend", "warehouse_qty": "Qty", "warehouse_optional": "Optional", "warehouse_sumAll": "Sum all if empty", "warehouse_addItem": "Add item to split", "warehouse_exportFail": "Master export failed", "equipment_status": "Status", "equipment_equipment": "Equipment", "equipment_jobOrder": "Job Order", "equipment_process": "Process", "equipment_planStart": "Plan Start", "equipment_startTime": "Start Time", "equipment_endTime": "End Time", "equipment_operator": "Operator", "equipment_boardTitle": "Equipment Usage Board", "equipment_infoDescription1": "Shows equipment status in real-time: working, idle, or under maintenance.", "equipment_infoDescription2": "Each equipment card displays the current job order and process.", "equipment_infoDescription3": "Equipment with unclosed hours or missing time entries will be flagged.", "equipment_searchAndList": "Search & List", "equipment_notToday": "Not Today", "equipment_unclosedHours": "Equipment hours not closed", "equipment_missingHours": "Missing equipment hours", "equipment_completed": "Completed", "process_notStarted": "Not Started", "process_inProgress": "In Progress", "process_completed": "Completed", "process_nonToday": "Not Today", "dateRange_lastDays": "Last {{d}} days", "series_inbound": "Inbound", "series_outbound": "Outbound", "series_total": "Total", "series_balance": "Balance", "series_consumption": "Consumption", "series_created": "Created", "series_completed": "Completed", "series_month": "Month", "requestFailed": "Request failed" }; const zh = { "pageTitle_delivery": "發貨與配送", "pageTitle_jobOrder": "工單", "pageTitle_forecast": "預測與計劃", "pageTitle_warehouse": "庫存與倉儲", "pageTitle_equipmentBoard": "設備使用看板", "pageTitle_processBoard": "工序即時看板", "pageTitle_jobOrderBoard": "工單即時看板", "pageTitle_purchase": "採購", "all": "全部", "noData": "無數據", "exportExcel": "匯出 Excel", "show": "顯示", "laneX": "車線-X", "today": "今日", "yesterday": "昨日", "selectDate": "選擇日期", "refresh": "重新整理", "otherBoards": "其他看板", "autoRefresh": "自動重新整理", "on": "開啟", "off": "關閉", "intervalSeconds": "間隔(秒)", "minutes": "分鐘", "minutesWithVal": "{{val}} 分鐘", "minuteAbbr": "分", "delivery_staffPerfDateError": "員工發貨績效的起始日期不能晚於結束日期", "delivery_ordersByDate": "按日期發貨單數量", "delivery_ordersByDate_export": "發貨單數量_按日期", "delivery_orderCount": "單數", "delivery_topItemsByCount": "發貨數量排行(按物料)", "delivery_item": "物料", "delivery_itemPlaceholder": "不選則全部", "delivery_staffPerformanceTitle": "員工發貨績效(每日揀貨數量與耗時)", "delivery_startDate": "開始日期", "delivery_endDate": "結束日期", "delivery_store": "倉別", "delivery_staff": "員工", "delivery_staffPlaceholder": "不選則全部", "delivery_staffPerfCaption": "週期內每人揀單數及總耗時(首揀至完成)", "delivery_colStaff": "員工", "delivery_colPickCount": "揀單數", "delivery_colTotalMin": "總分鐘", "delivery_colAvgMin": "平均分鐘/單", "delivery_dailyByStaff": "每日按員工單數", "delivery_noDataDesc": "所選期間內暫無發貨記錄,請調整日期範圍後再試。", "jo_byStatus": "工單按狀態", "jo_byStatus_export": "工單_按狀態", "jo_datePlanStart": "日期(計劃開始)", "jo_createdVsCompleted": "工單創建與完成按日期", "jo_createdVsCompleted_export": "工單_創建與完成_按日期", "jo_detailSection": "工單物料/工序/設備", "jo_materialPendingPicked": "物料待領/已揀(按工單計劃日)", "jo_materialPendingPicked_export": "物料_待領_已揀", "jo_processPendingCompleted": "工序待完成/已完成(按工單計劃日)", "jo_processPendingCompleted_export": "工序_待完成_已完成", "jo_equipmentWorkingWorked": "設備使用中/已使用(按工單)", "jo_equipmentWorkingWorked_export": "設備_使用中_已使用", "board_jobOrderLive": "工單即時看板", "board_equipmentUsage": "設備使用看板", "board_processLive": "工序即時看板", "board_jobOrderChart": "工單圖表", "forecast_plannedOutputByDate": "按物料計劃日產量(預測)", "forecast_plannedOutputByDate_export": "計劃日產量_按物料", "forecast_itemCode": "物料編碼", "forecast_noScheduleData": "此日期範圍內尚無排程資料。", "forecast_productionSchedule": "按日期生產排程(預估產量)", "forecast_productionSchedule_export": "生產排程_按日期", "warehouse_stockTxnByDate": "按日期庫存流水(入/出/合計)", "warehouse_stockTxnByDate_export": "庫存流水_按日期", "warehouse_stockInOutByDate": "按日期入庫與出庫", "warehouse_stockInOutByDate_export": "入庫_出庫_按日期", "warehouse_balanceTrend": "庫存餘額趨勢", "warehouse_balanceTrend_export": "庫存餘額趨勢", "warehouse_consumptionTrend": "按月考勤消耗趨勢(出庫量)", "warehouse_consumptionTrend_export": "月考勤消耗趨勢", "warehouse_qty": "數量", "warehouse_optional": "可選", "warehouse_sumAll": "不選則全部合計", "warehouse_addItem": "新增物料以分項顯示", "warehouse_exportFail": "總表匯出失敗", "equipment_status": "狀態", "equipment_equipment": "設備", "equipment_jobOrder": "工單", "equipment_process": "工序", "equipment_planStart": "工單計劃開始", "equipment_startTime": "開工時間", "equipment_endTime": "完工時間", "equipment_operator": "操作員", "equipment_boardTitle": "設備使用看板", "equipment_infoDescription1": "即時顯示設備狀態:使用中、閒置或維護中。", "equipment_infoDescription2": "每張設備卡片顯示當前工單和工序。", "equipment_infoDescription3": "設備工時未結案或未填寫將被標記。", "equipment_searchAndList": "查詢與列表", "equipment_notToday": "非今日", "equipment_unclosedHours": "設備工時未結案", "equipment_missingHours": "未填設備工時", "equipment_completed": "已完工", "process_notStarted": "未開工", "process_inProgress": "進行中", "process_completed": "已完工", "process_nonToday": "非今日", "dateRange_lastDays": "最近 {{d}} 天", "series_inbound": "入庫", "series_outbound": "出庫", "series_total": "合計", "series_balance": "餘額", "series_consumption": "消耗", "series_created": "新建", "series_completed": "完成", "series_month": "月份", "requestFailed": "請求失敗" }; const i18nDir = path.join(__dirname, '..', 'src', 'i18n'); const enPath = path.join(i18nDir, 'en', 'chart.json'); const zhPath = path.join(i18nDir, 'zh', 'chart.json'); // Sort keys alphabetically const sortKeys = (obj) => { const sorted = {}; Object.keys(obj).sort().forEach(k => { sorted[k] = obj[k]; }); return sorted; }; fs.writeFileSync(enPath, JSON.stringify(sortKeys(en), null, 2) + '\n'); fs.writeFileSync(zhPath, JSON.stringify(sortKeys(zh), null, 2) + '\n'); console.log('Updated chart.json with', Object.keys(en).length, 'keys for each language');