Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18n api #59

Merged
merged 41 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d2e2e2f
chore: translation of extensions allowed/forbidden fields #27
bsilkyn Mar 7, 2024
7c6fa12
Merge branch 'development' into i18n-api
bsilkyn Mar 7, 2024
22b7e32
chore: translate 404 errors to dutch #57
bsilkyn Mar 7, 2024
bfa13d4
chore: rebase
bsilkyn Mar 7, 2024
d66ecc5
chore: (Dutch) folder structure helper + course serializer + group se…
bsilkyn Mar 12, 2024
545a858
chore: (Dutch) folder structure helper + course serializer + group se…
bsilkyn Mar 12, 2024
ead419c
test: make authentication test names more professional
bsilkyn Mar 12, 2024
543903f
chore: add available language translations #100
bsilkyn Mar 12, 2024
4674614
chore: course_view dutch translation + adaption to translation keys #100
bsilkyn Mar 12, 2024
d5b865e
chore: group_view and project_view Dutch translation #100
bsilkyn Mar 12, 2024
90db265
chore: remote merge #100
bsilkyn Mar 12, 2024
9fde752
chore: English translation zip checks + course_serializer + group_ser…
bsilkyn Mar 13, 2024
174ddff
chore: English translation project_serializer #100
bsilkyn Mar 13, 2024
8b65cd7
chore: English translation course_view + group_view + project_view #100
bsilkyn Mar 13, 2024
c773823
chore: slight adjustments #100
bsilkyn Mar 13, 2024
dfda4a4
chore: adjustment to courses.error.students.past_course #100
bsilkyn Mar 13, 2024
7de8329
chore: adjustment to group.errors.full translation #100
bsilkyn Mar 13, 2024
6f434a7
chore: translation remove spelling mistakes #100
bsilkyn Mar 13, 2024
0bcefb8
chore: rebase
bsilkyn Mar 7, 2024
096cfa1
chore: (Dutch) folder structure helper + course serializer + group se…
bsilkyn Mar 12, 2024
42fd593
chore: (Dutch) folder structure helper + course serializer + group se…
bsilkyn Mar 12, 2024
d140174
test: make authentication test names more professional
bsilkyn Mar 12, 2024
33734ad
chore: add available language translations #100
bsilkyn Mar 12, 2024
6ac3a1e
chore: course_view dutch translation + adaption to translation keys #100
bsilkyn Mar 12, 2024
c5e43bd
chore: group_view and project_view Dutch translation #100
bsilkyn Mar 12, 2024
964e9bb
chore: another rebase #57
bsilkyn Mar 7, 2024
6502aa4
chore: English translation zip checks + course_serializer + group_ser…
bsilkyn Mar 13, 2024
b707646
chore: English translation project_serializer #100
bsilkyn Mar 13, 2024
c04a8fd
chore: English translation course_view + group_view + project_view #100
bsilkyn Mar 13, 2024
6095adf
chore: slight adjustments #100
bsilkyn Mar 13, 2024
1bc43c2
chore: adjustment to courses.error.students.past_course #100
bsilkyn Mar 13, 2024
f7a71cb
chore: adjustment to group.errors.full translation #100
bsilkyn Mar 13, 2024
b113fd9
chore: translation remove spelling mistakes #100
bsilkyn Mar 13, 2024
db3e97a
test: add little test #100
bsilkyn Mar 13, 2024
90cb281
Merge branch 'i18n-api' of gitsel2:SELab-2/UGent-7 into i18n-api
bsilkyn Mar 13, 2024
158043a
chore: fix for tests and linter #100
bsilkyn Mar 13, 2024
3bb0483
build: compile .po files
francisvaut Mar 13, 2024
4c27fba
test: fix test to be solely dependent on translation key, not transla…
bsilkyn Mar 13, 2024
a8c6635
Merge branch 'development' into i18n-api
bsilkyn Mar 13, 2024
7555246
chore: translate extra translation keys from project logic #100
bsilkyn Mar 13, 2024
2b0b035
fix: backend-tests.yaml
francisvaut Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/api/models/checks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
from api.models.project import Project
from api.models.extension import FileExtension

Expand Down Expand Up @@ -38,6 +39,7 @@ class StructureCheck(models.Model):
blank=True
)

# ID check should be generated automatically

class ExtraCheck(models.Model):
"""Model that represents an extra check for a project.
Expand Down
14 changes: 14 additions & 0 deletions backend/ypovoli/handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from rest_framework.views import exception_handler
from django.utils.translation import gettext_lazy as _


def translate_exception_handler(exc, context):
response = exception_handler(exc, context)

if response.status_code == 401:
response.data['detail'] = _('Given token not valid for any token type')
bsilkyn marked this conversation as resolved.
Show resolved Hide resolved

if response.status_code == 404:
response.data['detail'] = _('Not found.')

return response
35 changes: 35 additions & 0 deletions backend/ypovoli/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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-07 14:34+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\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"

#: ypovoli/handlers.py:9
msgid "Given token not valid for any token type"
msgstr "Gegeven token is niet geldig voor eender welk token type"

#: ypovoli/handlers.py:12
msgid "Not found."
msgstr "Niet gevonden."

#: ypovoli/settings.py:113
msgid "English"
msgstr "Engels"

#: ypovoli/settings.py:113
msgid "Dutch"
msgstr "Nederlands"
5 changes: 4 additions & 1 deletion backend/ypovoli/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
https://docs.djangoproject.com/en/5.0/ref/settings/
"""

from django.utils.translation import gettext_lazy as _
from datetime import timedelta
from pathlib import Path

Expand Down Expand Up @@ -69,7 +70,8 @@
],
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated'
]
],
'EXCEPTION_HANDLERE': 'ypovoli'
bsilkyn marked this conversation as resolved.
Show resolved Hide resolved
}

SIMPLE_JWT = {
Expand Down Expand Up @@ -108,6 +110,7 @@
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
LANGUAGES = [('en', _('English')), ('nl', _('Dutch'))]
USE_L10N = False
USE_TZ = True

Expand Down
Loading