From 46342a3f48676026f22686b77bd69e01c12585c9 Mon Sep 17 00:00:00 2001 From: louyihua Date: Wed, 1 Apr 2015 01:23:36 +0800 Subject: [PATCH] Fix string extraction error in underscore files The written style ```interpolate(gettext('some text'), {...}, ...)``` will will cause the string inside gettext() not be extracted. So a separate line is needed for ```gettext``` when gettext function is directly called inside a call to the interpolate function. --- cms/templates/js/course-outline.underscore | 15 ++++++++++++--- cms/templates/js/list.underscore | 10 ++++++++-- cms/templates/js/publish-xblock.underscore | 8 ++++++-- cms/templates/js/xblock-outline.underscore | 15 ++++++++++++--- .../courseware_search/search_list.underscore | 6 +++++- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/cms/templates/js/course-outline.underscore b/cms/templates/js/course-outline.underscore index b9507426a2..97fe255516 100644 --- a/cms/templates/js/course-outline.underscore +++ b/cms/templates/js/course-outline.underscore @@ -44,7 +44,10 @@ if (xblockInfo.get('graded')) {
<% if (includesChildren) { %>

+ title="<%= interpolate( + gettext('Collapse/Expand this %(xblock_type)s'), { xblock_type: xblockTypeDisplayName }, true + ) %>" + > <% } else { %>

@@ -156,7 +159,10 @@ if (xblockInfo.get('graded')) {

<%= gettext("You haven't added any content to this course yet.") %> + title="<%= interpolate( + gettext('Click to add a new %(xblock_type)s'), { xblock_type: defaultNewChildName }, true + ) %>" + > <%= addChildLabel %>

@@ -174,7 +180,10 @@ if (xblockInfo.get('graded')) { diff --git a/cms/templates/js/list.underscore b/cms/templates/js/list.underscore index 9bf7550aa7..6ee461c6da 100644 --- a/cms/templates/js/list.underscore +++ b/cms/templates/js/list.underscore @@ -2,14 +2,20 @@ <% } else { %>
<% if (!isEditing) { %> <% } %> <% } %> diff --git a/cms/templates/js/publish-xblock.underscore b/cms/templates/js/publish-xblock.underscore index 8d40947443..6fcf7827cd 100644 --- a/cms/templates/js/publish-xblock.underscore +++ b/cms/templates/js/publish-xblock.underscore @@ -48,7 +48,9 @@ var visibleToStaffOnly = visibilityState === 'staff_only'; <% if (releaseDate) { %> <%= releaseDate %> - <%= interpolate(gettext('with %(release_date_from)s'), { release_date_from: releaseDateFrom }, true) %> + <%= interpolate( + gettext('with %(release_date_from)s'), { release_date_from: releaseDateFrom }, true + ) %> <% } else { %> @@ -70,7 +72,9 @@ var visibleToStaffOnly = visibilityState === 'staff_only'; <%= gettext("Staff Only") %> <% if (!hasExplicitStaffLock) { %> - <%= interpolate(gettext("with %(section_or_subsection)s"),{ section_or_subsection: staffLockFrom }, true) %> + <%= interpolate( + gettext("with %(section_or_subsection)s"),{ section_or_subsection: staffLockFrom }, true + ) %> <% } %>

diff --git a/cms/templates/js/xblock-outline.underscore b/cms/templates/js/xblock-outline.underscore index c1f6e0253d..c4cdc9ef9c 100644 --- a/cms/templates/js/xblock-outline.underscore +++ b/cms/templates/js/xblock-outline.underscore @@ -7,7 +7,10 @@
<% if (includesChildren) { %>

+ title="<%= interpolate( + gettext('Collapse/Expand this %(xblock_type)s'), { xblock_type: xblockTypeDisplayName }, true + ) %>" + > <% } else { %>

@@ -54,7 +57,10 @@

<%= gettext("You haven't added any content to this course yet.") %> + title="<%= interpolate( + gettext('Click to add a new %(xblock_type)s'), { xblock_type: defaultNewChildName }, true + ) %>" + > <%= addChildLabel %>

@@ -67,7 +73,10 @@ diff --git a/lms/templates/courseware_search/search_list.underscore b/lms/templates/courseware_search/search_list.underscore index 6366b3893b..56f283fe26 100644 --- a/lms/templates/courseware_search/search_list.underscore +++ b/lms/templates/courseware_search/search_list.underscore @@ -9,7 +9,11 @@ <% if (hasMoreResults) { %> - <%= interpolate(gettext("Load next %s results"), [pageSize]) %> + <%= interpolate( + ngettext("Load next %(num_items) result", "Load next %(num_items) results", pageSize), + { num_items: pageSize }, + true + ) %> <% } %>