diff --git a/src/i18n/english.ts b/src/i18n/english.ts index 76f706b..9ce4b65 100644 --- a/src/i18n/english.ts +++ b/src/i18n/english.ts @@ -29,6 +29,24 @@ export default { err: "Oops! Something went wrong when loading homeworks." }, }, + problem: { + submit: { + err: { + code: "Please paste your source code to submit.", + lang: "Please select the programming language.", + msg: "Oops! Something went wrong when submitting the code. Try again later.", + }, + card: { + title: "Submit to problem #", + placeholder: "Paste your code here", + }, + lang: { + text: "Language", + select: "Select language", + }, + text: "Submit", + }, + }, }, index: { ann: "Announcements", diff --git a/src/pages/course/[name]/problem/[id]/submit.vue b/src/pages/course/[name]/problem/[id]/submit.vue index 25b7bb2..e37b087 100644 --- a/src/pages/course/[name]/problem/[id]/submit.vue +++ b/src/pages/course/[name]/problem/[id]/submit.vue @@ -9,8 +9,11 @@ import { required, between, helpers } from "@vuelidate/validators"; import api, { fetcher } from "@/models/api"; import { useTitle } from "@vueuse/core"; import { LANGUAGE_OPTIONS } from "@/constants"; +import { useI18n } from "vue-i18n"; const route = useRoute(); +const { t, locale } = useI18n(); + useTitle(`Submit - ${route.params.id} - ${route.params.name} | Normal OJ`); const router = useRouter(); const { data: problem, error, isLoading } = useAxios(`/problem/view/${route.params.id}`, fetcher); @@ -22,8 +25,8 @@ const form = reactive({ isSubmitError: false, }); const rules = { - code: { required: helpers.withMessage("Please paste your source code to submit.", required) }, - lang: { betweenValue: helpers.withMessage("Please select the programming language.", between(0, 3)) }, + code: { required: helpers.withMessage(t("course.problem.submit.err.code"), required) }, + lang: { betweenValue: helpers.withMessage(t("course.problem.submit.err.lang"), between(0, 3)) }, }; const v$ = useVuelidate(rules, form); @@ -85,30 +88,34 @@ async function submit() {
-
Submit to problem #{{ $route.params.id }}
+
+ {{ t("course.problem.submit.card.title") }}{{ $route.params.id }} +
-
Paste your code here
+
+ {{ t("course.problem.submit.card.placeholder") }} +
- Oops! Something went wrong when submitting the code. Try again later. + {{ t("course.problem.submit.err.msg") }}