From 297d94a38b18ee18359709825d4df6ff988d0ec1 Mon Sep 17 00:00:00 2001 From: louyihua Date: Tue, 7 Apr 2015 12:56:03 +0800 Subject: [PATCH] Make some strings i18n --- cms/djangoapps/contentstore/views/entrance_exam.py | 6 +++--- cms/djangoapps/contentstore/views/helpers.py | 2 +- cms/static/js/views/video/transcripts/file_uploader.js | 4 ++-- .../js/views/video/transcripts/message_manager.js | 8 ++++---- .../js/views/video/transcripts/metadata_videolist.js | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cms/djangoapps/contentstore/views/entrance_exam.py b/cms/djangoapps/contentstore/views/entrance_exam.py index f163607047..2643ccf15e 100644 --- a/cms/djangoapps/contentstore/views/entrance_exam.py +++ b/cms/djangoapps/contentstore/views/entrance_exam.py @@ -133,7 +133,7 @@ def _create_entrance_exam(request, course_key, entrance_exam_minimum_score_pct=N # Create the entrance exam item (currently it's just a chapter) payload = { 'category': "chapter", - 'display_name': "Entrance Exam", + 'display_name': _("Entrance Exam"), 'parent_locator': unicode(course.location), 'is_entrance_exam': True, 'in_entrance_exam': True, @@ -143,7 +143,7 @@ def _create_entrance_exam(request, course_key, entrance_exam_minimum_score_pct=N parent_locator=parent_locator, user=request.user, category='chapter', - display_name='Entrance Exam', + display_name=_('Entrance Exam'), is_entrance_exam=True ) @@ -177,7 +177,7 @@ def _create_entrance_exam(request, course_key, entrance_exam_minimum_score_pct=N else: description = 'Autogenerated during {} entrance exam creation.'.format(unicode(course.id)) milestone = milestones_helpers.add_milestone({ - 'name': 'Completed Course Entrance Exam', + 'name': _('Completed Course Entrance Exam'), 'namespace': milestone_namespace, 'description': description }) diff --git a/cms/djangoapps/contentstore/views/helpers.py b/cms/djangoapps/contentstore/views/helpers.py index ce65e281ca..9b2b0886df 100644 --- a/cms/djangoapps/contentstore/views/helpers.py +++ b/cms/djangoapps/contentstore/views/helpers.py @@ -145,7 +145,7 @@ def xblock_type_display_name(xblock, default_display_name=None): return _('Unit') component_class = XBlock.load_class(category, select=settings.XBLOCK_SELECT_FUNCTION) if hasattr(component_class, 'display_name') and component_class.display_name.default: - return _(component_class.display_name.default) + return _(component_class.display_name.default) # pylint: disable=translation-of-non-string else: return default_display_name diff --git a/cms/static/js/views/video/transcripts/file_uploader.js b/cms/static/js/views/video/transcripts/file_uploader.js index 7992a53c10..77e967ce92 100644 --- a/cms/static/js/views/video/transcripts/file_uploader.js +++ b/cms/static/js/views/video/transcripts/file_uploader.js @@ -104,7 +104,7 @@ function($, Backbone, _, Utils) { this.upload(); } else { this.options.messenger - .showError('Please select a file in .srt format.'); + .showError(gettext('Please select a file in .srt format.')); } }, @@ -182,7 +182,7 @@ function($, Backbone, _, Utils) { */ xhrCompleteHandler: function (xhr) { var resp = JSON.parse(xhr.responseText), - err = resp.status || 'Error: Uploading failed.', + err = resp.status || gettext('Error: Uploading failed.'), sub = resp.subs; this.$progress diff --git a/cms/static/js/views/video/transcripts/message_manager.js b/cms/static/js/views/video/transcripts/message_manager.js index c314564331..ef15c9d304 100644 --- a/cms/static/js/views/video/transcripts/message_manager.js +++ b/cms/static/js/views/video/transcripts/message_manager.js @@ -140,7 +140,7 @@ function($, Backbone, _, Utils, FileUploader, gettext) { importHandler: function (event) { event.preventDefault(); - this.processCommand('replace', 'Error: Import failed.'); + this.processCommand('replace', gettext('Error: Import failed.')); }, /** @@ -154,7 +154,7 @@ function($, Backbone, _, Utils, FileUploader, gettext) { replaceHandler: function (event) { event.preventDefault(); - this.processCommand('replace', 'Error: Replacing failed.'); + this.processCommand('replace', gettext('Error: Replacing failed.')); }, /** @@ -170,7 +170,7 @@ function($, Backbone, _, Utils, FileUploader, gettext) { var videoId = $(event.currentTarget).data('video-id'); - this.processCommand('choose', 'Error: Choosing failed.', videoId); + this.processCommand('choose', gettext('Error: Choosing failed.'), videoId); }, /** @@ -184,7 +184,7 @@ function($, Backbone, _, Utils, FileUploader, gettext) { useExistingHandler: function (event) { event.preventDefault(); - this.processCommand('rename', 'Error: Choosing failed.'); + this.processCommand('rename', gettext('Error: Choosing failed.')); }, /** diff --git a/cms/static/js/views/video/transcripts/metadata_videolist.js b/cms/static/js/views/video/transcripts/metadata_videolist.js index 88bf36db2c..2cf79aa511 100644 --- a/cms/static/js/views/video/transcripts/metadata_videolist.js +++ b/cms/static/js/views/video/transcripts/metadata_videolist.js @@ -62,7 +62,7 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { showServerError = function (response) { var errorMessage = response.status || - 'Error: Connection with server failed.'; + gettext('Error: Connection with server failed.'); self.messenger .render('not_found') @@ -78,7 +78,7 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { this.messenger .render('not_found') .showError( - 'No sources', + gettext('No sources'), true // hide buttons ); @@ -366,7 +366,7 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { */ checkIsUniqVideoTypes: function (list) { return this.checkIsValid( - this.isUniqVideoTypes, list, 'Link types should be unique.' + this.isUniqVideoTypes, list, gettext('Link types should be unique.') ); }, @@ -379,7 +379,7 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { */ checkIsUniqOtherVideos: function (list) { return this.checkIsValid( - this.isUniqOtherVideos, list, 'Links should be unique.' + this.isUniqOtherVideos, list, gettext('Links should be unique.') ); }, @@ -401,7 +401,7 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { } if (data.mode === 'incorrect' && showErrorModeMessage) { - this.messenger.showError('Incorrect url format.', true); + this.messenger.showError(gettext('Incorrect url format.'), true); return false; }