Removing JS gettext() in favor of server-side substitution.
[LMS-1680]
This commit is contained in:
committed by
Sarina Canelake
parent
eeb5f81272
commit
ff192935d8
@@ -18,13 +18,14 @@
|
||||
|
||||
<%block name="jsextra">
|
||||
<script type="text/javascript">
|
||||
require(["domReady", "jquery", "gettext", "js/models/asset", "js/collections/asset",
|
||||
require(["domReady", "jquery", "js/models/asset", "js/collections/asset",
|
||||
"js/views/assets", "js/views/feedback_prompt",
|
||||
"js/views/feedback_notification", "js/views/paging_header", "js/views/paging_footer",
|
||||
"js/utils/modal", "jquery.fileupload"],
|
||||
function(domReady, $, gettext, AssetModel, AssetCollection, AssetsView, PromptView, NotificationView,
|
||||
function(domReady, $, AssetModel, AssetCollection, AssetsView, PromptView, NotificationView,
|
||||
PagingHeader, PagingFooter, ModalUtils) {
|
||||
var assets = new AssetCollection();
|
||||
|
||||
assets.url = "${asset_callback_url}";
|
||||
var assetsView = new AssetsView({collection: assets, el: $('#asset-library')});
|
||||
assetsView.render();
|
||||
@@ -74,7 +75,7 @@ require(["domReady", "jquery", "gettext", "js/models/asset", "js/collections/ass
|
||||
var startUpload = function (e) {
|
||||
var file = e.target.value;
|
||||
|
||||
$('.upload-modal h1').html(gettext('Uploading…'));
|
||||
$('.upload-modal h1').text("${_(u'Uploading…')}");
|
||||
$('.upload-modal .file-name').html(file.substring(file.lastIndexOf("\\") + 1));
|
||||
$('.upload-modal .choose-file-button').hide();
|
||||
$('.upload-modal .progress-bar').removeClass('loaded').show();
|
||||
@@ -90,7 +91,7 @@ require(["domReady", "jquery", "gettext", "js/models/asset", "js/collections/ass
|
||||
|
||||
$('.upload-modal .file-name').show();
|
||||
$('.upload-modal .file-name').html('');
|
||||
$('.upload-modal .choose-file-button').html(gettext('Choose File'));
|
||||
$('.upload-modal .choose-file-button').text("${_('Choose File')}");
|
||||
$('.upload-modal .embeddable-xml-input').val('');
|
||||
$('.upload-modal .embeddable').hide();
|
||||
};
|
||||
@@ -104,12 +105,12 @@ require(["domReady", "jquery", "gettext", "js/models/asset", "js/collections/ass
|
||||
var displayFinishedUpload = function (resp) {
|
||||
var asset = resp.asset;
|
||||
|
||||
$('.upload-modal h1').html(gettext('Upload New File'));
|
||||
$('.upload-modal h1').text("${_('Upload New File')}");
|
||||
$('.upload-modal .embeddable-xml-input').val(asset.portable_url);
|
||||
$('.upload-modal .embeddable').show();
|
||||
$('.upload-modal .file-name').hide();
|
||||
$('.upload-modal .progress-fill').html(resp.msg);
|
||||
$('.upload-modal .choose-file-button').html(gettext('Load Another File')).show();
|
||||
$('.upload-modal .choose-file-button').text("${_('Load Another File')}").show();
|
||||
$('.upload-modal .progress-fill').width('100%');
|
||||
|
||||
assetsView.addAsset(new AssetModel(asset));
|
||||
|
||||
@@ -34,7 +34,7 @@ require(["js/models/section", "js/collections/textbook", "js/views/list_textbook
|
||||
$(window).on("beforeunload", function() {
|
||||
var dirty = textbooks.find(function(textbook) { return textbook.isDirty(); });
|
||||
if(dirty) {
|
||||
return gettext("You have unsaved changes. Do you really want to leave this page?");
|
||||
return "${_('You have unsaved changes. Do you really want to leave this page?')}";
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -144,7 +144,7 @@ FEATURES = {
|
||||
# Enables the student notes API and UI.
|
||||
'ENABLE_STUDENT_NOTES': True,
|
||||
|
||||
# Provide a UI to allow users to submit feedback from the LMS
|
||||
# Provide a UI to allow users to submit feedback from the LMS (left-hand help modal)
|
||||
'ENABLE_FEEDBACK_SUBMISSION': False,
|
||||
|
||||
# Turn on a page that lets staff enter Python code to be run in the
|
||||
|
||||
@@ -60,14 +60,14 @@ discussion_link = get_discussion_link(course) if course else None
|
||||
<form id="feedback_form" class="feedback_form" method="post" data-remote="true" action="/submit_feedback">
|
||||
<div id="feedback_error" class="modal-form-error" tabindex="-1"></div>
|
||||
% if not user.is_authenticated():
|
||||
<label data-field="name" for="feedback_form_name">${_('Name*')}</label>
|
||||
<label data-field="name" for="feedback_form_name">${_('Name')}*</label>
|
||||
<input name="name" type="text" id="feedback_form_name" aria-required="true">
|
||||
<label data-field="email" for="feedback_form_email">${_('E-mail*')}</label>
|
||||
<label data-field="email" for="feedback_form_email">${_('E-mail')}*</label>
|
||||
<input name="email" type="text" id="feedback_form_email" aria-required="true">
|
||||
% endif
|
||||
<label data-field="subject" for="feedback_form_subject">${_('Briefly describe your issue*')}</label>
|
||||
<label data-field="subject" for="feedback_form_subject">${_('Briefly describe your issue')}*</label>
|
||||
<input name="subject" type="text" id="feedback_form_subject" aria-required="true">
|
||||
<label data-field="details" for="feedback_form_details">${_('Tell us the details*')}
|
||||
<label data-field="details" for="feedback_form_details">${_('Tell us the details')}*
|
||||
<span class="tip">${_('Include error messages, steps which lead to the issue, etc')}</span></label>
|
||||
<textarea name="details" id="feedback_form_details" aria-required="true"></textarea>
|
||||
<input name="issue_type" type="hidden">
|
||||
@@ -75,7 +75,7 @@ discussion_link = get_discussion_link(course) if course else None
|
||||
<input name="course_id" type="hidden" value="${course.id | h}">
|
||||
% endif
|
||||
<div class="submit">
|
||||
<input name="submit" type="submit" value="Submit" id="feedback_submit">
|
||||
<input name="submit" type="submit" value="${_('Submit')}" id="feedback_submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -168,29 +168,29 @@ discussion_link = get_discussion_link(course) if course else None
|
||||
$("#feedback_link_problem").click(function(event) {
|
||||
showFeedback(
|
||||
event,
|
||||
gettext("problem"),
|
||||
gettext("Report a Problem"),
|
||||
gettext("Brief description of the problem*"),
|
||||
gettext("Details of the problem you are encountering*") + "<span class='tip'>" +
|
||||
gettext("Include error messages, steps which lead to the issue, etc.") + "</span>"
|
||||
"${_('problem')}",
|
||||
"${_('Report a Problem')}",
|
||||
"${_('Brief description of the problem')}" + "*",
|
||||
"${_('Details of the problem you are encountering')}" + "*" + "<span class='tip'>" +
|
||||
"${_('Include error messages, steps which lead to the issue, etc.')}" + "</span>"
|
||||
);
|
||||
});
|
||||
$("#feedback_link_suggestion").click(function(event) {
|
||||
showFeedback(
|
||||
event,
|
||||
gettext("suggestion"),
|
||||
gettext("Make a Suggestion"),
|
||||
gettext("Brief description of your suggestion*"),
|
||||
gettext("Details*")
|
||||
"${_('suggestion')}",
|
||||
"${_('Make a Suggestion')}",
|
||||
"${_('Brief description of your suggestion')}" + "*",
|
||||
"${_('Details')}" + "*"
|
||||
);
|
||||
});
|
||||
$("#feedback_link_question").click(function(event) {
|
||||
showFeedback(
|
||||
event,
|
||||
gettext("question"),
|
||||
gettext("Ask a Question"),
|
||||
gettext("Brief summary of your question*"),
|
||||
gettext("Details*")
|
||||
"${_('question')}",
|
||||
"${_('Ask a Question')}",
|
||||
"${_('Brief summary of your question')}" + "*",
|
||||
"${_('Details')}" + "*"
|
||||
);
|
||||
});
|
||||
$("#feedback_form").submit(function() {
|
||||
@@ -218,16 +218,16 @@ discussion_link = get_discussion_link(course) if course else None
|
||||
$("#feedback_error").html(responseData.error).stop().css("display", "block");
|
||||
} else {
|
||||
// If no data (or malformed data) is returned, a server error occurred
|
||||
htmlStr = gettext("An error has occurred.");
|
||||
htmlStr = "${_('An error has occurred.')}";
|
||||
% if settings.FEEDBACK_SUBMISSION_EMAIL:
|
||||
htmlStr += " " + _.template(
|
||||
gettext("Please {link_start}send us e-mail{link_end}."),
|
||||
"${_('Please {link_start}send us e-mail{link_end}.')}",
|
||||
{link_start: '<a href="#" id="feedback_email">', link_end: '</a>'},
|
||||
{interpolate: /\{(.+?)\}/g})
|
||||
% else:
|
||||
// If no email is configured, we can't do much other than
|
||||
// ask the user to try again later
|
||||
htmlStr += gettext(" Please try again later.");
|
||||
htmlStr += "${_('Please try again later.')}";
|
||||
% endif
|
||||
$("#feedback_error").html(htmlStr).stop().css("display", "block");
|
||||
% if settings.FEEDBACK_SUBMISSION_EMAIL:
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
$submitButton.
|
||||
addClass('is-disabled').
|
||||
prop('disabled', true).
|
||||
html("${_(u'Processing your account information…')}");
|
||||
text("${_(u'Processing your account information…')}");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
$(function() {
|
||||
var form = $("#disable-form");
|
||||
$("#submit-form").click(function(){
|
||||
$("#account-change-status").html(gettext("working..."));
|
||||
$("#account-change-status").text("${_('working...')}");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
|
||||
@@ -70,13 +70,13 @@
|
||||
$submitButton.
|
||||
removeClass('is-disabled').
|
||||
removeProp('disabled').
|
||||
html("${_('Update my {platform_name} Account').format(platform_name=settings.PLATFORM_NAME)}");
|
||||
text("${_('Update my {platform_name} Account').format(platform_name=settings.PLATFORM_NAME)}");
|
||||
}
|
||||
else {
|
||||
$submitButton.
|
||||
addClass('is-disabled').
|
||||
prop('disabled', true).
|
||||
html(gettext('Processing your account information …'));
|
||||
text("${_(u'Processing your account information …')}");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -76,13 +76,13 @@
|
||||
$submitButton.
|
||||
removeClass('is-disabled').
|
||||
removeProp('disabled').
|
||||
html("${_('Create My {platform_name} Account').format(platform_name=settings.PLATFORM_NAME)}");
|
||||
text("${_('Create My {platform_name} Account').format(platform_name=settings.PLATFORM_NAME)}");
|
||||
}
|
||||
else {
|
||||
$submitButton.
|
||||
addClass('is-disabled').
|
||||
prop('disabled', true).
|
||||
html(gettext('Processing your account information …'));
|
||||
text("${_(u'Processing your account information…')}");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user