Path: blob/master/src/packages/frontend/course/common/copy-run-all-messages.ts
10799 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import type { IntlShape } from "react-intl";67import type { CopyStep } from "../types";89export function runAllIntro(intl: IntlShape, step: CopyStep): string {10const description =11"Intro line in the run-all popover; this text is immediately followed by a button label like 'All 23 students'";12switch (step) {13case "assignment":14return intl.formatMessage({15id: "course.copy-run-all.assign.intro",16defaultMessage: "Assign this assignment to",17description,18});19case "distribution":20return intl.formatMessage({21id: "course.copy-run-all.distribute.intro",22defaultMessage: "Distribute this handout to",23description,24});25case "collect":26return intl.formatMessage({27id: "course.copy-run-all.collect.intro",28defaultMessage: "Collect this assignment from",29description,30});31case "peer_assignment":32return intl.formatMessage({33id: "course.copy-run-all.peer_assign.intro",34defaultMessage: "Assign for peer grading to",35description,36});37case "peer_collect":38return intl.formatMessage({39id: "course.copy-run-all.peer_collect.intro",40defaultMessage: "Collect peer feedback from",41description,42});43case "return_graded":44return intl.formatMessage({45id: "course.copy-run-all.return.intro",46defaultMessage: "Return this assignment to",47description,48});49}50}5152export function remainingStudents(53intl: IntlShape,54step: CopyStep,55count: number,56): string {57const description =58"Button label in run-all dialog; continues the intro phrase above and includes a student count";59switch (step) {60case "assignment":61return intl.formatMessage(62{63id: "course.copy-run-all.assign.remaining",64defaultMessage:65"The {count, plural, one {# student not already assigned} other {# students not already assigned}}",66description,67},68{ count },69);70case "distribution":71return intl.formatMessage(72{73id: "course.copy-run-all.distribute.remaining",74defaultMessage:75"The {count, plural, one {# student not already distributed} other {# students not already distributed}}",76description,77},78{ count },79);80case "collect":81return intl.formatMessage(82{83id: "course.copy-run-all.collect.remaining",84defaultMessage:85"The {count, plural, one {# student not already collected} other {# students not already collected}}",86description,87},88{ count },89);90case "peer_assignment":91return intl.formatMessage(92{93id: "course.copy-run-all.peer_assign.remaining",94defaultMessage:95"The {count, plural, one {# student not yet assigned for peer grading} other {# students not yet assigned for peer grading}}",96description,97},98{ count },99);100case "peer_collect":101return intl.formatMessage(102{103id: "course.copy-run-all.peer_collect.remaining",104defaultMessage:105"The {count, plural, one {# student not yet peer-collected} other {# students not yet peer-collected}}",106description,107},108{ count },109);110case "return_graded":111return intl.formatMessage(112{113id: "course.copy-run-all.return.remaining",114defaultMessage:115"The {count, plural, one {# student not already returned} other {# students not already returned}}",116description,117},118{ count },119);120}121}122123export function allStudents(124intl: IntlShape,125step: CopyStep,126count: number,127): string {128const description =129"Button label in run-all dialog; continues the intro phrase above and includes a student count";130switch (step) {131case "assignment":132case "distribution":133return intl.formatMessage(134{135id: "course.copy-run-all.all.to",136defaultMessage:137"All {count, plural, one {# student} other {# students}}",138description,139},140{ count },141);142case "collect":143return intl.formatMessage(144{145id: "course.copy-run-all.all.from_collect",146defaultMessage:147"All {count, plural, one {# student who has already received it} other {# students who have already received it}}",148description,149},150{ count },151);152case "peer_assignment":153return intl.formatMessage(154{155id: "course.copy-run-all.all.peer_assignment",156defaultMessage:157"All {count, plural, one {# student for peer grading} other {# students for peer grading}}",158description,159},160{ count },161);162case "peer_collect":163return intl.formatMessage(164{165id: "course.copy-run-all.all.peer_collect",166defaultMessage:167"All {count, plural, one {# student who should have peer graded it} other {# students who should have peer graded it}}",168description,169},170{ count },171);172case "return_graded":173return intl.formatMessage(174{175id: "course.copy-run-all.all.return",176defaultMessage:177"All {count, plural, one {# student whose work you have graded} other {# students whose work you have graded}}",178description,179},180{ count },181);182}183}184185export function commonMsgs(intl: IntlShape, overwriteToken: string) {186return {187typeOverwrite: intl.formatMessage(188{189id: "course.copy-run-all.type_overwrite",190defaultMessage:191'Type "{token}" in the box below if you are sure you want to overwrite any work the students may have done.',192description:193"Prompt in dangerous overwrite flow: user must type literal confirmation token to confirm replacing student files",194},195{196token: overwriteToken,197},198),199confirmWithoutBackup: intl.formatMessage({200id: "course.copy-run-all.confirm_without_backup",201defaultMessage: "Confirm replacing files",202description:203"Final dangerous confirmation button label after typing the required confirmation token",204}),205withBackup: intl.formatMessage({206id: "course.copy-run-all.with_backup",207defaultMessage: "Yes, do it (with backup)",208description:209"Safer confirmation button: run copy for all and keep backups of overwritten files",210}),211withoutBackup: intl.formatMessage({212id: "course.copy-run-all.without_backup",213defaultMessage: "Replace student files!",214description:215"Dangerous button label that opens overwrite confirmation flow without backups",216}),217back: intl.formatMessage({218id: "course.copy-run-all.back",219defaultMessage: "Back",220description: "Back button in run-all confirmation dialogs",221}),222studentSubdirInfo: intl.formatMessage(223{224id: "course.copy-run-all.assignment.student_subdir",225defaultMessage:226"Only the {subdir} subdirectory will be copied to the students.",227description:228"Info message in assignment run-all popover; {subdir} is a literal directory name and should not be translated",229},230{231subdir: "student/",232},233),234nbgraderDocs: intl.formatMessage(235{236id: "course.copy-run-all.docs.nbgrader",237defaultMessage: "{pkg} docs",238description:239"Link label to package documentation; {pkg} is a package name and should not be translated",240},241{242pkg: "nbgrader",243},244),245};246}247248249