Fixed gettext references.
TNL-1862
This commit is contained in:
committed by
Andy Armstrong
parent
da57b13b6d
commit
6b91ab4e2b
@@ -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': {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
})
|
||||
},
|
||||
|
||||
@@ -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: ''
|
||||
})
|
||||
|
||||
@@ -19,18 +19,12 @@
|
||||
var accountSettingsLink = '<a href="' + this.options.accountSettingsPageUrl + '">' + gettext('Account Settings page.') + '</a>';
|
||||
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) {
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
tagName: 'div',
|
||||
|
||||
indicators: {
|
||||
'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>',
|
||||
'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>',
|
||||
'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>'
|
||||
'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>',
|
||||
'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>',
|
||||
'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>'
|
||||
},
|
||||
|
||||
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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% if (title) { %>
|
||||
<label class="u-field-title" for="u-field-select-<%- id %>">
|
||||
<%- gettext(title) %>
|
||||
<%- title %>
|
||||
</label>
|
||||
<% } %>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</select>
|
||||
<% } else { %>
|
||||
<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="sr"><%- gettext('Click to edit') %></span>
|
||||
</a>
|
||||
@@ -29,5 +29,5 @@
|
||||
|
||||
<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-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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
<label class="u-field-upload-button">
|
||||
<span class="upload-button-icon" aria-hidden="true"><%= uploadButtonIcon %></span>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<span class="u-field-title" for="u-field-link-<%- id %>">
|
||||
<%- gettext(title) %>
|
||||
<%- title %>
|
||||
</span>
|
||||
<span class="u-field-value">
|
||||
<a id="u-field-link-<%- id %>" href="<%- linkHref %>" aria-describedby="u-field-message-help-<%- id %>">
|
||||
<span class="sr"><%- gettext(screenReaderTitle) %></span>
|
||||
<span class="u-field-link-title-<%- id %>" aria-hidden="true"><%- gettext(linkTitle) %></span>
|
||||
<span class="sr"><%- screenReaderTitle %></span>
|
||||
<span class="u-field-link-title-<%- id %>" aria-hidden="true"><%- linkTitle %></span>
|
||||
</a>
|
||||
</span>
|
||||
<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-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>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<%- gettext(title) %>
|
||||
</label>
|
||||
<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 class="u-field-message" id="u-field-message-<%- id %>">
|
||||
<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>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<%- gettext(title) %>
|
||||
</label>
|
||||
<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 class="u-field-message" id="u-field-message-<%- id %>">
|
||||
<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>
|
||||
|
||||
@@ -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>
|
||||
<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-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>
|
||||
</div>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
if (mode === 'edit') {
|
||||
%><textarea id="u-field-textarea-<%- id %>" rows="4" aria-describedby="u-field-placeholder-value-<%- id %>"><%- value %></textarea><%
|
||||
} 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>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<div class="profile-section-two-fields">
|
||||
<% if (!showFullProfile) { %>
|
||||
<% 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 { %>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user