Commit 7c1e6d83 by Carson Gee

Fix message handling to be more internationalizable

parent b3ec4d1b
...@@ -108,7 +108,7 @@ class StaffDebugTest(UniqueCourseTest): ...@@ -108,7 +108,7 @@ class StaffDebugTest(UniqueCourseTest):
msg = staff_debug_page.idash_msg[0] msg = staff_debug_page.idash_msg[0]
# Since we aren't running celery stuff, this will fail badly # Since we aren't running celery stuff, this will fail badly
# for now, but is worth excercising that bad of a response # for now, but is worth excercising that bad of a response
self.assertEqual(u'Unsuccessfully rescored problem. ' self.assertEqual(u'Failed to rescore problem. '
'Unknown Error Occurred.', msg) 'Unknown Error Occurred.', msg)
def test_student_state_delete(self): def test_student_state_delete(self):
...@@ -147,5 +147,5 @@ class StaffDebugTest(UniqueCourseTest): ...@@ -147,5 +147,5 @@ class StaffDebugTest(UniqueCourseTest):
staff_debug_page = staff_page.open_staff_debug_info() staff_debug_page = staff_page.open_staff_debug_info()
staff_debug_page.delete_state('INVALIDUSER') staff_debug_page.delete_state('INVALIDUSER')
msg = staff_debug_page.idash_msg[0] msg = staff_debug_page.idash_msg[0]
self.assertEqual(u'Unsuccessfully deleted student state. ' self.assertEqual(u'Failed to delete student state. '
'User does not exist.', msg) 'User does not exist.', msg)
...@@ -31,11 +31,8 @@ var StaffDebug = (function(){ ...@@ -31,11 +31,8 @@ var StaffDebug = (function(){
data: pdata, data: pdata,
success: function(data){ success: function(data){
var text = _.template( var text = _.template(
gettext('Successfully {action} for user {user}'), action.success_msg,
{ {user: data.student},
action: action.description,
user: data.student
},
{interpolate: /\{(.+?)\}/g} {interpolate: /\{(.+?)\}/g}
) )
var html = _.template( var html = _.template(
...@@ -53,10 +50,10 @@ var StaffDebug = (function(){ ...@@ -53,10 +50,10 @@ var StaffDebug = (function(){
response_json = { error: gettext('Unknown Error Occurred.') }; response_json = { error: gettext('Unknown Error Occurred.') };
} }
var text = _.template( var text = _.template(
gettext('Unsuccessfully {action}. {error}'), '{error_msg} {error}',
{ {
error: response_json.error, error_msg: action.error_msg,
action: action.description error: response_json.error
}, },
{interpolate: /\{(.+?)\}/g} {interpolate: /\{(.+?)\}/g}
) )
...@@ -75,7 +72,8 @@ var StaffDebug = (function(){ ...@@ -75,7 +72,8 @@ var StaffDebug = (function(){
this.do_idash_action({ this.do_idash_action({
location: locname, location: locname,
method: 'reset_student_attempts', method: 'reset_student_attempts',
description: gettext('reset the attempts'), success_msg: gettext('Successfully reset the attempts for user {user}'),
error_msg: gettext('Failed to reset attempts.'),
delete_module: false delete_module: false
}); });
} }
...@@ -84,7 +82,8 @@ var StaffDebug = (function(){ ...@@ -84,7 +82,8 @@ var StaffDebug = (function(){
this.do_idash_action({ this.do_idash_action({
location: locname, location: locname,
method: 'reset_student_attempts', method: 'reset_student_attempts',
description: gettext('deleted student state'), success_msg: gettext('Successfully deleted student state for user {user}'),
error_msg: gettext('Failed to delete student state.'),
delete_module: true delete_module: true
}); });
} }
...@@ -93,7 +92,8 @@ var StaffDebug = (function(){ ...@@ -93,7 +92,8 @@ var StaffDebug = (function(){
this.do_idash_action({ this.do_idash_action({
location: locname, location: locname,
method: 'rescore_problem', method: 'rescore_problem',
description: gettext('rescored problem'), success_msg: gettext('Successfully rescored problem for user {user}'),
error_msg: gettext('Failed to rescore problem.'),
delete_module: false delete_module: false
}); });
} }
......
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