feat: implement debug logging cleanup and i18n coverage proposals

## cleanup-debug-logging
- Create environment-aware logger utility (logger.ts)
- Replace 60+ console.log/error statements across 28 files
- Production: only warn/error logs visible
- Development: all log levels with prefixes

Updated files:
- Contexts: NotificationContext, ProjectSyncContext, AuthContext
- Components: GanttChart, CalendarView, ErrorBoundary, and 11 others
- Pages: Tasks, Projects, Dashboard, and 7 others
- Services: api.ts

## complete-i18n-coverage
- WeeklyReportPreview: all strings translated, dynamic locale
- ReportHistory: all strings translated, dynamic locale
- AuditPage: detail modal and verification modal translated
- WorkloadPage: error message translated

Locale files updated:
- en/common.json, zh-TW/common.json: reports section
- en/audit.json, zh-TW/audit.json: modal sections
- en/workload.json, zh-TW/workload.json: errors section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beabigegg
2026-01-13 21:37:29 +08:00
parent ed8d30e9bd
commit 4b7e523f84
37 changed files with 430 additions and 207 deletions

View File

@@ -52,5 +52,39 @@
"empty": {
"title": "No Audit Records",
"description": "No audit records match the current filters"
},
"modal": {
"details": {
"title": "Audit Log Details",
"eventType": "Event Type:",
"action": "Action:",
"resource": "Resource:",
"user": "User:",
"ipAddress": "IP Address:",
"sensitivity": "Sensitivity:",
"time": "Time:",
"changes": "Changes",
"field": "Field",
"oldValue": "Old Value",
"newValue": "New Value",
"checksum": "Checksum:",
"na": "N/A",
"system": "System"
},
"verification": {
"title": "Integrity Verification",
"verifying": "Verifying audit log integrity...",
"verifyingHint": "This may take a moment depending on the number of records.",
"failed": "Verification Failed",
"statusSuccess": "Integrity Verified",
"statusFailed": "Integrity Issues Detected",
"successDescription": "All audit records have valid checksums and have not been tampered with.",
"failedDescription": "Some audit records have invalid checksums, indicating potential tampering or corruption.",
"totalChecked": "Total Checked",
"valid": "Valid",
"invalid": "Invalid",
"invalidRecords": "Invalid Records",
"invalidRecordsDescription": "The following record IDs failed integrity verification:"
}
}
}

View File

@@ -21,7 +21,8 @@
"remove": "Remove",
"view": "View",
"download": "Download",
"upload": "Upload"
"upload": "Upload",
"retry": "Retry"
},
"labels": {
"loading": "Loading...",
@@ -135,5 +136,62 @@
"maxFileSize": "Maximum file size: {{size}}",
"uploading": "Uploading {{filename}} ({{current}}/{{total}})...",
"uploadFailed": "Upload failed"
},
"reports": {
"weeklyPreview": {
"title": "Weekly Report Preview",
"generateNow": "Generate Now",
"generating": "Generating...",
"loading": "Loading report preview...",
"noData": "No report data available",
"noProjects": "No projects found",
"projects": "Projects",
"retry": "Retry",
"completedShort": "completed",
"done": "done",
"inProgressLower": "in progress",
"overdueLower": "overdue",
"blockedLower": "blocked",
"nextWeekLower": "next week",
"unassigned": "Unassigned",
"due": "Due",
"since": "Since",
"noReasonProvided": "No reason provided",
"daysOverdue": "{{count}} day overdue",
"daysOverdue_other": "{{count}} days overdue",
"status": {
"completed": "Completed",
"inProgress": "In Progress",
"overdue": "Overdue",
"blocked": "Blocked",
"nextWeek": "Next Week",
"total": "Total"
},
"errors": {
"loadFailed": "Failed to load report preview",
"generateFailed": "Failed to generate report"
},
"messages": {
"generateSuccess": "Report generated and notification sent!"
}
},
"history": {
"title": "Report History",
"loading": "Loading history...",
"retry": "Retry",
"empty": "No report history found. Reports are generated every Friday at 16:00.",
"totalReports": "{{count}} report",
"totalReports_other": "{{count}} reports",
"completed": "Completed",
"inProgress": "In Progress",
"overdue": "Overdue",
"status": {
"sent": "sent",
"failed": "failed"
},
"errors": {
"loadFailed": "Failed to load report history"
}
}
}
}

View File

@@ -68,5 +68,8 @@
"normal": "Normal: < 80%",
"warning": "Warning: 80% - 99%",
"overloaded": "Overloaded: ≥ 100%"
},
"errors": {
"loadFailed": "Failed to load workload data. Please try again."
}
}

View File

@@ -52,5 +52,39 @@
"empty": {
"title": "沒有稽核記錄",
"description": "目前沒有符合條件的稽核記錄"
},
"modal": {
"details": {
"title": "稽核日誌詳情",
"eventType": "事件類型:",
"action": "操作:",
"resource": "資源:",
"user": "使用者:",
"ipAddress": "IP 位址:",
"sensitivity": "敏感度:",
"time": "時間:",
"changes": "變更內容",
"field": "欄位",
"oldValue": "舊值",
"newValue": "新值",
"checksum": "校驗碼:",
"na": "無",
"system": "系統"
},
"verification": {
"title": "完整性驗證",
"verifying": "正在驗證稽核日誌完整性...",
"verifyingHint": "根據記錄數量,這可能需要一些時間。",
"failed": "驗證失敗",
"statusSuccess": "完整性已驗證",
"statusFailed": "偵測到完整性問題",
"successDescription": "所有稽核記錄都具有有效的校驗碼,未被竄改。",
"failedDescription": "部分稽核記錄的校驗碼無效,表示可能存在竄改或損壞。",
"totalChecked": "已檢查總數",
"valid": "有效",
"invalid": "無效",
"invalidRecords": "無效記錄",
"invalidRecordsDescription": "以下記錄 ID 未通過完整性驗證:"
}
}
}

View File

@@ -21,7 +21,8 @@
"remove": "移除",
"view": "檢視",
"download": "下載",
"upload": "上傳"
"upload": "上傳",
"retry": "重試"
},
"labels": {
"loading": "載入中...",
@@ -135,5 +136,60 @@
"maxFileSize": "檔案大小上限:{{size}}",
"uploading": "正在上傳 {{filename}} ({{current}}/{{total}})...",
"uploadFailed": "上傳失敗"
},
"reports": {
"weeklyPreview": {
"title": "週報預覽",
"generateNow": "立即產生",
"generating": "產生中...",
"loading": "載入報告預覽中...",
"noData": "無可用的報告資料",
"noProjects": "找不到專案",
"projects": "專案",
"retry": "重試",
"completedShort": "已完成",
"done": "完成",
"inProgressLower": "進行中",
"overdueLower": "逾期",
"blockedLower": "受阻",
"nextWeekLower": "下週",
"unassigned": "未指派",
"due": "截止",
"since": "自",
"noReasonProvided": "未提供原因",
"daysOverdue": "逾期 {{count}} 天",
"status": {
"completed": "已完成",
"inProgress": "進行中",
"overdue": "逾期",
"blocked": "受阻",
"nextWeek": "下週",
"total": "總計"
},
"errors": {
"loadFailed": "載入報告預覽失敗",
"generateFailed": "產生報告失敗"
},
"messages": {
"generateSuccess": "報告已產生並發送通知!"
}
},
"history": {
"title": "報告歷史",
"loading": "載入歷史中...",
"retry": "重試",
"empty": "找不到報告歷史記錄。報告會在每週五 16:00 自動產生。",
"totalReports": "{{count}} 份報告",
"completed": "已完成",
"inProgress": "進行中",
"overdue": "逾期",
"status": {
"sent": "已發送",
"failed": "失敗"
},
"errors": {
"loadFailed": "載入報告歷史失敗"
}
}
}
}

View File

@@ -68,5 +68,8 @@
"normal": "正常:< 80%",
"warning": "警告80% - 99%",
"overloaded": "超載:≥ 100%"
},
"errors": {
"loadFailed": "載入工作負載資料失敗,請再試一次。"
}
}