feat(portal-shell): integrate next-intl + merge messages from teacher-portal (P1-4)

- Add next-intl v4.13.2 with cookie-based locale (no i18n routing)
- Create src/i18n/request.ts reading NEXT_LOCALE cookie
- Merge zh-CN/en messages from teacher-portal + add shell.dev.templates namespace
- Wrap next.config.js with withNextIntl plugin (Turbopack resolveAlias)
- Refactor RootLayout to async + NextIntlClientProvider + getLocale/getMessages
- Replace ThemeI18nProvider with ThemeProvider (theme-only, i18n removed)
- Remove locale/setLocale from PluginStore
- Rework locale-switcher to useLocale/useTranslations + router.refresh
- Update dev/templates page to use getTranslations (Server Component)
- Fix WorkbenchPageShell test (loading prop + center instead of children)

Verified: locale switch via NEXT_LOCALE cookie changes <html lang> and messages
zh-CN: 保存/取消/切换侧栏 | en: Save/Cancel/Toggle sidebar
typecheck 0 errors | lint 0 errors 2 warnings (generated) | vitest 231 passed
This commit is contained in:
SpecialX
2026-07-22 13:40:44 +08:00
parent 994441c2dc
commit da05c9107a
17 changed files with 1040 additions and 158 deletions

View File

@@ -0,0 +1,214 @@
{
"common": {
"brand": "Edu",
"button": {
"save": "Save",
"cancel": "Cancel",
"edit": "Edit",
"export": "Export",
"search": "Search",
"delete": "Delete",
"retry": "Retry",
"back": "Back"
},
"label": {
"search": "Search",
"loading": "Loading...",
"student": "Student",
"studentNo": "Student No.",
"score": "Score",
"feedback": "Feedback",
"class": "Class",
"subject": "Subject",
"name": "Name",
"email": "Email",
"roles": "Roles"
},
"status": {
"loading": "Loading...",
"saved": "Saved"
},
"error": {
"loadFailed": "Failed to load: {message}",
"pageError": "Something went wrong"
},
"nav": {
"empty": "No viewports available",
"loadError": "Navigation failed to load: {message}",
"logout": "Log out",
"noRoles": "No roles"
},
"locale": {
"label": "Language",
"zhCN": "简体中文",
"en": "English"
},
"empty": {
"title": "No data",
"description": "Adjust filters and retry, or create your first record"
},
"navLabel": {
"dashboard": "Dashboard",
"classes": "Classes",
"exams": "Exams",
"homework": "Homework",
"grades": "Grades",
"analytics": "Analytics",
"knowledgeGraph": "Knowledge Graph",
"notifications": "Notifications",
"aiAssist": "AI Assist",
"aiLessonPlan": "AI Lesson Plan",
"aiReport": "AI Report",
"attendance": "Attendance",
"questions": "Questions",
"textbooks": "Textbooks",
"lessonPlans": "Lesson Plans",
"coursePlans": "Course Plans",
"diagnostic": "Diagnostic",
"errorBook": "Error Book",
"practice": "Practice",
"elective": "Elective",
"leave": "Leave Requests",
"scheduleChanges": "Schedule Changes",
"settings": "Settings",
"students": "Students"
}
},
"shell": {
"toggleSidebar": "Toggle sidebar",
"layout": "Layout",
"empty": "No visible plugins",
"dev": {
"templates": {
"title": "Page Templates Quartet",
"description": "P1-3 preview pages (dev only, 404 in production)",
"list": "List Page Template",
"listDescription": "PageHeader + FilterBar + DataTable + Pagination + 3 states",
"detail": "Detail Page Template",
"detailDescription": "PageHeader + info area + Tabs/sections + related list",
"form": "Form Page Template",
"formDescription": "PageHeader + form + submit/cancel + error summary",
"workbench": "Workbench Page Template",
"workbenchDescription": "Three-column (tree/canvas/properties) composite",
"listExample": {
"title": "Exam Management",
"subtitle": "List page template example",
"searchPlaceholder": "Search exam name...",
"newExam": "New Exam"
},
"detailExample": {
"title": "2026 Spring Final Exam",
"subtitle": "Detail page template example"
},
"formExample": {
"title": "New Exam",
"subtitle": "Form page template example"
},
"workbenchExample": {
"title": "Lesson Plan Editor",
"subtitle": "Workbench page template example"
}
}
}
},
"auth": {
"title": "Login"
},
"dashboard": {
"title": "Welcome",
"greeting": "Welcome, {name}",
"subtitle": "{email} · Roles: {roles} · Data scope: {dataScope}",
"subtitleNoRoles": "None",
"error": {
"loadFailed": "Dashboard failed to load: {message}"
},
"empty": {
"title": "No data",
"description": "Dashboard data is not ready yet"
},
"stats": {
"classes": "Total Classes",
"exams": "Total Exams",
"pendingGrading": "Pending Grading"
},
"classes": {
"title": "My Classes",
"count": "{count} total",
"viewAll": "View all",
"emptyTitle": "No classes",
"emptyDescription": "Please contact the administrator to assign classes",
"grade": "Grade: {gradeId}",
"studentCount": "{count} students",
"viewStudents": "View students"
}
},
"classes": {
"title": "Classes"
},
"exams": {
"title": "Exams"
},
"homework": {
"title": "Homework"
},
"grades": {
"title": "Grades"
},
"analytics": {
"title": "Analytics"
},
"knowledgeGraph": {
"title": "Knowledge Graph"
},
"notifications": {
"title": "Notifications"
},
"aiAssist": {
"title": "AI Assist"
},
"aiLessonPlan": {
"title": "AI Lesson Plan"
},
"aiReport": {
"title": "AI Report"
},
"attendance": {
"title": "Attendance"
},
"questions": {
"title": "Questions"
},
"textbooks": {
"title": "Textbooks"
},
"lessonPlans": {
"title": "Lesson Plans"
},
"coursePlans": {
"title": "Course Plans"
},
"diagnostic": {
"title": "Diagnostic"
},
"errorBook": {
"title": "Error Book"
},
"practice": {
"title": "Practice"
},
"elective": {
"title": "Elective"
},
"leave": {
"title": "Leave Requests"
},
"scheduleChanges": {
"title": "Schedule Changes"
},
"settings": {
"title": "Settings"
},
"students": {
"title": "Students"
}
}