From 71482ea95ddeb20aab4ad186b22ecf11ef2616a3 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 22 Dec 2012 15:52:26 +0100 Subject: [PATCH 01/16] add support for translation via babel --- babel.cfg | 3 +++ main.py | 49 +++++++++++++++++++++++-------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 babel.cfg diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..f0234b3 --- /dev/null +++ b/babel.cfg @@ -0,0 +1,3 @@ +[python: **.py] +[jinja2: **/templates/**.html] +extensions=jinja2.ext.autoescape,jinja2.ext.with_ diff --git a/main.py b/main.py index 4832fd3..d772464 100755 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash from flask_openid import OpenID +from flaskext.babel import Babel, gettext, ngettext import sqlite3 from datetime import date, time, timedelta, datetime import time @@ -21,6 +22,7 @@ app = Flask(__name__) app.config.from_object(__name__) oid = OpenID(app) +babel = Babel(app) def connect_db(): return sqlite3.connect(app.config['DATABASE']) @@ -115,7 +117,7 @@ def create_or_login(resp): openid_url = resp.identity_url user = query_db('select * from users where openid = ?', [openid_url], one=True) if user is not None: - flash(u'Successfully signed in') + flash(gettext(u'Successfully signed in')) connect_user(user) return redirect(oid.get_next_url()) return redirect(url_for('home')) @@ -146,18 +148,18 @@ def password_lost(): BODY = string.join(( "From: %s" % EMAIL, "To: %s" % user['email'], - "Subject: [Cavote] Password lost", + "Subject: [Cavote] %s" % gettext(u"Lost password"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", - "You have lost your password.", - "This link will log you without password.", - "Don't forget to define a new one as soon a possible!", - "This link will only work one time.", + gettext(u"It seems that you have lost your password."), + gettext(u"This link will log you without password."), + gettext(u"Don't forget to define a new one as soon a possible!"), + gettext(u"This link will only work one time."), "", link, "", - "If you think this mail is not for you, please ignore and delete it." + gettext(u"If you think this mail is not for you, please ignore and delete it.") ), "\r\n") server = smtplib.SMTP(SMTP_SERVER) server.sendmail(EMAIL, [user['email']], BODY) @@ -217,9 +219,7 @@ def user_password(userid): # new (invalid) key key = 'i%s' % keygen() # start with i: invalid key print "\n\nchange key for %s\n" % key # FIXME TMP - g.db.execute('update users set password = ?, key = ? where id = ?', - [crypt(request.form['password'], key), - key, session['user']['id']]) + g.db.execute('update users set password = ?, key = ? where id = ?', [crypt(request.form['password'], key), key, session['user']['id']]) g.db.commit() flash(u'Votre mot de passe a été mis à jour.', 'success') else: @@ -282,20 +282,20 @@ def admin_user_add(): BODY = string.join(( "From: %s" % EMAIL, "To: %s" % user['email'], - "Subject: [Cavote] Welcome", + "Subject: [Cavote] %s" % gettext(u"Welcome"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", - "Hi %s!" % user['name'], - "Welcome on %s." % TITLE, - "Your account's adresse is : %s." % user['email'], + "%(text)s %(user)s!" % {"text": gettext(u"Hi"), "user": user['name']}, + "%(text2)s %(title)s." % {"text2": gettext(u"Welcome on"), "title": TITLE}, + "%(text3)s %(email)s." % {"text3": gettext(u"Your account address is"), "email": user['email']}, "", - "To log in for the first time and set your password, please follow this link :", + gettext(u"To log in for the first time and set your password, please follow this link :"), link, "" ), "\r\n") server = smtplib.SMTP(SMTP_SERVER) - server.sendmail(EMAIL, [user['email']], BODY) + server.sendmail(EMAIL, [user['email']], BODY.encode('utf-8')) server.quit() flash(u'Le nouvel utilisateur a été créé avec succès', 'success') return redirect(url_for('admin_users')) @@ -606,19 +606,19 @@ def admin_vote_edit(voteid): BODY = string.join(( "From: %s" % EMAIL, "To: %s" % user['email'], - "Subject: [Cavote] A vote has been opened for your group", + "Subject: [Cavote] %s" % gettext(u"A vote has been opened for your group"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", - "A vote has been opened and you are in a group concerned by it : %s" % request.form['title'], + "%(text)s %(title)s" % {"text": gettext(u"A vote has been opened and you are in a group concerned by it :"), "title": request.form['title']}, "", - "This link will bring you to the form where you will be able to vote :", + gettext(u"This link will bring you to the form where you will be able to vote :"), link, "", - "If you think this mail is not for you, please ignore and delete it." + gettext(u"If you think this mail is not for you, please ignore and delete it.") ), "\r\n") server = smtplib.SMTP(SMTP_SERVER) - server.sendmail(EMAIL, [user['email']], BODY) + server.sendmail(EMAIL, [user['email']], BODY.encode('utf-8')) server.quit() else: flash(u'Vous devez proposer au moins deux choix pour ouvrir le vote.', 'error') @@ -626,15 +626,13 @@ def admin_vote_edit(voteid): isterminated = 1 if vote['is_open']: isopen = 1 - g.db.execute('update votes set title = ?, description = ?, category = ?, is_transparent = ?, is_public = ?, is_open = ?, is_terminated = ?, date_end = ?, reminder_last_days = ? where id = ?', - [request.form['title'], request.form['description'], request.form['category'], transparent, public, isopen, isterminated, date_end, request.form['reminder'], voteid]) + g.db.execute('update votes set title = ?, description = ?, category = ?, is_transparent = ?, is_public = ?, is_open = ?, is_terminated = ?, date_end = ?, reminder_last_days = ? where id = ?', [request.form['title'], request.form['description'], request.form['category'], transparent, public, isopen, isterminated, date_end, request.form['reminder'], voteid]) g.db.commit() vote = query_db('select * from votes where id = ?', [voteid], one=True) flash(u"Le vote a bien été mis à jour.", "success") else: flash(u'Vous devez spécifier un titre.', 'error') - vote['duration'] = (datetime.strptime(vote['date_end'], "%Y-%m-%d") - - datetime.strptime(vote['date_begin'], "%Y-%m-%d")).days + vote['duration'] = (datetime.strptime(vote['date_end'], "%Y-%m-%d") - datetime.strptime(vote['date_begin'], "%Y-%m-%d")).days group = query_db('select name from groups where id = ?', [vote['id_group']], one=True) choices = query_db('select * from choices where id_vote = ?', [voteid]) attachments = query_db('select * from attachments where id_vote = ?', [voteid]) @@ -719,4 +717,3 @@ def admin_vote_deleteattachment(voteid, attachmentid): if __name__ == '__main__': app.run() - -- 2.20.1 From 5214a40c479b78efea032f35accf1b3669e6428d Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 22 Dec 2012 16:02:21 +0100 Subject: [PATCH 02/16] fix one missing utf-8 encoding --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index d772464..da8431c 100755 --- a/main.py +++ b/main.py @@ -162,7 +162,7 @@ def password_lost(): gettext(u"If you think this mail is not for you, please ignore and delete it.") ), "\r\n") server = smtplib.SMTP(SMTP_SERVER) - server.sendmail(EMAIL, [user['email']], BODY) + server.sendmail(EMAIL, [user['email']], BODY.encode('utf-8')) server.quit() flash(u"Un mail a été envoyé à " + user['email'], 'info') return render_template('password_lost.html') -- 2.20.1 From 69c59dd3646281c431105ab2b677479256a22eeb Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 22 Dec 2012 16:10:24 +0100 Subject: [PATCH 03/16] add translation files, generated with pybabel --- messages.pot | 81 +++++++++++++++++++++++ translations/fr/LC_MESSAGES/messages.mo | Bin 0 -> 1936 bytes translations/fr/LC_MESSAGES/messages.po | 82 ++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 messages.pot create mode 100644 translations/fr/LC_MESSAGES/messages.mo create mode 100644 translations/fr/LC_MESSAGES/messages.po diff --git a/messages.pot b/messages.pot new file mode 100644 index 0000000..dc06241 --- /dev/null +++ b/messages.pot @@ -0,0 +1,81 @@ +# Translations template for PROJECT. +# Copyright (C) 2012 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2012. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2012-12-22 16:09+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + +#: main.py:120 +msgid "Successfully signed in" +msgstr "" + +#: main.py:151 +msgid "Lost password" +msgstr "" + +#: main.py:155 +msgid "It seems that you have lost your password." +msgstr "" + +#: main.py:156 +msgid "This link will log you without password." +msgstr "" + +#: main.py:157 +msgid "Don't forget to define a new one as soon a possible!" +msgstr "" + +#: main.py:158 +msgid "This link will only work one time." +msgstr "" + +#: main.py:162 main.py:618 +msgid "If you think this mail is not for you, please ignore and delete it." +msgstr "" + +#: main.py:285 +msgid "Welcome" +msgstr "" + +#: main.py:289 +msgid "Hi" +msgstr "" + +#: main.py:290 +msgid "Welcome on" +msgstr "" + +#: main.py:291 +msgid "Your account address is" +msgstr "" + +#: main.py:293 +msgid "" +"To log in for the first time and set your password, please follow this " +"link :" +msgstr "" + +#: main.py:609 +msgid "A vote has been opened for your group" +msgstr "" + +#: main.py:613 +msgid "A vote has been opened and you are in a group concerned by it :" +msgstr "" + +#: main.py:615 +msgid "This link will bring you to the form where you will be able to vote :" +msgstr "" + diff --git a/translations/fr/LC_MESSAGES/messages.mo b/translations/fr/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..534ce00fad30fea39bf6dcc2caef19ed952982ac GIT binary patch literal 1936 zcmZ{k%WfP+6ov~3AVxw$k$_E*PLR-q;GWEkxR_4tBz6oK*~D@jBNDNw={_@4PEA$2 zE@PZ6JNAJMLM&sR011iByZ}#t#Da%_4gA&ZOPtHd<8P|_)T#g6>d&)h9teD1!}lD% zKc>YapL5R%aTV*gz<0o}!S}&$!RNtW!Da9_@FMsh_$qi2FW&&?!4>c(cmaF>z775k zu7iJpFN2p}5TXTs1ilF_f#1Q`9dHfnzt1%L`!5QSV|^D)`@RS7f)>s09{d4JI{pB+!GFM4zzsM{y6=E(aGac9r>PB0W9ezYY{*t@xFl&x+P9IU zV^W4Bjhu}Y71k8&lEGk~RG|D>`-j%0{jS+3ZdlU}goh&z6fBiIREFW!@E+Op%agY@ z9aLHG)j;!k@tG2;P1;M=jIdPbh}A%z zdE&8OhT7d&PMNgz^~zBtz2CF0?1;7W>}V-&#iC&Ehf(W&@^Fr@l@VJ>hE9U^l-4wG z%8VM77DsT3azcA!hLV)Q#t5nqQwqIKcmB8+Z5tnZDvWJB5z%?v&>Dz=+Iw}{f|@W) zETS2uI;FJN8k9pM>1~}2kF3|#IEw8!WkajA-D^@?$CQgNSr>M~N5nbet5iu@6gHYb zvMe3af+C0wXLq;=*=m_>v-8TDoR(!BVQZ5s>q55fN2<)0;>c%PHm4mY2a4S_rBz`& z=!e$E&8=+Nu?*Oq-H?HE>UVqn41fJT^*+eE^Y3+g-7XBXO`fWB%2Vxny~b`$`jBlo zX}p%fx|}|bTA{Ny>yzoq6A~6%YtoFO9C5bAa+1@~(G_%hkVUvQ9F`{OTx@OV=%mg* zL3w>nrmB~Ip??|em)nkVu=ykfSWjJF4Rr?jf3;a#ERB5TqWh%zf zp*jmO472$YyQF@|E?Y5$Ezw^&%@0&)eTvz1ND&gcpVN{Yu%>S3BlwBYcerltq*)M@Tm2gXF!+MzcXqsVNNk;|isIo#~sGs4iN^OAZqO%(h;)}M8 z17!Dpni?wGNOL(mz-%i=(O^iSLPk7$=xI0d@o>|5v1H8-{E1ttQHXoT!%wm*xEXWY z3$=J|rV^c(8gF(mceo>YzfZc|%)Lv&A~+wb%AxZeMqgv}Cu#7K+uE1hPh#1X5$hDm z1Q$sOWw-<|O6!lT8Z)tdl0P(sLBG!qyjaE!lDevPisxliP7-2G;~!C6xZaJ&vAGF{ z00W$q#={}Wr#wIrESlFS*Wp31^QmN~H6Cp=?Ub0Q)b-V}8`}{H^BfWG&??^%8%@1V z`O~;z9Z%HkAp|C~l(plUJ(-d@V7FaQ7m literal 0 HcmV?d00001 diff --git a/translations/fr/LC_MESSAGES/messages.po b/translations/fr/LC_MESSAGES/messages.po new file mode 100644 index 0000000..a5c9a39 --- /dev/null +++ b/translations/fr/LC_MESSAGES/messages.po @@ -0,0 +1,82 @@ +# French translations for Cavote. +# Copyright (C) 2012 FFDN +# This file is distributed under the same license as the Cavote project. +# Julien Rabier , 2012. +# + +msgid "" +msgstr "" +"Project-Id-Version: Cavote \n" +"Report-Msgid-Bugs-To: jrabier@ilico.org\n" +"POT-Creation-Date: 2012-12-22 15:08+0100\n" +"PO-Revision-Date: 2012-12-22 15:11+0100\n" +"Last-Translator: Julien Rabier \n" +"Language-Team: fr \n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + +#: main.py:120 +msgid "Successfully signed in" +msgstr "Vous êtes connectés" + +#: main.py:151 +msgid "Lost password" +msgstr "Mot de passe perdu" + +#: main.py:155 +msgid "It seems that you have lost your password." +msgstr "Il semble que vous ayez perdu votre mot de passe." + +#: main.py:156 +msgid "This link will log you without password." +msgstr "Ce lien vous permet de vous connecter sans mot de passe." + +#: main.py:157 +msgid "Don't forget to define a new one as soon a possible!" +msgstr "N'oubliez pas d'en définir un nouveau dès que possible !" + +#: main.py:158 +msgid "This link will only work one time." +msgstr "Ce lien n'est valable qu'une seule fois." + +#: main.py:162 main.py:618 +msgid "If you think this mail is not for you, please ignore and delete it." +msgstr "Si vous pensez que ce mail ne vous est pas adressé, vous pouvez l'ignorer et le supprimer." + +#: main.py:285 +msgid "Welcome" +msgstr "Bienvenue" + +#: main.py:289 +msgid "Hi" +msgstr "Bonjour" + +#: main.py:290 +msgid "Welcome on" +msgstr "Bienvenue sur" + +#: main.py:291 +msgid "Your account address is" +msgstr "L'adresse associée à votre compte est" + +#: main.py:293 +msgid "" +"To log in for the first time and set your password, please follow this " +"link :" +msgstr "Pour vous connecter la première fois et définir votre mot de passe, suivez ce lien :" + +#: main.py:609 +msgid "A vote has been opened for your group" +msgstr "Un vote a été ouvert pour votre groupe" + +#: main.py:613 +msgid "A vote has been opened and you are in a group concerned by it :" +msgstr "Un vote a été ouvert et vous êtes dans le groupe concerné par celui-ci :" + +#: main.py:615 +msgid "This link will bring you to the form where you will be able to vote :" +msgstr "Ce lien vous conduira au formulaire qui vous permettra de voter :" + -- 2.20.1 From b4a7c4f77721bd665a7e6cf0c15599120b3595e8 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 22 Dec 2012 19:06:33 +0100 Subject: [PATCH 04/16] add i18n support for reminder script --- reminder.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/reminder.py b/reminder.py index 67335a6..6ebac88 100644 --- a/reminder.py +++ b/reminder.py @@ -6,7 +6,7 @@ from datetime import date, datetime, timedelta import time from settings import * - +from flaskext.babel import gettext import sqlite3 @@ -40,43 +40,43 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ BODY = string.join(( "From: %s" % EMAIL, "To: %s" % user[1], - "Subject: [Cavote] Vote reminder - You didn't take part to it", + "Subject: [Cavote] %s" % gettext(u"Vote reminder - You didn't take part to it"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", - "A vote concerns you and is going to terminate on %s : %s" % (vote[2], vote[3]), - "You still didn't take part to it !", + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3]), + gettext(u"You still didn't take part to it !"), "", - "This link will bring you to the form where you will be able to participate :", + gettext(u"This link will bring you to the form where you will be able to participate :"), link, "", - "If you think this mail is not for you, please ignore and delete it." + gettext(u"If you think this mail is not for you, please ignore and delete it.") ), "\r\n") server = smtplib.SMTP(SMTP_SERVER) print EMAIL print user[1] print BODY - server.sendmail(EMAIL, user[1], BODY) + server.sendmail(EMAIL, user[1], BODY.encode('utf-8')) server.quit() else: BODY = string.join(( "From: %s" % EMAIL, "To: %s" % user[1], - "Subject: [Cavote] Vote reminder - Last days to modify your choice", + "Subject: [Cavote] %s" % gettext(u"Vote reminder - Last days to modify your choice"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", - "A vote concerns you and is going to terminate on %s : %s" % (vote[2], vote[3]), - "You have already voted by can still modify you choice", + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3]), + gettext(u"You have already voted but you can still modify you choice"), "", - "This link will bring you to the form where you will be able to participate :", + gettext(u"This link will bring you to the form where you will be able to participate :"), link, "", - "If you think this mail is not for you, please ignore and delete it." + gettext(u"If you think this mail is not for you, please ignore and delete it.") ), "\r\n") server = smtplib.SMTP(SMTP_SERVER) print EMAIL print user[1] print BODY - server.sendmail(EMAIL, user[1], BODY) + server.sendmail(EMAIL, user[1], BODY.encode('utf-8')) server.quit() -- 2.20.1 From d7630610678fb6de2e4fc8bcfd3ab8c7e47518a0 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 22 Dec 2012 19:06:53 +0100 Subject: [PATCH 05/16] update fr translation --- translations/fr/LC_MESSAGES/messages.mo | Bin 1936 -> 2758 bytes translations/fr/LC_MESSAGES/messages.po | 42 +++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/translations/fr/LC_MESSAGES/messages.mo b/translations/fr/LC_MESSAGES/messages.mo index 534ce00fad30fea39bf6dcc2caef19ed952982ac..ff68c6430d3ccfbb7fde7af5f6a18cef827241e5 100644 GIT binary patch delta 1061 zcmb8tO=uHA6bJB^uf|qIsKzSx@EWM`tD0aBnu~(A7+=Q3lcQ_5RQKDH`f;ednw>kJ2o`N6Ye)t<6hI?Z~MVN;3 zL~U~MZ~`x0!Zh55S70PgbPg^+Gf*2Q;d3|!U%)(k4NcrnXcloSLG%EVI}c6V<_OVg z_ywB8DGXxrm0=$FX$=o%;4R#i;CpCRIzx^OdFQB3O?e3YMZD7E5LloZv~6WO8J~S|Te8VuLX{t!jZG|aMKmRgswair3Ri4% zx#5SawS>dkSJmpSJcBf5*xt9l56)9TA$B)@F`vzCyosHOTy44yJt(GR>2p)Cmi-E1 zWmQSnonFcR-Iaq};z;l-{xy~!O9!75uY&T(x6(CHugfZGbQv3_q^EfWh0$C$LUZ8I<`leG5F)sX zi;IvrHuo0<4Q)ZQF7`cY=z)jN^E@x_!}A(>2sPhry)8tTbjXh1{0m1D$;M1& diff --git a/translations/fr/LC_MESSAGES/messages.po b/translations/fr/LC_MESSAGES/messages.po index a5c9a39..e1bc4d1 100644 --- a/translations/fr/LC_MESSAGES/messages.po +++ b/translations/fr/LC_MESSAGES/messages.po @@ -3,12 +3,11 @@ # This file is distributed under the same license as the Cavote project. # Julien Rabier , 2012. # - msgid "" msgstr "" "Project-Id-Version: Cavote \n" "Report-Msgid-Bugs-To: jrabier@ilico.org\n" -"POT-Creation-Date: 2012-12-22 15:08+0100\n" +"POT-Creation-Date: 2012-12-22 19:01+0100\n" "PO-Revision-Date: 2012-12-22 15:11+0100\n" "Last-Translator: Julien Rabier \n" "Language-Team: fr \n" @@ -42,9 +41,10 @@ msgstr "N'oubliez pas d'en définir un nouveau dès que possible !" msgid "This link will only work one time." msgstr "Ce lien n'est valable qu'une seule fois." -#: main.py:162 main.py:618 +#: main.py:162 main.py:618 reminder.py:53 reminder.py:75 msgid "If you think this mail is not for you, please ignore and delete it." -msgstr "Si vous pensez que ce mail ne vous est pas adressé, vous pouvez l'ignorer et le supprimer." +msgstr "Si vous pensez que ce mail ne vous est pas adressé, vous pouvez l'ignorer" +" et le supprimer." #: main.py:285 msgid "Welcome" @@ -66,7 +66,9 @@ msgstr "L'adresse associée à votre compte est" msgid "" "To log in for the first time and set your password, please follow this " "link :" -msgstr "Pour vous connecter la première fois et définir votre mot de passe, suivez ce lien :" +msgstr "" +"Pour vous connecter la première fois et définir votre mot de passe, " +"suivez ce lien :" #: main.py:609 msgid "A vote has been opened for your group" @@ -80,3 +82,33 @@ msgstr "Un vote a été ouvert et vous êtes dans le groupe concerné par celui- msgid "This link will bring you to the form where you will be able to vote :" msgstr "Ce lien vous conduira au formulaire qui vous permettra de voter :" +#: reminder.py:43 +msgid "Vote reminder - You didn't take part to it" +msgstr "Rappel - Vous n'avez pas encore voté" + +#: reminder.py:47 +msgid "A vote concerns you and is going to terminate on" +msgstr "Un vote vous concerne et va se terminer le" + +#: reminder.py:48 +msgid "You still didn't take part to it !" +msgstr "Vous n'y avez pas encore participé !" + +#: reminder.py:50 reminder.py:72 +msgid "" +"This link will bring you to the form where you will be able to " +"participate :" +msgstr "Ce lien vous conduira au formulaire qui vous permettra de voter :" + +#: reminder.py:65 +msgid "Vote reminder - Last days to modify your choice" +msgstr "Rappel - Derniers jours pour modifier votre vote" + +#: reminder.py:69 +msgid "A vote concerns you and is going to terminate on " +msgstr "Un vote vous concerne et va se terminer le " + +#: reminder.py:70 +msgid "You have already voted but you can still modify you choice" +msgstr "Vous avez déjà voté mais vous pouvez encore modifier votre choix" + -- 2.20.1 From f4d357e37e0b186c35ff0958fdb0ffee5d17903e Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 22 Dec 2012 21:08:26 +0100 Subject: [PATCH 06/16] update messages.pot --- messages.pot | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/messages.pot b/messages.pot index dc06241..af0f504 100644 --- a/messages.pot +++ b/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2012-12-22 16:09+0100\n" +"POT-Creation-Date: 2012-12-22 19:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,7 +41,7 @@ msgstr "" msgid "This link will only work one time." msgstr "" -#: main.py:162 main.py:618 +#: main.py:162 main.py:618 reminder.py:53 reminder.py:75 msgid "If you think this mail is not for you, please ignore and delete it." msgstr "" @@ -79,3 +79,33 @@ msgstr "" msgid "This link will bring you to the form where you will be able to vote :" msgstr "" +#: reminder.py:43 +msgid "Vote reminder - You didn't take part to it" +msgstr "" + +#: reminder.py:47 +msgid "A vote concerns you and is going to terminate on" +msgstr "" + +#: reminder.py:48 +msgid "You still didn't take part to it !" +msgstr "" + +#: reminder.py:50 reminder.py:72 +msgid "" +"This link will bring you to the form where you will be able to " +"participate :" +msgstr "" + +#: reminder.py:65 +msgid "Vote reminder - Last days to modify your choice" +msgstr "" + +#: reminder.py:69 +msgid "A vote concerns you and is going to terminate on " +msgstr "" + +#: reminder.py:70 +msgid "You have already voted but you can still modify you choice" +msgstr "" + -- 2.20.1 From de9e465a93dde670ac6677f8b036e40d939cc84f Mon Sep 17 00:00:00 2001 From: "Cyprien Nicolas (fulax)" Date: Sun, 10 Feb 2013 17:50:22 +0100 Subject: [PATCH 07/16] Add Content-type header to mails. Charset is set to utf-8, as the body is utf-8 encoded --- main.py | 3 +++ reminder.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/main.py b/main.py index da8431c..f2db15b 100755 --- a/main.py +++ b/main.py @@ -150,6 +150,7 @@ def password_lost(): "To: %s" % user['email'], "Subject: [Cavote] %s" % gettext(u"Lost password"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", gettext(u"It seems that you have lost your password."), @@ -284,6 +285,7 @@ def admin_user_add(): "To: %s" % user['email'], "Subject: [Cavote] %s" % gettext(u"Welcome"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%(text)s %(user)s!" % {"text": gettext(u"Hi"), "user": user['name']}, @@ -608,6 +610,7 @@ def admin_vote_edit(voteid): "To: %s" % user['email'], "Subject: [Cavote] %s" % gettext(u"A vote has been opened for your group"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%(text)s %(title)s" % {"text": gettext(u"A vote has been opened and you are in a group concerned by it :"), "title": request.form['title']}, diff --git a/reminder.py b/reminder.py index 6ebac88..56cf4bc 100644 --- a/reminder.py +++ b/reminder.py @@ -42,6 +42,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "To: %s" % user[1], "Subject: [Cavote] %s" % gettext(u"Vote reminder - You didn't take part to it"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3]), @@ -64,6 +65,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "To: %s" % user[1], "Subject: [Cavote] %s" % gettext(u"Vote reminder - Last days to modify your choice"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3]), -- 2.20.1 From 81e673128496d1fa6828ec0a5a6bd59a3ec04f74 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sat, 2 Mar 2013 19:03:33 +0100 Subject: [PATCH 08/16] fix a typo in french translation --- translations/fr/LC_MESSAGES/messages.po | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/translations/fr/LC_MESSAGES/messages.po b/translations/fr/LC_MESSAGES/messages.po index e1bc4d1..2159024 100644 --- a/translations/fr/LC_MESSAGES/messages.po +++ b/translations/fr/LC_MESSAGES/messages.po @@ -43,8 +43,7 @@ msgstr "Ce lien n'est valable qu'une seule fois." #: main.py:162 main.py:618 reminder.py:53 reminder.py:75 msgid "If you think this mail is not for you, please ignore and delete it." -msgstr "Si vous pensez que ce mail ne vous est pas adressé, vous pouvez l'ignorer" -" et le supprimer." +msgstr "Si vous pensez que ce mail ne vous est pas adressé, vous pouvez l'ignorer et le supprimer." #: main.py:285 msgid "Welcome" -- 2.20.1 From cbc81a0257e8e461a254c89ce34adc60ae3e9a42 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Mon, 22 Apr 2013 21:14:57 +0200 Subject: [PATCH 09/16] Typo --- templates/votes.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/votes.html b/templates/votes.html index 616e3b3..ddb3ce0 100644 --- a/templates/votes.html +++ b/templates/votes.html @@ -37,6 +37,6 @@ Liste des votes {% else %} -
Il n'y a pas encore de votes. Désolé.
+
Il n'y a pas encore de vote. Désolé.
{% endfor %} {% endblock %} -- 2.20.1 From 25254e8fbfbdf53f824cff6f733ce1e5cffd22b3 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sun, 19 May 2013 23:55:36 +0200 Subject: [PATCH 10/16] update requirements --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0c8b26f..7551231 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,6 @@ Werkzeug==0.8.3 argparse==1.2.1 distribute==0.6.24 python-openid==2.2.5 -pytz==2012h +pytz==2013b speaklater==1.3 wsgiref==0.1.2 -- 2.20.1 From 8c826b6a4c1ea070424027c1a99ad0f6b5eebd19 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Tue, 21 May 2013 00:47:58 +0200 Subject: [PATCH 11/16] fix encoding in reminder.py + typo --- reminder.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reminder.py b/reminder.py index 56cf4bc..90eebf4 100644 --- a/reminder.py +++ b/reminder.py @@ -45,7 +45,8 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3]), + "%s %s : %s" % (gettext(u"A vote concerns you and is going + to terminate on"), vote[2], vote[3].encode('utf-8')), gettext(u"You still didn't take part to it !"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), @@ -68,8 +69,10 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3]), - gettext(u"You have already voted but you can still modify you choice"), + "%s %s : %s" % (gettext(u"A vote concerns you and is going + to terminate on "), vote[2], vote[3].encode('utf-8')), + gettext(u"You have already voted but you can still modify + your choice"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), link, -- 2.20.1 From 795c519c47ce373311b6590b264aa618356a9a49 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Tue, 21 May 2013 00:55:38 +0200 Subject: [PATCH 12/16] fix broken lines in reminder.py --- reminder.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/reminder.py b/reminder.py index 90eebf4..e72c350 100644 --- a/reminder.py +++ b/reminder.py @@ -45,8 +45,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going - to terminate on"), vote[2], vote[3].encode('utf-8')), + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3].encode('utf-8')), gettext(u"You still didn't take part to it !"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), @@ -69,10 +68,8 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going - to terminate on "), vote[2], vote[3].encode('utf-8')), - gettext(u"You have already voted but you can still modify - your choice"), + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3].encode('utf-8')), + gettext(u"You have already voted but you can still modify your choice"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), link, -- 2.20.1 From 30803d5fea0865639ac79298c0820f6165608ff6 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sun, 26 May 2013 01:09:36 +0200 Subject: [PATCH 13/16] fix another utf-8 issue in reminder.py --- reminder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reminder.py b/reminder.py index e72c350..5d2ea7b 100644 --- a/reminder.py +++ b/reminder.py @@ -32,7 +32,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ for user in c.execute('select users.id, users.email, users.name from users join user_group on users.id=user_group.id_user where user_group.id_group = ?', voting_group).fetchall(): userchoice_request = (user[0], vote[0],) userchoice = c.execute('select * from user_choice join choices on user_choice.id_choice = choices.id where id_user = ? and id_vote = ?', userchoice_request).fetchone() - print "Checking if user %s already voted %s" % (user[1], vote[3]) + print "Checking if user %s already voted %s" % (user[1], vote[3].encode('utf-8')) print userchoice if userchoice is None: #user didn't vote yet -- 2.20.1 From 473c73474dbf1dc5b789a847e924599f313c6fcd Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sun, 26 May 2013 01:18:28 +0200 Subject: [PATCH 14/16] fix again another utf-8 issue in reminder.py --- reminder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reminder.py b/reminder.py index 5d2ea7b..ff75f99 100644 --- a/reminder.py +++ b/reminder.py @@ -32,7 +32,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ for user in c.execute('select users.id, users.email, users.name from users join user_group on users.id=user_group.id_user where user_group.id_group = ?', voting_group).fetchall(): userchoice_request = (user[0], vote[0],) userchoice = c.execute('select * from user_choice join choices on user_choice.id_choice = choices.id where id_user = ? and id_vote = ?', userchoice_request).fetchone() - print "Checking if user %s already voted %s" % (user[1], vote[3].encode('utf-8')) + print "Checking if user %s already voted %s" % (user[1].encode('utf-8'), vote[3].encode('utf-8')) print userchoice if userchoice is None: #user didn't vote yet @@ -45,7 +45,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3].encode('utf-8')), + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2].encode('utf-8'), vote[3].encode('utf-8')), gettext(u"You still didn't take part to it !"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), @@ -68,7 +68,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3].encode('utf-8')), + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2].encode('utf-8'), vote[3].encode('utf-8')), gettext(u"You have already voted but you can still modify your choice"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), -- 2.20.1 From 6ea2051898eaefcaa0d3adf90c7031cbadf41922 Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sun, 26 May 2013 01:28:26 +0200 Subject: [PATCH 15/16] fix utf-8 issue and a missing variable in reminder.py --- reminder.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reminder.py b/reminder.py index ff75f99..6be8643 100644 --- a/reminder.py +++ b/reminder.py @@ -45,7 +45,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2].encode('utf-8'), vote[3].encode('utf-8')), + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3]), gettext(u"You still didn't take part to it !"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), @@ -60,6 +60,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ server.sendmail(EMAIL, user[1], BODY.encode('utf-8')) server.quit() else: + link = "http://vote.ffdn.org/vote/%d" % vote[0] BODY = string.join(( "From: %s" % EMAIL, "To: %s" % user[1], @@ -68,7 +69,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", - "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2].encode('utf-8'), vote[3].encode('utf-8')), + "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3]), gettext(u"You have already voted but you can still modify your choice"), "", gettext(u"This link will bring you to the form where you will be able to participate :"), -- 2.20.1 From ff3647893d53d0c27a90df1706e7c699535dd93d Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Sun, 26 May 2013 01:30:39 +0200 Subject: [PATCH 16/16] fix another utf-8 issue in reminder.py --- reminder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reminder.py b/reminder.py index 6be8643..e379081 100644 --- a/reminder.py +++ b/reminder.py @@ -80,6 +80,6 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ server = smtplib.SMTP(SMTP_SERVER) print EMAIL print user[1] - print BODY + print BODY.encode('utf-8') server.sendmail(EMAIL, user[1], BODY.encode('utf-8')) server.quit() -- 2.20.1