diff --git a/web/scripts/check-i18n.mjs b/web/scripts/check-i18n.mjs index ef32ea4..d0d3e74 100644 --- a/web/scripts/check-i18n.mjs +++ b/web/scripts/check-i18n.mjs @@ -36,8 +36,12 @@ for (const name of ['TeachingMonitoringView.vue', 'AcademicPlanningView.vue', 'P } const viewsDirectory = new URL('../src/views/', import.meta.url) const missingBatchReferences = [] +const numericPlaceholderReferences = [] for (const name of readdirSync(viewsDirectory).filter((file) => file.endsWith('.vue'))) { const source = readFileSync(new URL(name, viewsDirectory), 'utf8') + for (const match of source.matchAll(/(?:^|[.\"'])k\d+(?=[.\"']|$)/gm)) { + numericPlaceholderReferences.push(`${name}: ${match[0].trim()}`) + } for (const match of source.matchAll(/t\(['"]((?:batchBusiness|workflowBatch|timetableTemplate|teacherAttendanceTemplate|gradesTemplate|examsTemplate|curriculumTemplate|fitnessTemplate|selectionTemplate|teachingTaskTemplate|assessmentTemplate|dormTemplate|dormTemplateCounts|experimentsTemplate|experimentsDynamic|schedulesTemplate|schedulesDynamic|physicalFitnessScript|teacherAttendanceScript|timetableScript|dormScript|gradeAnalyticsScript|examsScript|experimentGradesScript|curriculumScript|teachingTasksScript|courseSelectionScript|experimentsScript|gradesScript|schedulesScript|assessmentScript)\.[^'"]+)['"]/g)) { if (!reference.has(match[1])) missingBatchReferences.push(`${name}: ${match[1]}`) } @@ -55,13 +59,14 @@ const english = new Map(values(enUS)) const placeholders = (value) => [...new Set([...String(value).matchAll(/\{(\w+)\}/g)].map((match) => match[1]))].sort().join(',') const mismatched = values(zhCN).filter(([key, value]) => candidate.has(key) && placeholders(value) !== placeholders(english.get(key))).map(([key]) => key) -if (missing.length || extra.length || hardcoded.length || mismatched.length || fixedLocaleViews.length || missingBatchReferences.length) { +if (missing.length || extra.length || hardcoded.length || mismatched.length || fixedLocaleViews.length || missingBatchReferences.length || numericPlaceholderReferences.length) { if (missing.length) console.error(`en-US missing keys:\n${missing.join('\n')}`) if (extra.length) console.error(`en-US extra keys:\n${extra.join('\n')}`) if (hardcoded.length) console.error(`Hardcoded Chinese in completed views:\n${hardcoded.join('\n')}`) if (mismatched.length) console.error(`Interpolation parameters differ:\n${mismatched.join('\n')}`) if (fixedLocaleViews.length) console.error(`Fixed Chinese display formats:\n${fixedLocaleViews.join('\n')}`) if (missingBatchReferences.length) console.error(`Missing batch translations:\n${missingBatchReferences.join('\n')}`) + if (numericPlaceholderReferences.length) console.error(`Numeric placeholder i18n references:\n${numericPlaceholderReferences.join('\n')}`) process.exitCode = 1 } else { console.log(`i18n catalogs match (${reference.size} keys).`) diff --git a/web/src/views/ApprovalCenterView.vue b/web/src/views/ApprovalCenterView.vue index 9d02a1a..d18f5af 100644 --- a/web/src/views/ApprovalCenterView.vue +++ b/web/src/views/ApprovalCenterView.vue @@ -621,13 +621,13 @@ function approvalEndpoint(type: string) { function approvalLabel(item: any) { const types: Record = { - CourseExemption: "k69", - DeferredExam: "k70", - GradeModification: "k71", - CourseSubstitution: "k72", - StudentStatusChange: "k73", - GradeSheet: "k74", - AttendanceAppeal: "k75", + CourseExemption: "courseExemption", + DeferredExam: "deferredExam", + GradeModification: "gradeChange", + CourseSubstitution: "courseSubstitution", + StudentStatusChange: "studentStatusChange", + GradeSheet: "gradeReview", + AttendanceAppeal: "attendanceAppeal", }; if (item.type === "TeacherCourseApplication") return t("approvalCenterExtra.teacherCourse"); @@ -648,10 +648,10 @@ function approvalLabel(item: any) { if (extra[item.type]) return t(`approvalCenterExtra.${extra[item.type]}`); if (item.type === "CourseAdjustment") { const adjustments: Record = { - 调课: "k0", - 停课: "k1", - 补课: "k2", - 代课: "k3", + 调课: "reschedule", + 停课: "cancelClass", + 补课: "makeupClass", + 代课: "substituteTeacher", }; return adjustments[item.label] ? t(`adjustmentBatch.${adjustments[item.label]}`) diff --git a/web/src/views/DormitoryHygieneView.vue b/web/src/views/DormitoryHygieneView.vue index c08d8bb..2c4247b 100644 --- a/web/src/views/DormitoryHygieneView.vue +++ b/web/src/views/DormitoryHygieneView.vue @@ -721,7 +721,7 @@ async function automatic() { saving.value = true; assignments.value = []; allocationJobId.value = undefined; - allocationJobStatus.value = "dormScript.k37"; + allocationJobStatus.value = "dormScript.jobQueued"; await safe(async () => { const { data } = await http.post( "/dormitory-services/allocations/preview", @@ -745,13 +745,13 @@ async function automatic() { }); allocationJobStatus.value = status === 1 - ? "dormScript.k37" + ? "dormScript.jobQueued" : status === 2 - ? "dormScript.k38" + ? "dormScript.calculatingInBackground" : status === 3 - ? "dormScript.k39" + ? "dormScript.previewGenerated" : status === 5 - ? "dormScript.k40" + ? "dormScript.calculationFailed" : ""; if (status === 3) { assignments.value = job.assignments ?? []; diff --git a/web/src/views/GradeAnalyticsView.vue b/web/src/views/GradeAnalyticsView.vue index 32cfcd3..b834b2a 100644 --- a/web/src/views/GradeAnalyticsView.vue +++ b/web/src/views/GradeAnalyticsView.vue @@ -1100,8 +1100,8 @@ onBeforeUnmount(() => { {{ t( analysisMode === "courses" - ? "gradeAnalysisTemplate.k6" - : "gradeAnalysisTemplate.k7", + ? "gradeAnalysisTemplate.showFlaggedCoursesOnly" + : "gradeAnalysisTemplate.showFlaggedClassesOnly", ) }} {{