diff --git a/lms/djangoapps/student_account/views.py b/lms/djangoapps/student_account/views.py index 556dc5daa3..1838ff2e88 100644 --- a/lms/djangoapps/student_account/views.py +++ b/lms/djangoapps/student_account/views.py @@ -339,7 +339,7 @@ def account_settings_context(request): user = request.user country_options = [ - (country_code, unicode(country_name)) + (country_code, _(country_name)) # pylint: disable=translation-of-non-string for country_code, country_name in sorted( countries.countries, key=lambda(__, name): unicode(name) ) @@ -354,11 +354,11 @@ def account_settings_context(request): 'country': { 'options': country_options, }, 'gender': { - 'options': UserProfile.GENDER_CHOICES, + 'options': [(choice[0], _(choice[1])) for choice in UserProfile.GENDER_CHOICES], # pylint: disable=translation-of-non-string }, 'language': { 'options': released_languages(), }, 'level_of_education': { - 'options': UserProfile.LEVEL_OF_EDUCATION_CHOICES, + 'options': [(choice[0], _(choice[1])) for choice in UserProfile.LEVEL_OF_EDUCATION_CHOICES], # pylint: disable=translation-of-non-string }, 'password': { 'url': reverse('password_reset'), }, 'year_of_birth': { diff --git a/lms/djangoapps/student_profile/views.py b/lms/djangoapps/student_profile/views.py index 9ea1138f14..a47cab8ace 100644 --- a/lms/djangoapps/student_profile/views.py +++ b/lms/djangoapps/student_profile/views.py @@ -12,6 +12,8 @@ from django.views.decorators.http import require_http_methods from edxmako.shortcuts import render_to_response from student.models import User +from django.utils.translation import ugettext as _ + @login_required @require_http_methods(['GET']) @@ -55,10 +57,9 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff) ObjectDoesNotExist: the specified profile_username does not exist. """ profile_user = User.objects.get(username=profile_username) - language_options = [language for language in settings.ALL_LANGUAGES] country_options = [ - (country_code, unicode(country_name)) + (country_code, _(country_name)) # pylint: disable=translation-of-non-string for country_code, country_name in sorted( countries.countries, key=lambda(__, name): unicode(name) ) @@ -78,7 +79,7 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff) 'has_preferences_access': (logged_in_username == profile_username or user_is_staff), 'own_profile': (logged_in_username == profile_username), 'country_options': country_options, - 'language_options': language_options, + 'language_options': settings.ALL_LANGUAGES, } } diff --git a/lms/static/js/student_account/views/account_settings_factory.js b/lms/static/js/student_account/views/account_settings_factory.js index b92f87e402..af46599688 100644 --- a/lms/static/js/student_account/views/account_settings_factory.js +++ b/lms/static/js/student_account/views/account_settings_factory.js @@ -37,10 +37,7 @@ model: userAccountModel, title: gettext('Full Name'), valueAttribute: 'name', - helpMessage: gettext( - 'The name that appears on your edX certificates. Other learners never see ' + - 'your full name.' - ) + helpMessage: gettext('The name that appears on your edX certificates. Other learners never see your full name.') }) }, { @@ -48,10 +45,7 @@ model: userAccountModel, title: gettext('Email Address'), valueAttribute: 'email', - helpMessage: gettext( - 'The email address you use to sign in to edX. Communications ' + - 'from edX and your courses are sent to this address.' - ) + helpMessage: gettext('The email address you use to sign in to edX. Communications from edX and your courses are sent to this address.') }) }, { @@ -62,24 +56,19 @@ valueAttribute: 'password', emailAttribute: 'email', linkTitle: gettext('Reset Password'), - linkHref: fieldsData['password']['url'], - helpMessage: gettext( - 'When you click "Reset Password", a message will be sent to your email address. ' + - 'Click the link in the message to reset your password.' - ) + linkHref: fieldsData.password.url, + helpMessage: gettext('When you click "Reset Password", a message will be sent to your email address. Click the link in the message to reset your password.') }) }, { view: new AccountSettingsFieldViews.LanguagePreferenceFieldView({ model: userPreferencesModel, - title: 'Language', + title: gettext('Language'), valueAttribute: 'pref-lang', required: true, refreshPageOnSave: true, - helpMessage: gettext( - 'The language used for the edX site. The site is currently available in a ' + - 'limited number of languages.' - ), + helpMessage: + gettext('The language used for the edX site. The site is currently available in a limited number of languages.'), options: fieldsData.language.options }) }, diff --git a/lms/static/js/student_profile/views/learner_profile_factory.js b/lms/static/js/student_profile/views/learner_profile_factory.js index afeb198a1b..408d532512 100644 --- a/lms/static/js/student_profile/views/learner_profile_factory.js +++ b/lms/static/js/student_profile/views/learner_profile_factory.js @@ -95,10 +95,7 @@ editable: editable, showMessages: false, title: gettext('About me'), - placeholderValue: gettext( - "Tell other edX learners a little about yourself: where you live, what your interests are, " + - "why you're taking courses on edX, or what you hope to learn." - ), + placeholderValue: gettext("Tell other edX learners a little about yourself: where you live, what your interests are, why you're taking courses on edX, or what you hope to learn."), valueAttribute: "bio", helpMessage: '' }) diff --git a/lms/static/js/student_profile/views/learner_profile_fields.js b/lms/static/js/student_profile/views/learner_profile_fields.js index 9574e97a35..243585fc36 100644 --- a/lms/static/js/student_profile/views/learner_profile_fields.js +++ b/lms/static/js/student_profile/views/learner_profile_fields.js @@ -19,18 +19,12 @@ var accountSettingsLink = '' + gettext('Account Settings page.') + ''; if (this.profileIsPrivate) { this._super(interpolate_text( - gettext( - "You must specify your birth year before you can share your full profile. To specify " + - "your birth year, go to the {account_settings_page_link}" - ), + gettext("You must specify your birth year before you can share your full profile. To specify your birth year, go to the {account_settings_page_link}"), {'account_settings_page_link': accountSettingsLink} )); } else if (this.requiresParentalConsent) { this._super(interpolate_text( - gettext( - 'You must be over 13 to share a full profile. If you are over 13, make sure that you ' + - 'have specified a birth year on the {account_settings_page_link}' - ), + gettext('You must be over 13 to share a full profile. If you are over 13, make sure that you have specified a birth year on the {account_settings_page_link}'), {'account_settings_page_link': accountSettingsLink} )); } @@ -55,7 +49,9 @@ }, imageAltText: function () { - return interpolate_text(gettext("Profile image for {username}"), {username: this.model.get('username')}); + return interpolate_text( + gettext("Profile image for {username}"), {username: this.model.get('username')} + ); }, imageChangeSucceeded: function (e, data) { diff --git a/lms/static/js/views/fields.js b/lms/static/js/views/fields.js index 30ffecb3d4..33456b9d63 100644 --- a/lms/static/js/views/fields.js +++ b/lms/static/js/views/fields.js @@ -20,12 +20,12 @@ tagName: 'div', indicators: { - 'canEdit': 'gettext("Editable")', - 'error': 'gettext("Error")', - 'validationError': 'gettext("Validation Error")', - 'inProgress': 'gettext("In Progress")', - 'success': 'gettext("Success")', - 'plus': 'gettext("Placeholder")' + 'canEdit': '' + gettext("Editable") + '', + 'error': '' + gettext("Error") + '', + 'validationError': '' + gettext("Validation Error") + '', + 'inProgress': '' + gettext("In Progress") + '', + 'success': '' + gettext("Success") + '', + 'plus': '' + gettext("Placeholder")+ '' }, messages: { @@ -711,18 +711,14 @@ onBeforeUnload: function () { var status = this.getCurrentStatus(); if (status === 'uploading') { - return gettext( - "Upload is in progress. To avoid errors, stay on this page until the process is complete." - ); + return gettext("Upload is in progress. To avoid errors, stay on this page until the process is complete."); } else if (status === 'removing') { - return gettext( - "Removal is in progress. To avoid errors, stay on this page until the process is complete." - ); + return gettext("Removal is in progress. To avoid errors, stay on this page until the process is complete."); } }, bytesToHumanReadable: function (size) { - var units = ['bytes', 'KB', 'MB']; + var units = [gettext('bytes'), gettext('KB'), gettext('MB')]; var i = 0; while(size >= 1024) { size /= 1024; diff --git a/lms/templates/fields/field_dropdown.underscore b/lms/templates/fields/field_dropdown.underscore index 6791340de4..28d7d676f4 100644 --- a/lms/templates/fields/field_dropdown.underscore +++ b/lms/templates/fields/field_dropdown.underscore @@ -1,6 +1,6 @@ <% if (title) { %> <% } %> @@ -20,7 +20,7 @@ <% } else { %> - <%- gettext(screenReaderTitle) %> + <%- screenReaderTitle %> <%- gettext('Click to edit') %> @@ -29,5 +29,5 @@ diff --git a/lms/templates/fields/field_image.underscore b/lms/templates/fields/field_image.underscore index 496c237f6d..4e5b04fe1b 100644 --- a/lms/templates/fields/field_image.underscore +++ b/lms/templates/fields/field_image.underscore @@ -1,5 +1,5 @@