feat(announcements,messaging): 公告与消息模块审计重构 — i18n + Error Boundary + a11y

- 新增审计报告 docs/architecture/audit/announcements-messages-audit-report.md
- 新增中英双语 i18n 字典 announcements.json / messages.json(11/13 个命名空间)
- 重构所有 announcements 和 messaging 组件接入 next-intl(useTranslations)
- 所有页面 page.tsx 使用 generateMetadata + getTranslations 替代硬编码 metadata
- 新增 7 个 error.tsx 错误边界(4 公告 + 3 消息),统一 EmptyState + i18n + 重试
- a11y 改进:announcement-card / message-list / notification-dropdown 添加 aria-label
- 同步架构图 004 和 005:i18n.messages 清单 + 已知问题修复记录
This commit is contained in:
SpecialX
2026-06-22 16:02:07 +08:00
parent 21c1e7a286
commit fde711ce46
30 changed files with 1085 additions and 261 deletions

View File

@@ -0,0 +1,90 @@
{
"title": {
"list": "Announcements",
"detail": "Announcement",
"adminList": "Announcement Management",
"edit": "Edit Announcement",
"create": "New Announcement"
},
"description": {
"list": "Stay up to date with the latest school announcements.",
"adminList": "Create and manage school-wide announcements.",
"edit": "Update the announcement details."
},
"filter": {
"all": "All",
"published": "Published",
"draft": "Draft",
"archived": "Archived",
"placeholder": "Filter by status"
},
"status": {
"draft": "Draft",
"published": "Published",
"archived": "Archived"
},
"type": {
"school": "School",
"grade": "Grade",
"class": "Class"
},
"form": {
"title": "Title",
"titlePlaceholder": "Announcement title",
"content": "Content",
"contentPlaceholder": "Write the announcement content...",
"type": "Type",
"typePlaceholder": "Select type",
"status": "Status",
"statusPlaceholder": "Select status",
"targetGrade": "Target Grade",
"targetGradePlaceholder": "Select a grade (optional)",
"targetClass": "Target Class",
"targetClassPlaceholder": "Select a class (optional)",
"submit": "Save",
"create": "Create",
"cancel": "Cancel",
"saving": "Saving..."
},
"actions": {
"new": "New Announcement",
"publish": "Publish",
"archive": "Archive",
"edit": "Edit",
"delete": "Delete",
"back": "Back"
},
"messages": {
"created": "Announcement created",
"updated": "Announcement updated",
"deleted": "Announcement deleted",
"published": "Announcement published",
"archived": "Announcement archived",
"notFound": "Announcement not found",
"createFailed": "Failed to save announcement",
"updateFailed": "Failed to save announcement",
"publishFailed": "Failed to publish",
"archiveFailed": "Failed to archive",
"deleteFailed": "Failed to delete",
"invalidForm": "Invalid form data",
"invalidState": "Invalid form state"
},
"meta": {
"publishedAt": "Published {date}",
"createdAt": "Created {date}",
"updatedAt": "Updated {date}",
"author": "by {name}"
},
"empty": {
"noAnnouncements": "No announcements",
"noAnnouncementsDesc": "There are no announcements yet.",
"noMatch": "No announcements match the current filter.",
"deleteTitle": "Delete announcement",
"deleteDesc": "This will permanently delete \"{title}\"."
},
"error": {
"loadFailed": "Failed to load announcements",
"loadFailedDesc": "Sorry, an unexpected error occurred while loading announcements. Please try again later.",
"retry": "Retry"
}
}

View File

@@ -0,0 +1,94 @@
{
"title": {
"list": "Messages",
"detail": "Message",
"compose": "Compose Message",
"reply": "Reply",
"newMessage": "New Message",
"notifications": "Notifications"
},
"description": {
"list": "Manage your inbox and stay updated with notifications.",
"compose": "Send a message to another user.",
"notifications": "Stay updated on your latest activities."
},
"tabs": {
"inbox": "Inbox",
"sent": "Sent"
},
"actions": {
"compose": "Compose",
"reply": "Reply",
"delete": "Delete",
"markRead": "Mark as read",
"markAllRead": "Mark all as read",
"send": "Send",
"sending": "Sending...",
"cancel": "Cancel",
"back": "Back",
"viewAll": "View all notifications",
"view": "View"
},
"form": {
"to": "To",
"toPlaceholder": "Select a recipient",
"subject": "Subject",
"subjectPlaceholder": "Message subject",
"content": "Content",
"contentPlaceholder": "Write your message...",
"selectRecipient": "Please select a recipient"
},
"status": {
"new": "New",
"read": "Read",
"sent": "Sent",
"unread": "Unread"
},
"meta": {
"from": "From",
"to": "To",
"unknown": "Unknown",
"noSubject": "(no subject)",
"readAt": "Read {date}"
},
"notificationType": {
"message": "Message",
"announcement": "Announcement",
"homework": "Homework",
"grade": "Grade"
},
"search": {
"placeholder": "Search messages by subject or content...",
"noResults": "No matching messages found"
},
"empty": {
"inboxEmpty": "Inbox is empty",
"inboxEmptyDesc": "You have no incoming messages yet.",
"sentEmpty": "No sent messages",
"sentEmptyDesc": "You have not sent any messages yet.",
"noNotifications": "No notifications",
"noNotificationsDesc": "You have no notifications yet.",
"noNotificationsDropdown": "No notifications",
"deleteTitle": "Delete message",
"deleteDesc": "This will permanently delete the message \"{subject}\"."
},
"messages": {
"sent": "Message sent",
"deleted": "Message deleted",
"markedRead": "Marked as read",
"allMarkedRead": "All notifications marked as read",
"notificationMarkedRead": "Notification marked as read",
"sendSelf": "Cannot send a message to yourself",
"sendFailed": "Failed to send message",
"deleteFailed": "Failed to delete",
"markReadFailed": "Failed to mark as read",
"notFound": "Message not found",
"invalidId": "Invalid message id",
"selectRecipient": "Please select a recipient"
},
"error": {
"loadFailed": "Failed to load messages",
"loadFailedDesc": "Sorry, an unexpected error occurred while loading messages. Please try again later.",
"retry": "Retry"
}
}

View File

@@ -0,0 +1,90 @@
{
"title": {
"list": "公告",
"detail": "公告详情",
"adminList": "公告管理",
"edit": "编辑公告",
"create": "新建公告"
},
"description": {
"list": "随时了解学校最新公告动态。",
"adminList": "创建并管理全校公告。",
"edit": "更新公告详情。"
},
"filter": {
"all": "全部",
"published": "已发布",
"draft": "草稿",
"archived": "已归档",
"placeholder": "按状态筛选"
},
"status": {
"draft": "草稿",
"published": "已发布",
"archived": "已归档"
},
"type": {
"school": "全校",
"grade": "年级",
"class": "班级"
},
"form": {
"title": "标题",
"titlePlaceholder": "公告标题",
"content": "内容",
"contentPlaceholder": "请输入公告内容...",
"type": "类型",
"typePlaceholder": "选择类型",
"status": "状态",
"statusPlaceholder": "选择状态",
"targetGrade": "目标年级",
"targetGradePlaceholder": "选择年级(可选)",
"targetClass": "目标班级",
"targetClassPlaceholder": "选择班级(可选)",
"submit": "保存",
"create": "创建",
"cancel": "取消",
"saving": "保存中..."
},
"actions": {
"new": "新建公告",
"publish": "发布",
"archive": "归档",
"edit": "编辑",
"delete": "删除",
"back": "返回"
},
"messages": {
"created": "公告已创建",
"updated": "公告已更新",
"deleted": "公告已删除",
"published": "公告已发布",
"archived": "公告已归档",
"notFound": "公告不存在",
"createFailed": "创建公告失败",
"updateFailed": "保存公告失败",
"publishFailed": "发布失败",
"archiveFailed": "归档失败",
"deleteFailed": "删除失败",
"invalidForm": "表单数据无效",
"invalidState": "表单状态无效"
},
"meta": {
"publishedAt": "发布于 {date}",
"createdAt": "创建于 {date}",
"updatedAt": "更新于 {date}",
"author": "作者:{name}"
},
"empty": {
"noAnnouncements": "暂无公告",
"noAnnouncementsDesc": "目前还没有任何公告。",
"noMatch": "当前筛选条件下暂无公告。",
"deleteTitle": "删除公告",
"deleteDesc": "此操作将永久删除"{title}"。"
},
"error": {
"loadFailed": "公告加载失败",
"loadFailedDesc": "抱歉,加载公告时发生了意外错误。请稍后重试。",
"retry": "重试"
}
}

View File

@@ -0,0 +1,94 @@
{
"title": {
"list": "消息",
"detail": "消息详情",
"compose": "撰写消息",
"reply": "回复",
"newMessage": "新消息",
"notifications": "通知"
},
"description": {
"list": "管理收件箱并随时掌握通知动态。",
"compose": "向其他用户发送消息。",
"notifications": "随时了解最新动态。"
},
"tabs": {
"inbox": "收件箱",
"sent": "已发送"
},
"actions": {
"compose": "撰写",
"reply": "回复",
"delete": "删除",
"markRead": "标记已读",
"markAllRead": "全部标记已读",
"send": "发送",
"sending": "发送中...",
"cancel": "取消",
"back": "返回",
"viewAll": "查看全部通知",
"view": "查看"
},
"form": {
"to": "收件人",
"toPlaceholder": "选择收件人",
"subject": "主题",
"subjectPlaceholder": "消息主题",
"content": "内容",
"contentPlaceholder": "请输入消息内容...",
"selectRecipient": "请选择收件人"
},
"status": {
"new": "新",
"read": "已读",
"sent": "已发送",
"unread": "未读"
},
"meta": {
"from": "发件人",
"to": "收件人",
"unknown": "未知",
"noSubject": "(无主题)",
"readAt": "阅读于 {date}"
},
"notificationType": {
"message": "消息",
"announcement": "公告",
"homework": "作业",
"grade": "成绩"
},
"search": {
"placeholder": "按主题或内容搜索消息...",
"noResults": "未找到匹配的消息"
},
"empty": {
"inboxEmpty": "收件箱为空",
"inboxEmptyDesc": "您还没有收到任何消息。",
"sentEmpty": "无已发送消息",
"sentEmptyDesc": "您还没有发送任何消息。",
"noNotifications": "暂无通知",
"noNotificationsDesc": "您还没有任何通知。",
"noNotificationsDropdown": "暂无通知",
"deleteTitle": "删除消息",
"deleteDesc": "此操作将永久删除消息"{subject}"。"
},
"messages": {
"sent": "消息已发送",
"deleted": "消息已删除",
"markedRead": "已标记为已读",
"allMarkedRead": "全部已标记为已读",
"notificationMarkedRead": "通知已标记为已读",
"sendSelf": "不能给自己发送消息",
"sendFailed": "发送消息失败",
"deleteFailed": "删除失败",
"markReadFailed": "标记已读失败",
"notFound": "消息不存在",
"invalidId": "消息 ID 无效",
"selectRecipient": "请选择收件人"
},
"error": {
"loadFailed": "消息加载失败",
"loadFailedDesc": "抱歉,加载消息时发生了意外错误。请稍后重试。",
"retry": "重试"
}
}