integration/js/editor.js
changeset 104 1b84c7b2aeee
parent 97 213e81430f7a
child 109 3034776c1f35
--- a/integration/js/editor.js	Tue Dec 04 13:31:01 2012 +0100
+++ b/integration/js/editor.js	Tue Dec 04 18:59:07 2012 +0100
@@ -14,22 +14,22 @@
             '<li class="item-video media" data-media-id="<%= id %>"><div class="media-count-wrap"><span class="media-count"></span></div>'
             + '<img class="thumbnail" src="<%= thumbnail %>" alt="<%= title %>" />'
             + '<div class="video-info"><h3 class="title-video"><%= title %></h3><p class="description"><%= description %></p>'
-            + '<p class="time-length"><%= IriSP.translate("Duration:") %> <span><%= duration.toString() %></span></p></div><div class="media-found-segments"></div></li>'
+            + '<p class="time-length"><%= gettext("Duration:") %> <span><%= duration.toString() %></span></p></div><div class="media-found-segments"></div></li>'
         ),
         segmenttemplate = _.template(
             '<li class="item-video annotation" data-segment-id="<%= annotation.id %>" data-media-id="<%= annotation.getMedia().id %>">'
             + '<img class="thumbnail" src="<%= annotation.thumbnail %>" alt="<%= annotation.getMedia().title %>" />'
             + '<div class="validate <%= annotation.status %>"><div class="validate-tooltip"><ul><li><%= annotation.status_messages.join("</li><li>") %></li></ul></div></div><div class="video-info"><h3 class="title-video"><%= annotation.getMedia().title %></h3>'
             + '<p class="subtitle"><%= annotation.title %></p><p class="duration"><%= annotation.begin.toString() %> - <%= annotation.end.toString() %> (<%= annotation.getDuration().toString() %>)</p>'
-            + '<ul class="tools"><li><a class="edit" href="#" title="<%= IriSP.translate("Edit segment") %>"></a></li><li><a class="bottom" href="#" title="<%= IriSP.translate("Move segment down") %>"></a></li>'
-            + '<li><a class="top" href="#" title="<%= IriSP.translate("Move segment up") %>"></a></li><li><a class="delete" href="#" title="<%= IriSP.translate("Delete segment") %>"></a></li></ul></div></li>'
+            + '<ul class="tools"><li><a class="edit" href="#" title="<%= gettext("Edit segment") %>"></a></li><li><a class="bottom" href="#" title="<%= gettext("Move segment down") %>"></a></li>'
+            + '<li><a class="top" href="#" title="<%= gettext("Move segment up") %>"></a></li><li><a class="delete" href="#" title="<%= gettext("Delete segment") %>"></a></li></ul></div></li>'
         ),
         mediasegmenttemplate = _.template(
             '<div class="media-segment">'
             + '<div class="media-segment-section" style="left:<%= left %>px; width:<%= width %>px; background:<%= color %>; top: <%= top %>px;" data-segment-id="<%= annotation.id %>"></div>'
             + '<div class="popin media-segment-popin" style="left:<%= popleft %>px; top: <%= 5+top %>px;"><div style="left:<%= pointerpos %>px;" class="pointer"></div><div class="popin-content">'
-            + '<h3><%= annotation.title %></h3><a href="#" class="button reprendre-segment" data-segment-id="<%= annotation.id %>"><%= IriSP.translate("Clone segment") %></a>'
-            + '<p><%= IriSP.translate("From:") %> <span><%= annotation.begin.toString() %></span> <%= IriSP.translate("to:") %> <span><%= annotation.end.toString() %></span> (<%= IriSP.translate("duration:") %> <span><%= annotation.getDuration().toString() %></span>)</p>'
+            + '<h3><%= annotation.title %></h3><a href="#" class="button reprendre-segment" data-segment-id="<%= annotation.id %>"><%= gettext("Clone segment") %></a>'
+            + '<p><%= gettext("From:") %> <span><%= annotation.begin.toString() %></span> <%= gettext("to:") %> <span><%= annotation.end.toString() %></span> (<%= gettext("duration:") %> <span><%= annotation.getDuration().toString() %></span>)</p>'
             + '</div></div></div>'
         ),
         mediasegmentlisttemplate = _.template(
@@ -38,7 +38,7 @@
         mediafoundtemplate = _.template(
             '<div class="media-segment"><div class="media-segment-section" style="left:<%= left %>px; width:<%= width %>px; background:<%= color %>; top: <%= top %>px;"></div>'
             + '<div class="popin media-found-popin" style="left:<%= popleft %>px; top: <%= 5+top %>px;"><div style="left:<%= pointerpos %>px;" class="pointer"></div><div class="popin-content">'
-            + '<h3><%= title %></h3><a href="#" class="button clone-segment" data-segment-id="<%= annotation.id %>"><%= IriSP.translate("Clone segment") %></a>'
+            + '<h3><%= title %></h3><a href="#" class="button clone-segment" data-segment-id="<%= annotation.id %>"><%= gettext("Clone segment") %></a>'
             + '</div></div></div>'
         ),
         mediafoundlisttemplate = _.template(
@@ -59,19 +59,19 @@
             validate: function(_s) {
                 return (_s.getDuration() >= 1000);
             },
-            message: "A segment must be at least one second long"
+            message: gettext("A segment must be at least one second long")
         },
         {
             validate: function(_s) {
                 return (_s.getDuration() < 180000);
             },
-            message: "A segment must be at most three minutes long"
+            message: gettext("A segment must be at most three minutes long")
         },
         {
             validate: function(_s) {
-                return (!!_s.title && _s.title !== IriSP.translate("Untitled segment"));
+                return (!!_s.title && _s.title !== gettext("Untitled segment"));
             },
-            message: "A segment must have a title"
+            message: gettext("A segment must have a title")
         }
     ];
     var segmentwarning = [
@@ -79,13 +79,13 @@
             validate: function(_s) {
                 return (!!_s.description);
             },
-            message: "A segment should have a description"
+            message: gettext("A segment should have a description")
         },
         {
             validate: function(_s) {
                 return (!!_s.keywords.length);
             },
-            message: "A segment should have tags"
+            message: gettext("A segment should have tags")
         }
     ];
     
@@ -94,13 +94,13 @@
             validate: function(_m) {
                 return _m.segments.length > 2;
             },
-            message: "A hashcut must be made from at least three segments"
+            message: gettext("A hashcut must be made from at least three segments")
         },
         {
             validate: function(_m) {
-                return (!!_m.title && _m.title !== IriSP.translate("Untitled Hashcut"));
+                return (!!_m.title && _m.title !== gettext("Untitled Hashcut"));
             },
-            message: "A hashcut must have a title"
+            message: gettext("A hashcut must have a title")
         }
     ];
     var mashupwarning = [
@@ -108,7 +108,7 @@
             validate: function(_m) {
                 return !!_m.description
             },
-            message: "A hashcut should have a description"
+            message: gettext("A hashcut should have a description")
         }
     ];
 
@@ -245,7 +245,7 @@
         if (!messages.length) {
             messages.push("Your hashcut is valid!");
         }
-        mashupstatus = ' - ' + _(messages).map(IriSP.translate).join('\n - ');
+        mashupstatus = ' - ' + _(messages).join('\n - ');
         
         $(".publier-button").toggleClass("disable", critical);
         
@@ -350,7 +350,7 @@
             if (!messages.length) {
                 messages.push("This segment is valid!")
             }
-            currentSegment.status_messages = _(messages).map(IriSP.translate);
+            currentSegment.status_messages = _(messages);
             
             $(".segmentation .validate").removeClass("critical warning valid").addClass(currentSegment.status);
             $(".segmentation .validate-tooltip").html("<ul><li>" + currentSegment.status_messages.join("</li><li>")+"</li></ul>");
@@ -374,7 +374,7 @@
                 currentSegment.setMedia(currentMedia.id);
                 currentSegment.setBegin(currentMedia.getCurrentTime());
                 currentSegment.setEnd(Math.min(currentMedia.getCurrentTime() +  180000, currentMedia.duration));
-                currentSegment.title = IriSP.translate("Untitled segment");
+                currentSegment.title = gettext("Untitled segment");
                 currentSegment.color = currentMedia.color;
                 currentSegment.thumbnail = currentMedia.thumbnail;
                 currentSegment.created = new Date();
@@ -396,8 +396,8 @@
             if (currentMedia.loaded) {
                 currentMedia.setCurrentTime(currentSegment.begin);
             }
-            $(".add-segment").val(IriSP.translate(addMode ? "Add segment to hashcut" : "Save segment"));
-            $(".create-or-edit").text(IriSP.translate(addMode ? "Create new segment" : "Edit existing segment"));
+            $(".add-segment").val(addMode ? gettext("Add segment to hashcut") : gettext("Save segment"));
+            $(".create-or-edit").text(addMode ? gettext("Create new segment") : gettext("Edit existing segment"));
             $("#segment-title").val(currentSegment.title);
             $("#segment-description").val(currentSegment.description);
             var segment_tags = $("#segment-tags");
@@ -499,7 +499,7 @@
         }
     });
     $("#segment-title").on("focus click", function() {
-        if ($(this).val() === IriSP.translate("Untitled segment")) {
+        if ($(this).val() === gettext("Untitled segment")) {
             $(this).val("");
         }
     });
@@ -755,7 +755,7 @@
         currentSegment.setMedia(media.id);
         currentSegment.setBegin(s.begin);
         currentSegment.setEnd(s.end);
-        currentSegment.title = IriSP.translate("Copy of ") + s.title;
+        currentSegment.title = gettext("Copy of ") + s.title;
         currentSegment.description = s.description;
         currentSegment.keywords = s.keywords;
         currentSegment.color = media.color;
@@ -801,7 +801,7 @@
     });
     /* Changing Hashcut Title and description */
     
-    mashup.title = IriSP.translate("Untitled Hashcut");
+    mashup.title = gettext("Untitled Hashcut");
     $(".title-video-wrap a").text(mashup.title);
     $("#hashcut-title").val(mashup.title);
     
@@ -811,7 +811,7 @@
         mashup.trigger("change");
     });
     $("#hashcut-title").on("focus click", function() {
-        if ($(this).val() === IriSP.translate("Untitled Hashcut")) {
+        if ($(this).val() === gettext("Untitled Hashcut")) {
             $(this).val("");
         }
     });
@@ -829,14 +829,14 @@
     /* Publication */
    
     function onLeave() {
-        return IriSP.translate("You haven't published your hashcut yet.\nIf you leave this page, it will be lost");
+        return gettext("You haven't published your hashcut yet.\nIf you leave this page, it will be lost.");
     }
     
     $(window).on("beforeunload", onLeave);
    
     $(".publier-button").click(function() {
         if ($(this).hasClass("disable")) {
-            alert(IriSP.translate("The mashup can't be published because:")+"\n\n"+mashupstatus);
+            alert(gettext("The hashcut can't be published because:")+"\n\n"+mashupstatus);
             return false;
         }
         var postproject = directory.newLocalSource(),
@@ -895,7 +895,7 @@
                 document.location.href = destination;
             },
             error: function(jqXHR, textStatus, errorThrown){
-                alert(IriSP.translate("Server error\nYour hashcut couldn't be published"));
+                alert(gettext("Server error\nYour hashcut couldn't be published"));
                 waitscreen.remove();
             }
         });