diff --git a/c3l_membership/forms.py b/c3l_membership/forms.py --- a/c3l_membership/forms.py +++ b/c3l_membership/forms.py @@ -1,5 +1,6 @@ from datetime import date +from flask_babel import lazy_gettext from flask_wtf import FlaskForm from wtforms import BooleanField, DateField, RadioField, StringField, SubmitField from wtforms.validators import Email, InputRequired, Length, Optional @@ -8,84 +9,96 @@ from wtforms.validators import Email, In class MembershipForm(FlaskForm): username = StringField( - "Username", - validators=[InputRequired("This field is required!"), Length(max=255)], + lazy_gettext("Username"), + validators=[ + InputRequired(lazy_gettext("This field is required!")), + Length(max=255), + ], ) email = StringField( - "E-Mail", validators=[InputRequired("This field is required!"), Email()] + lazy_gettext("E-Mail"), + validators=[InputRequired(lazy_gettext("This field is required!")), Email()], ) fullname = StringField( - "Full Name", - validators=[InputRequired("This field is required!"), Length(max=65536)], + lazy_gettext("Full Name"), + validators=[ + InputRequired(lazy_gettext("This field is required!")), + Length(max=65536), + ], ) membership = RadioField( - "Membership Plan", - validators=[InputRequired("Please select one of the options!")], + lazy_gettext("Membership Plan"), + validators=[InputRequired(lazy_gettext("Please select one of the options!"))], choices=[ ( "regular", - "Regular membership - Membership with voting rights on the general assembly.", + lazy_gettext( + "Regular membership - Membership with voting rights on the general assembly." + ), ), ( "supporting", - "Supporting membership - Membership without voting rights on the general assembly.", + lazy_gettext( + "Supporting membership - Membership without voting rights on the general assembly." + ), ), ], ) student = BooleanField( - ("I am a student and would like to have the reduced membership fees."), + lazy_gettext( + "I am a student and would like to have the reduced membership fees." + ), ) starving = BooleanField( - ( + lazy_gettext( "I am a starving hacker and cannot afford the membership! (Please get in touch with us at info@c3l.lu before filling out this membership form)" ) ) payment = RadioField( - "Payment Options", - validators=[InputRequired("Please select one of the options!")], + lazy_gettext("Payment Options"), + validators=[InputRequired(lazy_gettext("Please select one of the options!"))], ) - birthday = DateField("Birthday") + birthday = DateField(lazy_gettext("Birthday")) street = StringField( - "Nr., Street", + lazy_gettext("Nr., Street"), validators=[Length(max=4000)], ) zip = StringField( - "Postal Code", + lazy_gettext("Postal Code"), validators=[Length(max=30)], ) city = StringField( - "City/Town", + lazy_gettext("City/Town"), validators=[Length(max=500)], ) state = StringField( - "State/County/Province", + lazy_gettext("State/County/Province"), validators=[Length(max=500)], ) country = StringField( - "Country", + lazy_gettext("Country"), validators=[Length(max=500)], ) terms = BooleanField( - ( - "By submitting this membership application, you agree to have read and understood " - 'the statutes of the Chaos Computer Club Lëtzebuerg A.S.B.L.' + lazy_gettext( + 'By submitting this membership application, you agree to have read and understood the statutes of the Chaos Computer Club Lëtzebuerg A.S.B.L.' ), validators=[InputRequired()], ) minor_member = BooleanField( - ( + lazy_gettext( "I am under 18 years of age and have the approval of my legal representative." - ), + ) ) - submit = SubmitField("Become a member") + submit = SubmitField(lazy_gettext("Become a member")) diff --git a/c3l_membership/templates/index.html b/c3l_membership/templates/index.html --- a/c3l_membership/templates/index.html +++ b/c3l_membership/templates/index.html @@ -3,7 +3,7 @@
-- Fill out this form and click on "Become a member". Afterwards you will be presented with a PDF, which you have - to send to info@c3l.lu or bring it to one of our next events. Print it or save it to your local hardware, - because we don't save a copy on our servers for data protection reasons! + {% trans %} + Fill out this form and click on "Become a member". Afterwards you will be presented with a PDF, which you have + to send to info@c3l.lu or bring it to one of our next events. Print it or save it to your local hardware, + because we don't save a copy on our servers for data protection reasons! + {% endtrans %}
{% if form.errors %} {% for fieldname, errors in form.errors.items() %} @@ -32,7 +34,7 @@