-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from SELab-2/i18n-api
I18n api
- Loading branch information
Showing
15 changed files
with
425 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
# SOME DESCRIPTIVE TITLE. | ||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | ||
# This file is distributed under the same license as the PACKAGE package. | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
# | ||
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-03-13 23:12+0100\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <LL@li.org>\n" | ||
"Language: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#: helpers/check_folder_structure.py:141 | ||
msgid "zip.errors.invalid_structure.blocked_extension_found" | ||
msgstr "The submitted zip file contains a file with a non-allowed extension." | ||
|
||
#: helpers/check_folder_structure.py:145 helpers/check_folder_structure.py:196 | ||
msgid "zip.success" | ||
msgstr "The submitted zip file succeeds in all checks." | ||
|
||
#: helpers/check_folder_structure.py:148 | ||
msgid "zip.errors.invalid_structure.obligated_extension_not_found" | ||
msgstr "" | ||
"The submitted zip file doesn't have any file with a certain file extension " | ||
"that's obligated." | ||
|
||
#: helpers/check_folder_structure.py:175 | ||
msgid "zip.errors.invalid_structure.directory_not_defined" | ||
msgstr "An obligated directory was not found in the submitted zip file." | ||
|
||
#: helpers/check_folder_structure.py:195 | ||
msgid "zip.errors.invalid_structure.directory_not_found_in_template" | ||
msgstr "" | ||
"There was a directory found in the submitted zip file, which was not asked " | ||
"for." | ||
|
||
#: serializers/course_serializer.py:58 serializers/course_serializer.py:77 | ||
msgid "courses.error.context" | ||
msgstr "The course is not supplied in the context." | ||
|
||
#: serializers/course_serializer.py:64 tests/test_locale.py:28 | ||
#: tests/test_locale.py:38 | ||
msgid "courses.error.students.already_present" | ||
msgstr "The student is already present in the course." | ||
|
||
#: serializers/course_serializer.py:68 serializers/course_serializer.py:87 | ||
msgid "courses.error.students.past_course" | ||
msgstr "The course is from a past year, thus cannot be manipulated." | ||
|
||
#: serializers/course_serializer.py:83 | ||
msgid "courses.error.students.not_present" | ||
msgstr "The student is not present in the course." | ||
|
||
#: serializers/group_serializer.py:47 | ||
msgid "group.errors.score_exceeds_max" | ||
msgstr "The score exceeds the group's max score." | ||
|
||
#: serializers/group_serializer.py:57 serializers/group_serializer.py:87 | ||
msgid "group.error.context" | ||
msgstr "The group is not supplied in the context." | ||
|
||
#: serializers/group_serializer.py:65 serializers/group_serializer.py:99 | ||
msgid "group.errors.locked" | ||
msgstr "The group is currently locked." | ||
|
||
#: serializers/group_serializer.py:69 | ||
msgid "group.errors.full" | ||
msgstr "The group is already full." | ||
|
||
#: serializers/group_serializer.py:73 | ||
msgid "group.errors.not_in_course" | ||
msgstr "The student is not present in the related course." | ||
|
||
#: serializers/group_serializer.py:77 | ||
msgid "group.errors.already_in_group" | ||
msgstr "The student is already in the group." | ||
|
||
#: serializers/group_serializer.py:95 | ||
msgid "group.errors.not_present" | ||
msgstr "The student is currently not in the group." | ||
|
||
#: serializers/project_serializer.py:56 | ||
msgid "project.errors.context" | ||
msgstr "The project is not supplied in the context." | ||
|
||
#: serializers/project_serializer.py:60 | ||
msgid "project.errors.start_date_in_past" | ||
msgstr "The start date of the project lies in the past." | ||
|
||
#: serializers/project_serializer.py:64 | ||
msgid "project.errors.deadline_before_start_date" | ||
msgstr "The deadline of the project lies before the start date of the project." | ||
|
||
#: serializers/project_serializer.py:89 | ||
msgid "project.error.submissions.past_project" | ||
msgstr "The deadline of the project has already passed." | ||
|
||
#: serializers/project_serializer.py:92 | ||
msgid "project.error.submissions.non_visible_project" | ||
msgstr "The project is currently in a non-visible state." | ||
|
||
#: serializers/project_serializer.py:95 | ||
msgid "project.error.submissions.archived_project" | ||
msgstr "The project is archived." | ||
|
||
#: views/course_view.py:58 | ||
msgid "courses.success.assistants.add" | ||
msgstr "The assistant was successfully added to the course." | ||
|
||
#: views/course_view.py:77 | ||
msgid "courses.success.assistants.remove" | ||
msgstr "The assistant was successfully removed from the course." | ||
|
||
#: views/course_view.py:111 | ||
msgid "courses.success.students.add" | ||
msgstr "The student was successfully added to the course." | ||
|
||
#: views/course_view.py:131 | ||
msgid "courses.success.students.remove" | ||
msgstr "The student was successfully removed from the course." | ||
|
||
#: views/course_view.py:186 | ||
msgid "course.success.project.add" | ||
msgstr "The project was successfully added to the course." | ||
|
||
#: views/group_view.py:73 | ||
msgid "group.success.students.add" | ||
msgstr "The student was successfully added to the group." | ||
|
||
#: views/group_view.py:92 | ||
msgid "group.success.students.remove" | ||
msgstr "The student was successfully removed from the group." | ||
|
||
#: views/group_view.py:111 | ||
msgid "group.success.submissions.add" | ||
msgstr "The submission was successfully added to the group." | ||
|
||
#: views/project_view.py:80 | ||
msgid "project.success.groups.created" | ||
msgstr "A group was successfully created for the project." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# SOME DESCRIPTIVE TITLE. | ||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | ||
# This file is distributed under the same license as the PACKAGE package. | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
# | ||
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-03-13 23:07+0100\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <LL@li.org>\n" | ||
"Language: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#: helpers/check_folder_structure.py:141 | ||
msgid "zip.errors.invalid_structure.blocked_extension_found" | ||
msgstr "" | ||
"Bestanden met een verboden extensie zijn gevonden in het ingediende zip-" | ||
"bestand." | ||
|
||
#: helpers/check_folder_structure.py:145 helpers/check_folder_structure.py:196 | ||
msgid "zip.success" | ||
msgstr "Het zip-bestand van de indiening bevat alle benodigde bestanden." | ||
|
||
#: helpers/check_folder_structure.py:148 | ||
msgid "zip.errors.invalid_structure.obligated_extension_not_found" | ||
msgstr "" | ||
"Er is geen enkel bestand met een bepaalde extensie die verplicht is in het " | ||
"ingediende zip-bestand." | ||
|
||
#: helpers/check_folder_structure.py:175 | ||
msgid "zip.errors.invalid_structure.directory_not_defined" | ||
msgstr "Een verplichte map is niet aanwezig in het ingediende zip-bestand." | ||
|
||
#: helpers/check_folder_structure.py:195 | ||
msgid "zip.errors.invalid_structure.directory_not_found_in_template" | ||
msgstr "Het ingediende zip-bestand bevat een map die niet gevraagd is." | ||
|
||
#: serializers/course_serializer.py:58 serializers/course_serializer.py:77 | ||
msgid "courses.error.context" | ||
msgstr "De opleiding is niet meegeleverd als context." | ||
|
||
#: serializers/course_serializer.py:64 tests/test_locale.py:28 | ||
#: tests/test_locale.py:38 | ||
msgid "courses.error.students.already_present" | ||
msgstr "De student bevindt zich al in de opleiding." | ||
|
||
#: serializers/course_serializer.py:68 serializers/course_serializer.py:87 | ||
msgid "courses.error.students.past_course" | ||
msgstr "De opleiding die men probeert te manipuleren is van een vorig jaar." | ||
|
||
#: serializers/course_serializer.py:83 | ||
msgid "courses.error.students.not_present" | ||
msgstr "De student bevindt zich niet in de opleiding." | ||
|
||
#: serializers/group_serializer.py:47 | ||
msgid "group.errors.score_exceeds_max" | ||
msgstr "De score van de groep is groter dan de maximum score." | ||
|
||
#: serializers/group_serializer.py:57 serializers/group_serializer.py:87 | ||
msgid "group.error.context" | ||
msgstr "De groep is niet meegegeven als context waar dat nodig is." | ||
|
||
#: serializers/group_serializer.py:65 serializers/group_serializer.py:99 | ||
msgid "group.errors.locked" | ||
msgstr "De groep is momenteel vergrendeld." | ||
|
||
#: serializers/group_serializer.py:69 | ||
msgid "group.errors.full" | ||
msgstr "De groep is al vol." | ||
|
||
#: serializers/group_serializer.py:73 | ||
msgid "group.errors.not_in_course" | ||
msgstr "" | ||
"De student bevindt zich niet in de opleiding waartoe het project hoort." | ||
|
||
#: serializers/group_serializer.py:77 | ||
msgid "group.errors.already_in_group" | ||
msgstr "De student bevindt zich al in de groep." | ||
|
||
#: serializers/group_serializer.py:95 | ||
msgid "group.errors.not_present" | ||
msgstr "De student bevindt zich niet in de groep." | ||
|
||
#: serializers/project_serializer.py:56 | ||
msgid "project.errors.context" | ||
msgstr "Het project is niet meegegeven als context waar dat nodig is." | ||
|
||
#: serializers/project_serializer.py:60 | ||
msgid "project.errors.start_date_in_past" | ||
msgstr "De startdatum van het project ligt in het verleden." | ||
|
||
#: serializers/project_serializer.py:64 | ||
msgid "project.errors.deadline_before_start_date" | ||
msgstr "De uiterste inleverdatum voor het project ligt voor de startdatum." | ||
|
||
#: serializers/project_serializer.py:89 | ||
msgid "project.error.submissions.past_project" | ||
msgstr "De uiterste inleverdatum voor het project is gepasseerd." | ||
|
||
#: serializers/project_serializer.py:92 | ||
msgid "project.error.submissions.non_visible_project" | ||
msgstr "Het project is niet zichtbaar." | ||
|
||
#: serializers/project_serializer.py:95 | ||
msgid "project.error.submissions.archived_project" | ||
msgstr "Het project is gearchiveerd." | ||
|
||
#: views/course_view.py:58 | ||
msgid "courses.success.assistants.add" | ||
msgstr "De assistent is succesvol toegevoegd aan de opleiding." | ||
|
||
#: views/course_view.py:77 | ||
msgid "courses.success.assistants.remove" | ||
msgstr "De assistent is succesvol verwijderd uit de opleiding." | ||
|
||
#: views/course_view.py:111 | ||
msgid "courses.success.students.add" | ||
msgstr "De student is succesvol toegevoegd aan de opleiding." | ||
|
||
#: views/course_view.py:131 | ||
msgid "courses.success.students.remove" | ||
msgstr "De student is succesvol verwijderd uit de opleiding." | ||
|
||
#: views/course_view.py:186 | ||
msgid "course.success.project.add" | ||
msgstr "Het project is succesvol toegevoegd aan de opleiding." | ||
|
||
#: views/group_view.py:73 | ||
msgid "group.success.students.add" | ||
msgstr "De student is succesvol toegevoegd aan de groep." | ||
|
||
#: views/group_view.py:92 | ||
msgid "group.success.students.remove" | ||
msgstr "De student is succesvol verwijderd uit de groep." | ||
|
||
#: views/group_view.py:111 | ||
msgid "group.success.submissions.add" | ||
msgstr "De indiening is succesvol toegevoegd aan de groep." | ||
|
||
#: views/project_view.py:80 | ||
msgid "project.success.groups.created" | ||
msgstr "De groep is succesvol toegevoegd aan het project." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import json | ||
from django.urls import reverse | ||
from django.utils.translation import activate | ||
from django.utils.translation import gettext as _ | ||
from rest_framework.test import APITestCase | ||
|
||
from api.models.course import Course | ||
from api.models.student import Student | ||
from authentication.models import User | ||
|
||
|
||
class TestLocaleAddAlreadyPresentStudentToCourse(APITestCase): | ||
def setUp(self) -> None: | ||
self.client.force_authenticate(User.get_dummy_admin()) | ||
|
||
course = Course.objects.create(id=1, name="Test Course", academic_startyear=2024) | ||
student = Student.objects.create(id=1, first_name="John", last_name="Doe", email="john.doe@example.com") | ||
|
||
student.courses.add(course) | ||
|
||
def test_default_locale(self): | ||
response = self.client.post(reverse("course-students", args=["1"]), | ||
{"student_id": 1}) | ||
|
||
self.assertEqual(response.status_code, 400) | ||
body = json.loads(response.content.decode('utf-8')) | ||
activate("en") | ||
self.assertEqual(body["non_field_errors"][0], _("courses.error.students.already_present")) | ||
|
||
def test_nl_locale(self): | ||
response = self.client.post(reverse("course-students", args=["1"]), | ||
{"student_id": 1}, | ||
headers={"accept-language": "nl"}) | ||
|
||
self.assertEqual(response.status_code, 400) | ||
body = json.loads(response.content.decode('utf-8')) | ||
activate("nl") | ||
self.assertEqual(body["non_field_errors"][0], _("courses.error.students.already_present")) |
Oops, something went wrong.