Skip to content

Commit

Permalink
🌐 Translated some missing strings in user module
Browse files Browse the repository at this point in the history
  • Loading branch information
Lugrim committed Oct 7, 2023
1 parent 334c23e commit c04b30f
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 74 deletions.
12 changes: 6 additions & 6 deletions insalan/user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def create_user(
check that all required fields are present and create an user
"""
if not email:
raise ValueError(_("An email is required"))
raise ValueError(_("Un courriel est requis"))
if not username:
raise ValueError(_("An username is required"))
raise ValueError(_("Un nom d'utilisateur·rice est requis"))
if not password:
raise ValueError(_("A password is required"))
raise ValueError(_("Un mot de passe est requis"))
user = self.model(
email=self.normalize_email(email),
username=username,
Expand All @@ -48,7 +48,7 @@ def create_user(

def create_superuser(self, email, username, password, **extra_fields):
if password is None:
raise TypeError("Superusers must have a password.")
raise TypeError(_("Les superutilisateur·rices requiÚrent un mot de passe"))
user = self.create_user(email, username, password, **extra_fields)
user.is_superuser = True
user.is_staff = True
Expand Down Expand Up @@ -122,8 +122,8 @@ def send_email_confirmation(user_object: User):
user = user_object.username
# TODO Give a frontend page instead of direct API link
send_mail(
_("Confirmez votre e-mail"),
_("Confirmez votre adresse e-mail en cliquant sur ")
_("Confirmez votre courriel"),
_("Confirmez votre adresse de courriel en cliquant sur ")
+ "http://api."
+ getenv("WEBSITE_HOST", "localhost")
+ reverse("confirm-email", kwargs={"user": user, "token": token}),
Expand Down
2 changes: 1 addition & 1 deletion insalan/user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def check_validity(self, data):
user = authenticate(username=data["username"], password=data["password"])
if user is not None:
if not user.is_active or not user.email_active:
raise serializers.ValidationError(_("Account not actived"))
raise serializers.ValidationError(_("Compte non activé"))
return user


Expand Down
4 changes: 2 additions & 2 deletions insalan/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def post(self, request):
and "password_confirm" in data
):
return Response(
{[_("user")]: [_("Champ manquant")]},
{"user": [_("Champ manquant")]},
status=status.HTTP_400_BAD_REQUEST,
)
try:
Expand Down Expand Up @@ -161,7 +161,7 @@ def post(self, request):

except User.DoesNotExist:
return Response(
{"user": [_("Utilisateur non trouvé")]},
{"user": [_("Utilisateur⋅ice non trouvĂ©â‹…e")]},
status=status.HTTP_400_BAD_REQUEST,
)

Expand Down
Loading

0 comments on commit c04b30f

Please sign in to comment.