浏览代码

Translate counter creation view

Camille Masset 9 年之前
父节点
当前提交
38cdec1a0c

+ 21 - 15
counter/templates/createUser.html

@@ -1,4 +1,10 @@
1
-{% extends 'baseTemplate.html' %} {% block title %}Changement du mot de passe{% endblock %}{% block content %}
1
+{% extends 'baseTemplate.html' %}
2
+
3
+{% block title %}Changement du mot de passe{% endblock %}
4
+
5
+{% block content %}
6
+{% load i18n %}
7
+
2 8
 <div class="container">
3 9
     <div class="row">
4 10
         <div class="text-center">
@@ -8,44 +14,44 @@
8 14
     <div class="row">
9 15
         <div class="panel panel-primary">
10 16
             <div class="panel-heading">
11
-                <h2 class="panel-title">Créé ton compteur de seum !</h2>
17
+                <h2 class="panel-title">{% trans "Create your seum counter!" %}</h2>
12 18
             </div>
13 19
             <div class=" panel-body">
14 20
                 <form method="POST">
15 21
                     {% csrf_token %}
16
-                    <p>L'adresse e-mail sera utilisée pour la réinitialisation de ton mot de passe. Ton login sur le site sera la première partie de cette adresse (avant le @).</p>
22
+                    <p>{% trans "The email address will be used for password reinitialisation. Your login on this website will be the first part of this address (before the @)." %}</p>
17 23
                     <div class="form-group">
18
-                        <label for="id_email">Adresse email</label>
24
+                        <label for="id_email">{% trans "Email address" %}</label>
19 25
                         <input id="id_email" type="email" class="form-control" name="email" required />
20 26
                     </div>
21
-                    <p>Si tu coches la case en dessous, tu recevras un mail de <tt>seum@merigoux.ovh</tt> à chaque fois que quelqu'un aura le seum sur le site. Spammatoire mais jouissif, peut-être désactivé ou réactivé par la suite.</p>
27
+                    <p>{% trans "If you check the box below, you will receive an email from <tt>seum@merigoux.ovh</tt> each time someone get the seum on the site. Spamming but so enjoyable, can be deactivated and reactivated later." %}
22 28
                     <div class="form-check">
23 29
                         <input type="checkbox" class="form-check-input" name="email_notifications">
24 30
                         <label class="form-check-label">
25
-                            Notifications par email
31
+                            {% trans "Email notifications" %}
26 32
                         </label>
27 33
                     </div>
28
-                    <p>Les autres utilisateurs ne pourront voir que ton pseudo et ton trigramme, ce sera ton identité seumesque !</p>
34
+                    <p>{% trans "Other users will see your nickname and your trigram only, it will be your seum identity!" %}</p>
29 35
                     <div class="form-group">
30
-                        <label for="id_trigramme">Trigramme</label>
36
+                        <label for="id_trigramme">{% trans "Trigram" %}</label>
31 37
                         <input id="id_trigramme" maxlength="3" type="text" class="form-control text-uppercase" name="trigramme" onkeyup="this.value=this.value.toUpperCase();" required />
32 38
                     </div>
33 39
                     <div class="form-group">
34
-                        <label for="id_nick">Pseudo</label>
40
+                        <label for="id_nick">{% trans "Nick" %}</label>
35 41
                         <input id="id_nick" type="text" class="form-control" name="nick" required />
36 42
                     </div>
37
-                    <p>J'aurais pu exiger 10 caractères dont un chiffre, une lettre et un tilde avec 3 majuscules et 2 minuscules pour te foutre le seum mais en fait tu peux mettre ce que tu veux.</p>
43
+                    <p>{% trans "I could have required 10 characters with one digit, an emoji, three uppercase letters and two lowercase ones to throw you the seum, but actually you can choose whatever you want." %}</p>
38 44
                     <div class="form-group">
39
-                        <label for="id_password1">Mot de passe</label>
45
+                        <label for="id_password1">{% trans "Password" %}</label>
40 46
                         <input id="id_password1" type="password" class="form-control" name="password1" required />
41 47
                     </div>
42 48
                     <div class="form-group">
43
-                        <label for="id_password2">Confirmer le mot de passe</label>
49
+                        <label for="id_password2">{% trans "Confirm password" %}</label>
44 50
                         <input id="id_password2" type="password" class="form-control" name="password2" required />
45 51
                     </div>
46
-                    <p>Si ce formulaire t'as foutu le seum, n'oublie pas de remettre ton compteur à zéro en arrivant sur le site.</p>
52
+                    <p>{% trans "If this form has given you the seum, do not forget to reset your counter once you are logged in!" %}</p>
47 53
                     <div class="text-center">
48
-                        <button type="submit" class="btn btn-default btn-success">Créer le compteur</button>
54
+                        <button type="submit" class="btn btn-default btn-success">{% trans "Create the counter" %}</button>
49 55
                     </div>
50 56
                 </form>
51 57
             </div>
@@ -55,7 +61,7 @@
55 61
     <div class="row">
56 62
         <div class="panel panel-danger">
57 63
             <div class="panel-heading">
58
-                <h2 class="panel-title">Erreur</h2>
64
+                <h2 class="panel-title">{% trans "Error" %}</h2>
59 65
             </div>
60 66
             <div class=" panel-body">
61 67
                 <p>{{error}}</p>

+ 10 - 4
counter/templates/createUserDone.html

@@ -1,4 +1,10 @@
1
-{% extends 'baseTemplate.html' %} {% block title %}Mot de passe changé !{% endblock %}{% block content %}
1
+{% extends 'baseTemplate.html' %}
2
+
3
+{% load i81n %}
4
+
5
+{% block title %}{% trans "Password successfully changed!" %}{% endblock %}
6
+
7
+{% block content %}
2 8
 <div class="container">
3 9
     <div class="row">
4 10
         <div class="text-center">
@@ -8,12 +14,12 @@
8 14
     <div class="row">
9 15
         <div class="panel panel-primary">
10 16
             <div class="panel-heading">
11
-                <h2 class="panel-title">Victoire !</h2>
17
+                <h2 class="panel-title">{% trans "Victory!" %}</h2>
12 18
             </div>
13 19
             <div class=" panel-body">
14
-                <p>Tu as créé ton compteur ! Ton login est <b>{{login}}</b>.</p>
20
+                <p>{% trans "You have created your counter! Your login is " %} <b>{{ login }}</p>.</p>
15 21
                 <div class="text-center">
16
-                    <a href="{% url 'login' %}" type="submit" class="btn btn-default btn-success">Connecte-toi pour accéder au site !</a>
22
+                    <a href="{% url 'login' %}" type="submit" class="btn btn-default btn-success">{% trans "Login to access the website!" %}</a>
17 23
                 </div>
18 24
             </div>
19 25
         </div>

+ 7 - 3
counter/urls.py

@@ -3,20 +3,24 @@ from counter.rss import SeumFeed
3 3
 from django.contrib.auth import views as auth_views
4 4
 from django.views.generic.base import RedirectView
5 5
 
6
-from .views import views, hashtag, counter
6
+from .views import views, hashtag, counter, user
7 7
 
8 8
 urlpatterns = [
9 9
     url(r'^$', views.home, name='home'),
10 10
     url(r'^reset-counter/$', counter.reset_counter, name='reset-counter'),
11 11
     url(r'^counter/(?P<id_counter>\d+)/$', counter.get, name='counter'),
12 12
     url(r'^hashtag/(?P<keyword>.+)/$', hashtag.get, name='hashtag'),
13
-    url(r'^rss/$', SeumFeed()),
14
-    url(r'^create_user/$', views.createUser, name='create_user'),
13
+
15 14
     url(r'^like/$', views.like, name='like'),
16 15
     url(r'^toggle-notif/$', views.toggleEmailNotifications,
17 16
         name='toggle_email_notifications'),
18 17
     url(r'^toggle-sort-score/$', views.toggleScoreSorting,
19 18
         name='toggle_sort_score'),
19
+
20
+    url(r'^create_user/$', user.create, name='create_user'),
21
+
22
+    url(r'^rss/$', SeumFeed()),
23
+
20 24
     url(r'^login/$', auth_views.login,
21 25
         {'template_name': 'login.html'},
22 26
         name='login'),

+ 39 - 0
counter/views/user.py

@@ -0,0 +1,39 @@
1
+from django.contrib.auth.models import User
2
+from django.core.urlresolvers import reverse
3
+from django.shortcuts import render
4
+from django.utils.translation import ugettext as _
5
+
6
+from counter.models import Counter
7
+
8
+
9
+def create(request):
10
+    if (request.method == 'POST'):
11
+        # create a form instance and populate it with data from the request:
12
+        data = dict(request.POST)
13
+        email = data['email'][0]
14
+        username = email.split('@')[0]
15
+        trigramme = data['trigramme'][0]
16
+        nick = data['nick'][0]
17
+        password1 = data['password1'][0]
18
+        password2 = data['password2'][0]
19
+        email_notifications = 'email_notifications' in data.keys()
20
+
21
+        if password1 != password2:
22
+            error = _("Passwords do not match.")
23
+            return render(request, 'createUser.html', {'error': error})
24
+
25
+        try:
26
+            test_user = User.objects.get(email=email)
27
+            error = _("A user with this email address already exists.")
28
+            return render(request, 'createUser.html', {'error': error})
29
+        except User.DoesNotExist:
30
+            try:
31
+                user = User.objects.create_user(username, email, password1)
32
+            except IntegrityError:
33
+                error = _("Use another email address, another user has already this login.")
34
+                return render(request, 'createUser.html', {'error': error})
35
+
36
+            counter = Counter.objects.create(name=nick, email=email, trigramme=trigramme, user=user, email_notifications=email_notifications)
37
+            return render(request, 'createUserDone.html', {'login': username})
38
+    else:
39
+        return render(request, 'createUser.html', {'error': None})

+ 0 - 35
counter/views/views.py

@@ -296,42 +296,7 @@ def home(request):
296 296
 
297 297
 
298 298
 
299
-def createUser(request):
300
-    if (request.method == 'POST'):
301
-        # create a form instance and populate it with data from the request:
302
-        data = dict(request.POST)
303
-        email = data['email'][0]
304
-        username = email.split('@')[0]
305
-        trigramme = data['trigramme'][0]
306
-        nick = data['nick'][0]
307
-        password1 = data['password1'][0]
308
-        password2 = data['password2'][0]
309
-        email_notifications = ('email_notifications' in data.keys())
310 299
 
311
-        if password1 != password2:
312
-            error = "Les deux mots de passe sont différents."
313
-            return render(request, 'createUser.html', {'error': error})
314
-        try:
315
-            test_user = User.objects.get(email=email)
316
-            error = "Un utilisateur avec cette adresse email existe déjà !"
317
-            return render(request, 'createUser.html', {'error': error})
318
-        except User.DoesNotExist:
319
-            try:
320
-                user = User.objects.create_user(username, email, password1)
321
-            except IntegrityError:
322
-                error = "Utilise une autre adresse email, un autre utilisateur \
323
-                 a le même login que toi."
324
-                return render(request, 'createUser.html', {'error': error})
325
-            counter = Counter()
326
-            counter.name = nick
327
-            counter.email = email
328
-            counter.trigramme = trigramme
329
-            counter.user = user
330
-            counter.email_notifications = False
331
-            counter.save()
332
-            return render(request, 'createUserDone.html', {'login': username})
333
-    else:
334
-        return render(request, 'createUser.html', {'error': None})
335 300
 
336 301
 
337 302
 @login_required

+ 99 - 3
locale/en/LC_MESSAGES/django.po

@@ -8,7 +8,7 @@ msgid ""
8 8
 msgstr ""
9 9
 "Project-Id-Version: PACKAGE VERSION\n"
10 10
 "Report-Msgid-Bugs-To: \n"
11
-"POT-Creation-Date: 2017-01-21 15:44+0100\n"
11
+"POT-Creation-Date: 2017-01-21 17:37+0100\n"
12 12
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -182,6 +182,90 @@ msgstr ""
182 182
 msgid "Back to counters list"
183 183
 msgstr ""
184 184
 
185
+#: counter/templates/createUser.html:17
186
+msgid "Create your seum counter!"
187
+msgstr ""
188
+
189
+#: counter/templates/createUser.html:22
190
+msgid ""
191
+"The email address will be used for password reinitialisation. Your login on "
192
+"this website will be the first part of this address (before the @)."
193
+msgstr ""
194
+
195
+#: counter/templates/createUser.html:24
196
+msgid "Email address"
197
+msgstr ""
198
+
199
+#: counter/templates/createUser.html:27
200
+msgid ""
201
+"If you check the box below, you will receive an email from <tt>seum@merigoux."
202
+"ovh</tt> each time someone get the seum on the site. Spamming but so "
203
+"enjoyable, can be deactivated and reactivated later."
204
+msgstr ""
205
+
206
+#: counter/templates/createUser.html:31
207
+msgid "Email notifications"
208
+msgstr ""
209
+
210
+#: counter/templates/createUser.html:34
211
+msgid ""
212
+"Other users will see your nickname and your trigram only, it will be your "
213
+"seum identity!"
214
+msgstr ""
215
+
216
+#: counter/templates/createUser.html:36
217
+msgid "Trigram"
218
+msgstr ""
219
+
220
+#: counter/templates/createUser.html:40
221
+msgid "Nick"
222
+msgstr ""
223
+
224
+#: counter/templates/createUser.html:43
225
+msgid ""
226
+"I could have required 10 characters with one digit, an emoji, three "
227
+"uppercase letters and two lowercase ones to throw you the seum, but actually "
228
+"you can choose whatever you want."
229
+msgstr ""
230
+
231
+#: counter/templates/createUser.html:45
232
+msgid "Password"
233
+msgstr ""
234
+
235
+#: counter/templates/createUser.html:49
236
+msgid "Confirm password"
237
+msgstr ""
238
+
239
+#: counter/templates/createUser.html:52
240
+msgid ""
241
+"If this form has given you the seum, do not forget to reset your counter "
242
+"once you are logged in!"
243
+msgstr ""
244
+
245
+#: counter/templates/createUser.html:54
246
+msgid "Create the counter"
247
+msgstr ""
248
+
249
+#: counter/templates/createUser.html:64
250
+msgid "Error"
251
+msgstr ""
252
+
253
+#: counter/templates/createUserDone.html:5
254
+msgid "Password successfully changed!"
255
+msgstr ""
256
+
257
+#: counter/templates/createUserDone.html:17
258
+msgid "Victory!"
259
+msgstr ""
260
+
261
+#: counter/templates/createUserDone.html:20
262
+msgid "You have created your counter! Your login is "
263
+msgstr ""
264
+
265
+#: counter/templates/createUserDone.html:22
266
+msgid "Login to access the website!"
267
+msgstr ""
268
+
185 269
 #: counter/templates/hashtagTemplate.html:20
186 270
 msgid "Seums containing"
187 271
 msgstr ""
@@ -190,15 +274,27 @@ msgstr ""
190 274
 msgid "Victim"
191 275
 msgstr ""
192 276
 
193
-#: counter/views/counter.py:34
277
+#: counter/views/counter.py:41
194 278
 msgid "unknown"
195 279
 msgstr ""
196 280
 
197
-#: counter/views/counter.py:75
281
+#: counter/views/counter.py:81
198 282
 #, python-format
199 283
 msgid "From %(who)s: %(reason)s"
200 284
 msgstr ""
201 285
 
286
+#: counter/views/user.py:22
287
+msgid "Passwords do not match."
288
+msgstr ""
289
+
290
+#: counter/views/user.py:27
291
+msgid "A user with this email address already exists."
292
+msgstr ""
293
+
294
+#: counter/views/user.py:33
295
+msgid "Use another email address, another user has already this login."
296
+msgstr ""
297
+
202 298
 #: seum/settings.py:111
203 299
 msgid "English"
204 300
 msgstr ""

+ 115 - 3
locale/fr/LC_MESSAGES/django.po

@@ -8,7 +8,7 @@ msgid ""
8 8
 msgstr ""
9 9
 "Project-Id-Version: PACKAGE VERSION\n"
10 10
 "Report-Msgid-Bugs-To: \n"
11
-"POT-Creation-Date: 2017-01-21 15:44+0100\n"
11
+"POT-Creation-Date: 2017-01-21 17:37+0100\n"
12 12
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -189,6 +189,106 @@ msgstr "Nombre de likes"
189 189
 msgid "Back to counters list"
190 190
 msgstr "Retour à la liste des compteurs"
191 191
 
192
+#: counter/templates/createUser.html:17
193
+msgid "Create your seum counter!"
194
+msgstr "Crée ton compteur de seum !"
195
+
196
+#: counter/templates/createUser.html:22
197
+msgid ""
198
+"The email address will be used for password reinitialisation. Your login on "
199
+"this website will be the first part of this address (before the @)."
200
+msgstr ""
201
+"L'adresse e-mail sera utilisée pour la réinitialisation de ton mot de passe. "
202
+"Ton login sur le site sera la première partie de cette adresse (avant le @)."
203
+
204
+#: counter/templates/createUser.html:24
205
+msgid "Email address"
206
+msgstr "Adresse email"
207
+
208
+#: counter/templates/createUser.html:27
209
+msgid ""
210
+"If you check the box below, you will receive an email from <tt>seum@merigoux."
211
+"ovh</tt> each time someone get the seum on the site. Spamming but so "
212
+"enjoyable, can be deactivated and reactivated later."
213
+msgstr ""
214
+"Si tu coches la case en dessous, tu recevras un mail de <tt>seum@merigoux."
215
+"ovh</tt> à chaque fois que quelqu'un aura le seum sur le site. Spammatoire "
216
+"mais jouissif, peut-être désactivé ou réactivé par la suite."
217
+
218
+#: counter/templates/createUser.html:31
219
+#, fuzzy
220
+#| msgid "email notifications"
221
+msgid "Email notifications"
222
+msgstr "Notifications par email"
223
+
224
+#: counter/templates/createUser.html:34
225
+msgid ""
226
+"Other users will see your nickname and your trigram only, it will be your "
227
+"seum identity!"
228
+msgstr ""
229
+"Les autres utilisateurs ne pourront voir que ton pseudo et ton trigramme, ce "
230
+"sera ton identité seumesque !"
231
+
232
+#: counter/templates/createUser.html:36
233
+#, fuzzy
234
+#| msgid "trigram"
235
+msgid "Trigram"
236
+msgstr "Trigramme"
237
+
238
+#: counter/templates/createUser.html:40
239
+msgid "Nick"
240
+msgstr "Pseudo"
241
+
242
+#: counter/templates/createUser.html:43
243
+msgid ""
244
+"I could have required 10 characters with one digit, an emoji, three "
245
+"uppercase letters and two lowercase ones to throw you the seum, but actually "
246
+"you can choose whatever you want."
247
+msgstr ""
248
+"J'aurais pu exiger 10 caractères dont un chiffre, un emoji, 3 majuscules et "
249
+"2 minuscules pour te foutre le seum mais en fait tu peux mettre ce que tu "
250
+"veux."
251
+
252
+#: counter/templates/createUser.html:45
253
+msgid "Password"
254
+msgstr "Mot de passe"
255
+
256
+#: counter/templates/createUser.html:49
257
+msgid "Confirm password"
258
+msgstr "Confirmer le mot de passe"
259
+
260
+#: counter/templates/createUser.html:52
261
+msgid ""
262
+"If this form has given you the seum, do not forget to reset your counter "
263
+"once you are logged in!"
264
+msgstr ""
265
+"Si ce formulaire t'as foutu le seum, n'oublie pas de remettre ton compteur à "
266
+"zéro en arrivant sur le site."
267
+
268
+#: counter/templates/createUser.html:54
269
+msgid "Create the counter"
270
+msgstr "Créer le compteur"
271
+
272
+#: counter/templates/createUser.html:64
273
+msgid "Error"
274
+msgstr "Erreur"
275
+
276
+#: counter/templates/createUserDone.html:5
277
+msgid "Password successfully changed!"
278
+msgstr "Mot de passe changé !"
279
+
280
+#: counter/templates/createUserDone.html:17
281
+msgid "Victory!"
282
+msgstr "Victoire !"
283
+
284
+#: counter/templates/createUserDone.html:20
285
+msgid "You have created your counter! Your login is "
286
+msgstr "Tu as créé ton compteur ! Ton login est "
287
+
288
+#: counter/templates/createUserDone.html:22
289
+msgid "Login to access the website!"
290
+msgstr "Connecte-toi pour accéder au site !"
291
+
192 292
 #: counter/templates/hashtagTemplate.html:20
193 293
 msgid "Seums containing"
194 294
 msgstr "Liste des seums contenant"
@@ -197,15 +297,27 @@ msgstr "Liste des seums contenant"
197 297
 msgid "Victim"
198 298
 msgstr "Victime"
199 299
 
200
-#: counter/views/counter.py:34
300
+#: counter/views/counter.py:41
201 301
 msgid "unknown"
202 302
 msgstr "inconnu"
203 303
 
204
-#: counter/views/counter.py:75
304
+#: counter/views/counter.py:81
205 305
 #, python-format
206 306
 msgid "From %(who)s: %(reason)s"
207 307
 msgstr "De %(who)s : %(reason)s"
208 308
 
309
+#: counter/views/user.py:22
310
+msgid "Passwords do not match."
311
+msgstr "Les mots de passe sont différents."
312
+
313
+#: counter/views/user.py:27
314
+msgid "A user with this email address already exists."
315
+msgstr "Un utilisateur avec cette adresse email existe déjà."
316
+
317
+#: counter/views/user.py:33
318
+msgid "Use another email address, another user has already this login."
319
+msgstr "Utilise une autre adresse email, un autre utilisateur a déjà ce login."
320
+
209 321
 #: seum/settings.py:111
210 322
 msgid "English"
211 323
 msgstr "Anglais"