Commit 0e45514382a1f09491ad7180e87104ded7b63a67
1 parent
990ccb3c
Exists in
master
and in
5 other branches
Change language in register form #19
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
core/forms.py
1 | 1 | from django import forms |
2 | - | |
2 | +from django.utils.translation import ugettext_lazy as _ | |
3 | 3 | from users.models import User |
4 | 4 | |
5 | 5 | class RegisterUserForm(forms.ModelForm): |
... | ... | @@ -12,7 +12,7 @@ class RegisterUserForm(forms.ModelForm): |
12 | 12 | def clean_email(self): |
13 | 13 | email = self.cleaned_data['email'] |
14 | 14 | if User.objects.filter(email = email).exists(): |
15 | - raise forms.ValidationError('Ja existe um usuario cadastrado com este E-mail') | |
15 | + raise forms.ValidationError(_('There is already a registered User with this e- mail')) | |
16 | 16 | return email |
17 | 17 | |
18 | 18 | def clean_password(self): |
... | ... | @@ -20,13 +20,13 @@ class RegisterUserForm(forms.ModelForm): |
20 | 20 | |
21 | 21 | # At least MIN_LENGTH long |
22 | 22 | if len(password) < self.MIN_LENGTH: |
23 | - raise forms.ValidationError("A senha deve conter no minimo %d caracteres." % self.MIN_LENGTH) | |
23 | + raise forms.ValidationError(_("The password must contain at least % d characters." % self.MIN_LENGTH)) | |
24 | 24 | |
25 | 25 | # At least one letter and one non-letter |
26 | 26 | first_isalpha = password[0].isalpha() |
27 | 27 | if all(c.isalpha() == first_isalpha for c in password): |
28 | - raise forms.ValidationError("A senha deve conter pelo menos uma letra e pelo menos um digito ou "\ | |
29 | - "um caractere de pontuacao.") | |
28 | + raise forms.ValidationError(_('The password must contain at least one letter and at least one digit or '\ | |
29 | + "a punctuation character.")) | |
30 | 30 | |
31 | 31 | return password |
32 | 32 | |
... | ... | @@ -35,7 +35,7 @@ class RegisterUserForm(forms.ModelForm): |
35 | 35 | password2 = self.cleaned_data.get("password2") |
36 | 36 | |
37 | 37 | if password and password2 and password != password2: |
38 | - raise forms.ValidationError('A confirmacao da senha esta incorreta') | |
38 | + raise forms.ValidationError(_('The confirmation password is incorrect.')) | |
39 | 39 | return password2 |
40 | 40 | |
41 | 41 | def save(self, commit=True): | ... | ... |