From 6cb458b46a6103d54f027a4233b69bc244c08c9b Mon Sep 17 00:00:00 2001 From: Bertrand Marron Date: Tue, 4 Mar 2014 11:22:32 +0100 Subject: [PATCH 1/2] Translate gender and education level from user profile --- common/djangoapps/student/models.py | 25 +++++++++++++++---------- lms/templates/register.html | 4 ++-- lms/templates/signup_modal.html | 4 ++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index c182ee34cd..75865205cb 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -29,6 +29,7 @@ from django.dispatch import receiver, Signal import django.dispatch from django.forms import ModelForm, forms from django.core.exceptions import ObjectDoesNotExist +from django.utils.translation import ugettext_noop from django_countries import CountryField from track import contexts from track.views import server_track @@ -189,7 +190,11 @@ class UserProfile(models.Model): this_year = datetime.now(UTC).year VALID_YEARS = range(this_year, this_year - 120, -1) year_of_birth = models.IntegerField(blank=True, null=True, db_index=True) - GENDER_CHOICES = (('m', 'Male'), ('f', 'Female'), ('o', 'Other')) + GENDER_CHOICES = ( + ('m', ugettext_noop('Male')), + ('f', ugettext_noop('Female')), + ('o', ugettext_noop('Other')) + ) gender = models.CharField( blank=True, null=True, max_length=6, db_index=True, choices=GENDER_CHOICES ) @@ -199,15 +204,15 @@ class UserProfile(models.Model): # ('p_se', 'Doctorate in science or engineering'), # ('p_oth', 'Doctorate in another field'), LEVEL_OF_EDUCATION_CHOICES = ( - ('p', 'Doctorate'), - ('m', "Master's or professional degree"), - ('b', "Bachelor's degree"), - ('a', "Associate's degree"), - ('hs', "Secondary/high school"), - ('jhs', "Junior secondary/junior high/middle school"), - ('el', "Elementary/primary school"), - ('none', "None"), - ('other', "Other") + ('p', ugettext_noop('Doctorate')), + ('m', ugettext_noop("Master's or professional degree")), + ('b', ugettext_noop("Bachelor's degree")), + ('a', ugettext_noop("Associate's degree")), + ('hs', ugettext_noop("Secondary/high school")), + ('jhs', ugettext_noop("Junior secondary/junior high/middle school")), + ('el', ugettext_noop("Elementary/primary school")), + ('none', ugettext_noop("None")), + ('other', ugettext_noop("Other")) ) level_of_education = models.CharField( blank=True, null=True, max_length=6, db_index=True, diff --git a/lms/templates/register.html b/lms/templates/register.html index dfd5a6c726..e8c818f2a5 100644 --- a/lms/templates/register.html +++ b/lms/templates/register.html @@ -210,7 +210,7 @@ @@ -223,7 +223,7 @@ diff --git a/lms/templates/signup_modal.html b/lms/templates/signup_modal.html index 143e2e49d5..85c2732571 100644 --- a/lms/templates/signup_modal.html +++ b/lms/templates/signup_modal.html @@ -71,7 +71,7 @@ @@ -85,7 +85,7 @@ From 10688f99f41e57f42aea7c2b980b6904a6eb3941 Mon Sep 17 00:00:00 2001 From: Bertrand Marron Date: Tue, 4 Mar 2014 16:40:16 +0100 Subject: [PATCH 2/2] Add translator comments for 'other' and 'none' strings --- common/djangoapps/student/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 75865205cb..c2fcdea354 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -193,6 +193,7 @@ class UserProfile(models.Model): GENDER_CHOICES = ( ('m', ugettext_noop('Male')), ('f', ugettext_noop('Female')), + # Translators: 'Other' refers to the student's gender ('o', ugettext_noop('Other')) ) gender = models.CharField( @@ -211,7 +212,9 @@ class UserProfile(models.Model): ('hs', ugettext_noop("Secondary/high school")), ('jhs', ugettext_noop("Junior secondary/junior high/middle school")), ('el', ugettext_noop("Elementary/primary school")), + # Translators: 'None' refers to the student's level of education ('none', ugettext_noop("None")), + # Translators: 'Other' refers to the student's level of education ('other', ugettext_noop("Other")) ) level_of_education = models.CharField(