feat: localize dashboard experiences
This commit is contained in:
1 parent
6727f72121
commit
ea51c16d29
10 files changed
+337
-93
No files matched your search
@@ -1,23 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import http from '../api/http'
|
||||
|
||||
interface CalendarEvent { id: string; title: string; startsOn: string; reminderDays: number }
|
||||
const router = useRouter()
|
||||
const { t } = useI18n()
|
||||
const events = ref<CalendarEvent[]>([])
|
||||
const today = new Date().toISOString().slice(0, 10)
|
||||
function daysUntil(item: CalendarEvent) { return Math.ceil((new Date(`${item.startsOn}T00:00:00`).getTime() - new Date(`${today}T00:00:00`).getTime()) / 86400000) }
|
||||
const reminders = computed(() => events.value.filter(item => { const days = daysUntil(item); return days >= 0 && days <= item.reminderDays }).slice(0, 3))
|
||||
function label(item: CalendarEvent) { const days = daysUntil(item); return days === 0 ? '今天' : `${days} 天后` }
|
||||
function label(item: CalendarEvent) {
|
||||
const days = daysUntil(item)
|
||||
return days === 0 ? t('dashboard.calendar.today') : t('dashboard.calendar.inDays', { days })
|
||||
}
|
||||
onMounted(async () => { try { events.value = (await http.get('/academic-calendar')).data } catch { /* Calendar reminders must not affect the dashboard. */ } })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="reminders.length" class="calendar-reminder">
|
||||
<div><span>日程提醒</span><strong>近期关键日程</strong></div>
|
||||
<div><span>{{ t('dashboard.calendar.label') }}</span><strong>{{ t('dashboard.calendar.title') }}</strong></div>
|
||||
<button v-for="item in reminders" :key="item.id" type="button" @click="router.push('/academic-calendar')"><b>{{ label(item) }}</b><span>{{ item.title }}</span></button>
|
||||
<button class="all" type="button" @click="router.push('/academic-calendar')">查看校历 →</button>
|
||||
<button class="all" type="button" @click="router.push('/academic-calendar')">{{ t('dashboard.calendar.viewAll') }} →</button>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -34,6 +34,24 @@ export default {
|
||||
readyTitle: 'Version {version} is ready', releaseNotes: '{notes} Select this notification to apply it now.', readyMessage: 'The update will be applied when the app moves to the background or starts next time. Select this notification to apply it now.', applyMessage: 'The app will reload to apply the downloaded version. Save any unsaved work first.', applyTitle: 'Apply update', applyNow: 'Apply now',
|
||||
},
|
||||
launch: { skip: 'Tap to skip' },
|
||||
common: { reload: 'Reload', refresh: 'Refresh', listSeparator: ', ' },
|
||||
dashboard: {
|
||||
calendar: { label: 'Schedule reminder', title: 'Upcoming key dates', today: 'Today', inDays: 'In {days} days', viewAll: 'View calendar' },
|
||||
teacher: {
|
||||
loadFailed: 'Teaching dashboard could not load', loadFailedHint: 'Check the service connection and reload.', workspace: 'Teaching workspace',
|
||||
gradeProgress: 'Grade entry progress', gradeManagement: 'Grade management', noPendingGrades: 'No grades are waiting for submission', noPendingGradesHint: 'Grade sheets will appear here in priority order.',
|
||||
termClasses: 'Classes this term', teachingTasks: 'Teaching tasks', classProgress: '{students} students · {completed} completed', noGradeSheet: 'No grade sheet has been created', noClasses: 'No classes assigned this term', noClassesHint: 'Published teaching tasks will be summarized here automatically.',
|
||||
status: { Draft: 'Not entered', Returned: 'Returned', Submitted: 'Under review', Approved: 'Approved', Published: 'Published' },
|
||||
},
|
||||
},
|
||||
academicOverview: {
|
||||
title: 'Academic performance overview', description: 'Summarizes GPA, credit-weighted average, and average score for all officially published courses, with rankings in your class, major, and college.',
|
||||
refreshing: 'New grades have been published. Statistics will update on the administrator-defined schedule; select Refresh when processing is complete.', note: 'This page covers all terms. View Academic Grades for the current term. Rankings include only students with a valid value for the metric, and ties share the same rank.',
|
||||
courseCount: '{count} courses included', publishedOnly: 'Only published grade sheets are included; incomplete or unpublished grades do not affect these statistics.', empty: 'No published grades are available for analysis', rankPending: 'Ranking not available yet ({count} students)', scoreAxis: 'Score',
|
||||
columns: { metric: 'Metric', score: 'My result', classRank: 'Class rank', majorRank: 'Major rank', collegeRank: 'College rank' },
|
||||
metric: { gpaHint: 'Weighted by course credits', weighted: 'Credit-weighted average', weightedHint: 'Final course scores weighted by credits', average: 'Average score', averageHint: 'Arithmetic mean of published final scores' },
|
||||
trendTitle: 'Academic performance by term', trendHint: 'GPA uses the left axis (0–4); scores use the right axis (0–100).', trendEmpty: 'No published grades are available for a trend chart',
|
||||
},
|
||||
api: {
|
||||
'data.constraint_conflict': 'A data constraint conflict occurred.',
|
||||
'server.unhandled_error': 'The server encountered an error while processing the request.',
|
||||
|
||||
@@ -34,6 +34,24 @@ export default {
|
||||
readyTitle: '新版本 {version} 已就绪', releaseNotes: '{notes} 点击此提示可立即启用。', readyMessage: '切换到后台或下次启动应用时将自动启用更新;点击此提示可立即启用。', applyMessage: '将重新加载应用以启用已下载的新版本。未保存的内容请先提交。', applyTitle: '启用更新', applyNow: '立即启用',
|
||||
},
|
||||
launch: { skip: '轻触跳过' },
|
||||
common: { reload: '重新加载', refresh: '刷新', listSeparator: '、' },
|
||||
dashboard: {
|
||||
calendar: { label: '日程提醒', title: '近期关键日程', today: '今天', inDays: '{days} 天后', viewAll: '查看校历' },
|
||||
teacher: {
|
||||
loadFailed: '教学驾驶舱加载失败', loadFailedHint: '请检查服务连接后重新加载。', workspace: '教学工作台',
|
||||
gradeProgress: '成绩登记进度', gradeManagement: '成绩管理', noPendingGrades: '当前没有待提交成绩', noPendingGradesHint: '成绩登记册会在这里按优先级显示。',
|
||||
termClasses: '本学期教学班', teachingTasks: '教学任务', classProgress: '{students} 人 · 已完成 {completed} 人', noGradeSheet: '尚未建立成绩登记册', noClasses: '本学期暂未分配教学班', noClassesHint: '教学任务发布后会自动汇总到这里。',
|
||||
status: { Draft: '待登记', Returned: '已退回', Submitted: '审核中', Approved: '已审核', Published: '已发布' },
|
||||
},
|
||||
},
|
||||
academicOverview: {
|
||||
title: '学业成绩总览', description: '汇总所有已正式发布课程的 GPA、加权平均成绩与平均成绩,并显示当前行政班、专业和学院的排名。',
|
||||
refreshing: '成绩已发布,学业统计将在管理员设置的定时刷新后更新;完成后点击“刷新”即可查看。', note: '本页面按全部学期统计;“本学期成绩”请在学业成绩中查询。排名仅比较至少具备该项有效成绩的学生,并列学生使用相同名次。',
|
||||
courseCount: '已纳入统计 {count} 门课程', publishedOnly: '仅纳入已发布成绩单;未完成或未发布成绩不会影响统计。', empty: '暂无可统计的已发布成绩', rankPending: '暂未形成排名({count} 人)', scoreAxis: '成绩',
|
||||
columns: { metric: '统计指标', score: '我的成绩', classRank: '班级排名', majorRank: '专业排名', collegeRank: '学院排名' },
|
||||
metric: { gpaHint: '绩点按课程学分加权', weighted: '加权平均成绩', weightedHint: '课程总评按课程学分加权', average: '平均成绩', averageHint: '已发布课程总评的算术平均' },
|
||||
trendTitle: '各学期学业成绩变化', trendHint: 'GPA 使用左轴(0–4),两项成绩使用右轴(0–100)。', trendEmpty: '暂无可绘制趋势的已发布成绩',
|
||||
},
|
||||
api: {
|
||||
'data.constraint_conflict': '数据约束冲突。',
|
||||
'server.unhandled_error': '服务器处理请求时发生错误。',
|
||||
|
||||
Loaded 3 of 10 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user