feat: introduce i18n system and class invitation codes

Add complete i18n infrastructure using next-intl (cookie-driven, without i18n routing) with zh-CN/en dictionary files, locale switcher, and NextIntlClientProvider in root layout. Add class invitation code system with new class_invitation_codes table, data-access layer (generate/validate/consume/revoke), server actions with permission checks, rate limiting, and audit logging. Add class-invitation-manager UI component. Refactor onboarding stepper to use i18n translations and accept new invitation code format (6-char alphanumeric) with backward compatibility for legacy 6-digit codes.
This commit is contained in:
SpecialX
2026-06-22 14:04:55 +08:00
parent a4d096a6fc
commit c90748124d
25 changed files with 2911 additions and 30 deletions

View File

@@ -0,0 +1,55 @@
{
"invitation": {
"title": "班级邀请码",
"generate": "生成邀请码",
"regenerate": "重新生成",
"revoke": "撤销",
"copy": "复制",
"copied": "已复制",
"code": "邀请码",
"status": "状态",
"expiresAt": "过期时间",
"usedCount": "已用次数",
"maxUses": "最大次数",
"createdAt": "创建时间",
"note": "备注",
"neverExpires": "永久有效",
"unlimited": "不限",
"active": "有效",
"disabled": "已禁用",
"expired": "已过期",
"exhausted": "已用尽",
"list": "邀请码列表",
"empty": "暂无邀请码",
"join": "加入班级",
"joinPlaceholder": "请输入 6 位邀请码",
"joinSuccess": "加入班级成功",
"joinFailed": "加入班级失败",
"invalidCode": "邀请码无效或已失效",
"rateLimited": "尝试过于频繁,请稍后再试",
"alreadyInClass": "你已在该班级中",
"subjectConflict": "该班级此科目已有任课教师",
"generateSuccess": "邀请码生成成功",
"generateFailed": "邀请码生成失败",
"revokeSuccess": "邀请码已撤销",
"revokeFailed": "邀请码撤销失败",
"regenerateSuccess": "邀请码已重新生成",
"regenerateConfirm": "重新生成后旧邀请码将立即失效,确定继续吗?",
"revokeConfirm": "撤销后此邀请码将立即失效,确定继续吗?",
"expiresInHours": "有效期(小时)",
"maxUsesLabel": "最大使用次数",
"customNote": "备注(可选)",
"customNotePlaceholder": "如:开学季临时码",
"generateWithCustom": "生成自定义邀请码",
"defaultDuration": "永久有效",
"defaultMaxUses": "不限次数"
},
"class": {
"title": "班级",
"name": "班级名称",
"grade": "年级",
"homeroomTeacher": "班主任",
"studentCount": "学生人数",
"actions": "操作"
}
}