Commit 6b91ab4e by muhammad-ammar Committed by Andy Armstrong

Fixed gettext references.

TNL-1862
parent da57b13b
...@@ -339,7 +339,7 @@ def account_settings_context(request): ...@@ -339,7 +339,7 @@ def account_settings_context(request):
user = request.user user = request.user
country_options = [ country_options = [
(country_code, unicode(country_name)) (country_code, _(country_name)) # pylint: disable=translation-of-non-string
for country_code, country_name in sorted( for country_code, country_name in sorted(
countries.countries, key=lambda(__, name): unicode(name) countries.countries, key=lambda(__, name): unicode(name)
) )
...@@ -354,11 +354,11 @@ def account_settings_context(request): ...@@ -354,11 +354,11 @@ def account_settings_context(request):
'country': { 'country': {
'options': country_options, 'options': country_options,
}, 'gender': { }, 'gender': {
'options': UserProfile.GENDER_CHOICES, 'options': [(choice[0], _(choice[1])) for choice in UserProfile.GENDER_CHOICES], # pylint: disable=translation-of-non-string
}, 'language': { }, 'language': {
'options': released_languages(), 'options': released_languages(),
}, 'level_of_education': { }, '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': { }, 'password': {
'url': reverse('password_reset'), 'url': reverse('password_reset'),
}, 'year_of_birth': { }, 'year_of_birth': {
......
...@@ -12,6 +12,8 @@ from django.views.decorators.http import require_http_methods ...@@ -12,6 +12,8 @@ from django.views.decorators.http import require_http_methods
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
from student.models import User from student.models import User
from django.utils.translation import ugettext as _
@login_required @login_required
@require_http_methods(['GET']) @require_http_methods(['GET'])
...@@ -55,10 +57,9 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff) ...@@ -55,10 +57,9 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff)
ObjectDoesNotExist: the specified profile_username does not exist. ObjectDoesNotExist: the specified profile_username does not exist.
""" """
profile_user = User.objects.get(username=profile_username) profile_user = User.objects.get(username=profile_username)
language_options = [language for language in settings.ALL_LANGUAGES]
country_options = [ country_options = [
(country_code, unicode(country_name)) (country_code, _(country_name)) # pylint: disable=translation-of-non-string
for country_code, country_name in sorted( for country_code, country_name in sorted(
countries.countries, key=lambda(__, name): unicode(name) countries.countries, key=lambda(__, name): unicode(name)
) )
...@@ -78,7 +79,7 @@ def learner_profile_context(logged_in_username, profile_username, user_is_staff) ...@@ -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), 'has_preferences_access': (logged_in_username == profile_username or user_is_staff),
'own_profile': (logged_in_username == profile_username), 'own_profile': (logged_in_username == profile_username),
'country_options': country_options, 'country_options': country_options,
'language_options': language_options, 'language_options': settings.ALL_LANGUAGES,
} }
} }
......
...@@ -37,10 +37,7 @@ ...@@ -37,10 +37,7 @@
model: userAccountModel, model: userAccountModel,
title: gettext('Full Name'), title: gettext('Full Name'),
valueAttribute: 'name', valueAttribute: 'name',
helpMessage: gettext( helpMessage: gettext('The name that appears on your edX certificates. Other learners never see your full name.')
'The name that appears on your edX certificates. Other learners never see ' +
'your full name.'
)
}) })
}, },
{ {
...@@ -48,10 +45,7 @@ ...@@ -48,10 +45,7 @@
model: userAccountModel, model: userAccountModel,
title: gettext('Email Address'), title: gettext('Email Address'),
valueAttribute: 'email', valueAttribute: 'email',
helpMessage: gettext( helpMessage: gettext('The email address you use to sign in to edX. Communications from edX and your courses are sent to this address.')
'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 @@ ...@@ -62,24 +56,19 @@
valueAttribute: 'password', valueAttribute: 'password',
emailAttribute: 'email', emailAttribute: 'email',
linkTitle: gettext('Reset Password'), linkTitle: gettext('Reset Password'),
linkHref: fieldsData['password']['url'], linkHref: fieldsData.password.url,
helpMessage: gettext( 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.')
'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({ view: new AccountSettingsFieldViews.LanguagePreferenceFieldView({
model: userPreferencesModel, model: userPreferencesModel,
title: 'Language', title: gettext('Language'),
valueAttribute: 'pref-lang', valueAttribute: 'pref-lang',
required: true, required: true,
refreshPageOnSave: true, refreshPageOnSave: true,
helpMessage: gettext( helpMessage:
'The language used for the edX site. The site is currently available in a ' + gettext('The language used for the edX site. The site is currently available in a limited number of languages.'),
'limited number of languages.'
),
options: fieldsData.language.options options: fieldsData.language.options
}) })
}, },
......
...@@ -95,10 +95,7 @@ ...@@ -95,10 +95,7 @@
editable: editable, editable: editable,
showMessages: false, showMessages: false,
title: gettext('About me'), title: gettext('About me'),
placeholderValue: gettext( 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."),
"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", valueAttribute: "bio",
helpMessage: '' helpMessage: ''
}) })
......
...@@ -19,18 +19,12 @@ ...@@ -19,18 +19,12 @@
var accountSettingsLink = '<a href="' + this.options.accountSettingsPageUrl + '">' + gettext('Account Settings page.') + '</a>'; var accountSettingsLink = '<a href="' + this.options.accountSettingsPageUrl + '">' + gettext('Account Settings page.') + '</a>';
if (this.profileIsPrivate) { if (this.profileIsPrivate) {
this._super(interpolate_text( this._super(interpolate_text(
gettext( 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}"),
"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} {'account_settings_page_link': accountSettingsLink}
)); ));
} else if (this.requiresParentalConsent) { } else if (this.requiresParentalConsent) {
this._super(interpolate_text( this._super(interpolate_text(
gettext( 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}'),
'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} {'account_settings_page_link': accountSettingsLink}
)); ));
} }
...@@ -55,7 +49,9 @@ ...@@ -55,7 +49,9 @@
}, },
imageAltText: function () { 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) { imageChangeSucceeded: function (e, data) {
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
tagName: 'div', tagName: 'div',
indicators: { indicators: {
'canEdit': '<i class="icon fa fa-pencil message-can-edit" aria-hidden="true"></i><span class="sr">gettext("Editable")</span>', 'canEdit': '<i class="icon fa fa-pencil message-can-edit" aria-hidden="true"></i><span class="sr">' + gettext("Editable") + '</span>',
'error': '<i class="fa fa-exclamation-triangle message-error" aria-hidden="true"></i><span class="sr">gettext("Error")</span>', 'error': '<i class="fa fa-exclamation-triangle message-error" aria-hidden="true"></i><span class="sr">' + gettext("Error") + '</span>',
'validationError': '<i class="fa fa-exclamation-triangle message-validation-error" aria-hidden="true"></i><span class="sr">gettext("Validation Error")</span>', 'validationError': '<i class="fa fa-exclamation-triangle message-validation-error" aria-hidden="true"></i><span class="sr">' + gettext("Validation Error") + '</span>',
'inProgress': '<i class="fa fa-spinner fa-pulse message-in-progress" aria-hidden="true"></i><span class="sr">gettext("In Progress")</span>', 'inProgress': '<i class="fa fa-spinner fa-pulse message-in-progress" aria-hidden="true"></i><span class="sr">' + gettext("In Progress") + '</span>',
'success': '<i class="fa fa-check message-success" aria-hidden="true"></i><span class="sr">gettext("Success")</span>', 'success': '<i class="fa fa-check message-success" aria-hidden="true"></i><span class="sr">' + gettext("Success") + '</span>',
'plus': '<i class="fa fa-plus placeholder" aria-hidden="true"></i><span class="sr">gettext("Placeholder")</span>' 'plus': '<i class="fa fa-plus placeholder" aria-hidden="true"></i><span class="sr">' + gettext("Placeholder")+ '</span>'
}, },
messages: { messages: {
...@@ -711,18 +711,14 @@ ...@@ -711,18 +711,14 @@
onBeforeUnload: function () { onBeforeUnload: function () {
var status = this.getCurrentStatus(); var status = this.getCurrentStatus();
if (status === 'uploading') { if (status === 'uploading') {
return gettext( return gettext("Upload is in progress. To avoid errors, stay on this page until the process is complete.");
"Upload is in progress. To avoid errors, stay on this page until the process is complete."
);
} else if (status === 'removing') { } else if (status === 'removing') {
return gettext( return gettext("Removal is in progress. To avoid errors, stay on this page until the process is complete.");
"Removal is in progress. To avoid errors, stay on this page until the process is complete."
);
} }
}, },
bytesToHumanReadable: function (size) { bytesToHumanReadable: function (size) {
var units = ['bytes', 'KB', 'MB']; var units = [gettext('bytes'), gettext('KB'), gettext('MB')];
var i = 0; var i = 0;
while(size >= 1024) { while(size >= 1024) {
size /= 1024; size /= 1024;
......
<% if (title) { %> <% if (title) { %>
<label class="u-field-title" for="u-field-select-<%- id %>"> <label class="u-field-title" for="u-field-select-<%- id %>">
<%- gettext(title) %> <%- title %>
</label> </label>
<% } %> <% } %>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</select> </select>
<% } else { %> <% } else { %>
<a href="#" class="u-field-value-display"> <a href="#" class="u-field-value-display">
<span class="sr"><%- gettext(screenReaderTitle) %></span> <span class="sr"><%- screenReaderTitle %></span>
<span class="u-field-value-readonly"></span> <span class="u-field-value-readonly"></span>
<span class="sr"><%- gettext('Click to edit') %></span> <span class="sr"><%- gettext('Click to edit') %></span>
</a> </a>
...@@ -29,5 +29,5 @@ ...@@ -29,5 +29,5 @@
<span class="u-field-message" id="u-field-message-<%- id %>"> <span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span> <span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-help-message-<%- id %>"><%- gettext(message) %></span> <span class="u-field-message-help" id="u-field-help-message-<%- id %>"><%- message %></span>
</span> </span>
<div class="image-wrapper"> <div class="image-wrapper">
<img class="image-frame" src="<%- gettext(imageUrl) %>" alt="<%=imageAltText%>"/> <img class="image-frame" src="<%- imageUrl %>" alt="<%=imageAltText%>"/>
<div class="u-field-actions"> <div class="u-field-actions">
<label class="u-field-upload-button"> <label class="u-field-upload-button">
<span class="upload-button-icon" aria-hidden="true"><%= uploadButtonIcon %></span> <span class="upload-button-icon" aria-hidden="true"><%= uploadButtonIcon %></span>
......
<span class="u-field-title" for="u-field-link-<%- id %>"> <span class="u-field-title" for="u-field-link-<%- id %>">
<%- gettext(title) %> <%- title %>
</span> </span>
<span class="u-field-value"> <span class="u-field-value">
<a id="u-field-link-<%- id %>" href="<%- linkHref %>" aria-describedby="u-field-message-help-<%- id %>"> <a id="u-field-link-<%- id %>" href="<%- linkHref %>" aria-describedby="u-field-message-help-<%- id %>">
<span class="sr"><%- gettext(screenReaderTitle) %></span> <span class="sr"><%- screenReaderTitle %></span>
<span class="u-field-link-title-<%- id %>" aria-hidden="true"><%- gettext(linkTitle) %></span> <span class="u-field-link-title-<%- id %>" aria-hidden="true"><%- linkTitle %></span>
</a> </a>
</span> </span>
<span class="u-field-message" id="u-field-message-<%- id %>"> <span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span> <span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"><%- gettext(message) %></span> <span class="u-field-message-help" id="u-field-message-help-<%- id %>"><%- message %></span>
</span> </span>
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<%- gettext(title) %> <%- gettext(title) %>
</label> </label>
<span class="u-field-value"> <span class="u-field-value">
<input id="u-field-input-<%- id %>" aria-describedby="u-field-message-<%- id %>" type="text" name="input" readonly=true value="<%- gettext(value) %>"> <input id="u-field-input-<%- id %>" aria-describedby="u-field-message-<%- id %>" type="text" name="input" readonly=true value="<%- value %>">
</span> </span>
<span class="u-field-message" id="u-field-message-<%- id %>"> <span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span> <span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-help-message-<%- id %>"> <%- gettext(message) %></span> <span class="u-field-message-help" id="u-field-help-message-<%- id %>"> <%- message %></span>
</span> </span>
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<%- gettext(title) %> <%- gettext(title) %>
</label> </label>
<span class="u-field-value"> <span class="u-field-value">
<input id="u-field-input-<%- id %>" aria-describedby="u-field-message-help-<%- id %>" type="text" name="input" value="<%- gettext(value) %>"> <input id="u-field-input-<%- id %>" aria-describedby="u-field-message-help-<%- id %>" type="text" name="input" value="<%- value %>">
</span> </span>
<span class="u-field-message" id="u-field-message-<%- id %>"> <span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span> <span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- gettext(message) %></span> <span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- message %></span>
</span> </span>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<label class="u-field-title" for="u-field-textarea-<%- id %>" id="u-field-title-<%- id %>" aria-describedby="u-field-message-help-<%- id %>"></label> <label class="u-field-title" for="u-field-textarea-<%- id %>" id="u-field-title-<%- id %>" aria-describedby="u-field-message-help-<%- id %>"></label>
<span class="u-field-message" id="u-field-message-<%- id %>"> <span class="u-field-message" id="u-field-message-<%- id %>">
<span class="u-field-message-notification" aria-live="polite"></span> <span class="u-field-message-notification" aria-live="polite"></span>
<span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- gettext(message) %></span> <span class="u-field-message-help" id="u-field-message-help-<%- id %>"> <%- message %></span>
</span> </span>
</div> </div>
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
if (mode === 'edit') { if (mode === 'edit') {
%><textarea id="u-field-textarea-<%- id %>" rows="4" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></textarea><% %><textarea id="u-field-textarea-<%- id %>" rows="4" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></textarea><%
} else { } else {
%><a href="#" class="u-field-value-display"><span class="sr"><%- gettext(screenReaderTitle) %></span><span class="u-field-value-readonly" aria-hidden="false" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></span><span class="sr"><%- gettext('Click to edit') %></span></a><% %><a href="#" class="u-field-value-display"><span class="sr"><%- screenReaderTitle %></span><span class="u-field-value-readonly" aria-hidden="false" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></span><span class="sr"><%- gettext('Click to edit') %></span></a><%
} }
%><span class="sr" id="u-field-placeholder-value-<%- id %>"><%- gettext(placeholderValue) %></span> %><span class="sr" id="u-field-placeholder-value-<%- id %>"><%- placeholderValue %></span>
</div> </div>
</div> </div>
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
<div class="profile-section-two-fields"> <div class="profile-section-two-fields">
<% if (!showFullProfile) { %> <% if (!showFullProfile) { %>
<% if(ownProfile) { %> <% if(ownProfile) { %>
<span class="profile-private--message"><%- gettext("You are currently sharing a limited profile.") %></span> <span class="profile-private--message" tabindex="0"><%- gettext("You are currently sharing a limited profile.") %></span>
<% } else { %> <% } else { %>
<span class="profile-private--message"><%- gettext("This edX learner is currently sharing a limited profile.") %></span> <span class="profile-private--message" tabindex="0"><%- gettext("This edX learner is currently sharing a limited profile.") %></span>
<% } %> <% } %>
<% } %> <% } %>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment