Commit fc0cae91 by Muhammad Shoaib

internationalize the strings

parent 3e2d70ea
var edx = edx || {}; var edx = edx || {};
(function (Backbone, $, _) { (function (Backbone, $, _, gettext) {
'use strict'; 'use strict';
edx.instructor_dashboard = edx.instructor_dashboard || {}; edx.instructor_dashboard = edx.instructor_dashboard || {};
...@@ -116,7 +116,7 @@ var edx = edx || {}; ...@@ -116,7 +116,7 @@ var edx = edx || {};
$.each(values, function(key, value) { $.each(values, function(key, value) {
if (value==="") { if (value==="") {
formHasErrors = true; formHasErrors = true;
self.showError(self, key, "Required field"); self.showError(self, key, gettext("Required field"));
} }
else { else {
self.hideError(self, key); self.hideError(self, key);
...@@ -144,7 +144,7 @@ var edx = edx || {}; ...@@ -144,7 +144,7 @@ var edx = edx || {};
}, },
error: function(self, response, options) { error: function(self, response, options) {
var data = $.parseJSON(response.responseText); var data = $.parseJSON(response.responseText);
error_response.html(data.detail); error_response.html(gettext(data.detail));
} }
}); });
} }
...@@ -167,4 +167,4 @@ var edx = edx || {}; ...@@ -167,4 +167,4 @@ var edx = edx || {};
return this; return this;
} }
}); });
}).call(this, Backbone, $, _); }).call(this, Backbone, $, _, gettext);
...@@ -17,8 +17,8 @@ var edx = edx || {}; ...@@ -17,8 +17,8 @@ var edx = edx || {};
/* this should be moved to a 'data' attribute in HTML */ /* this should be moved to a 'data' attribute in HTML */
this.tempate_url = '/static/proctoring/templates/course_allowances.underscore'; this.tempate_url = '/static/proctoring/templates/course_allowances.underscore';
this.template = null; this.template = null;
this.allowance_url = this.collection.url + 'allowance';
this.initial_url = this.collection.url; this.initial_url = this.collection.url;
this.allowance_url = this.initial_url + 'allowance';
/* re-render if the model changes */ /* re-render if the model changes */
this.listenTo(this.collection, 'change', this.collectionChanged); this.listenTo(this.collection, 'change', this.collectionChanged);
......
<div class='modal-header'>Add a new Allowance</div> <div class='modal-header'><%- gettext("Add a new Allowance") %></div>
<form> <form>
<h3 class='error-response'><h3> <h3 class='error-response'><h3>
<table class='compact'> <table class='compact'>
<tr> <tr>
<td> <td>
<label>Proctored Exam</label> <label><%- gettext("Proctored Exam") %></label>
</td> </td>
<td> <td>
<select id='proctored_exam'> <select id='proctored_exam'>
<% _.each(proctored_exams, function(proctored_exam){ %> <% _.each(proctored_exams, function(proctored_exam){ %>
<option value="<%= proctored_exam.id %>"><%= proctored_exam.exam_name %></option> <option value="<%= proctored_exam.id %>">
<%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam.exam_name }, true) %>
</option>
<% }); %> <% }); %>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label>Allowance Type</label> <label><%- gettext("Allowance Type") %></label>
</td> </td>
<td> <td>
<select id="allowance_type"> <select id="allowance_type">
<% _.each(allowance_types, function(allowance_type){ %> <% _.each(allowance_types, function(allowance_type){ %>
<option value="<%= allowance_type %>"><%= allowance_type %></option> <option value="<%= allowance_type %>">
<%- interpolate(gettext(' %(allowance_type)s '), { allowance_type: allowance_type }, true) %>
</option>
<% }); %> <% }); %>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label>Value</label> <label><%- gettext("Value") %></label>
</td> </td>
<td> <td>
<input type="text" id="allowance_value" /> <input type="text" id="allowance_value" />
...@@ -36,7 +40,7 @@ ...@@ -36,7 +40,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<label>Username or Email</label> <label><%- gettext("Username or Email") %></label>
</td> </td>
<td> <td>
<input type="text" id="user_info" /> <input type="text" id="user_info" />
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<td> <td>
<a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>" <a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>"
data-key-name="<%= proctored_exam_allowance.key %>" data-key-name="<%= proctored_exam_allowance.key %>"
data-user-id="<%= proctored_exam_allowance.user_id %>" data-user-id="<%= proctored_exam_allowance.user.id %>"
class="remove_allowance" href="#">[x]</a> class="remove_allowance" href="#">[x]</a>
</td> </td>
</tr> </tr>
......
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