Commits

Diego Búrigo Zacarão committed 9824a66

escapejs to avoid troubles with quotes when using localized strings

Comments (0)

Files changed (8)

transifex/addons/locks/templates/lock_resource_action.html

             contentType : 'application/json',
             type : 'POST',
             beforeSend: function(){
-            $("div#notification-container div").html('{% trans "Creating lock..." %}');
+            $("div#notification-container div").html('{% trans "Creating lock..."|escapejs %}');
             $("div#notification-container").fadeIn("fast");
             },
             complete : function(xmlhttpreq, textStatus) {
             contentType : 'application/json',
             type : 'POST',
             beforeSend: function(){
-            $("div#notification-container div").html('{% trans "Removing lock..." %}');
+            $("div#notification-container div").html('{% trans "Removing lock..."|escapejs %}');
             $("div#notification-container").fadeIn("fast");
             },
             complete : function(xmlhttpreq, textStatus) {
             contentType : 'application/json',
             type : 'POST',
             beforeSend: function(){
-            $("div#notification-container div").html('{% trans "Extending lock..." %}');
+            $("div#notification-container div").html('{% trans "Extending lock..."|escapejs %}');
             $("div#notification-container").fadeIn("fast");
             },
             complete : function(xmlhttpreq, textStatus) {

transifex/addons/lotte/templates/translate.html

 
         oTable = $('#stringset_table').dataTable({
             "oLanguage": {
-                "sProcessing":   '{% trans "Processing..." %}',
-                "sLengthMenu":   '{% trans "Show _MENU_ entries" %}',
-                "sZeroRecords":  '{% trans "No matching records found" %}',
-                "sInfo":         '{% trans "Showing _START_ to _END_ of _TOTAL_ entries" %}',
-                "sInfoEmpty":    '{% trans "Nothing to show" %}',
-                "sInfoFiltered": '{% trans "(filtered from _MAX_ total entries)" %}',
+                "sProcessing":   '{% trans "Processing..."|escapejs %}',
+                "sLengthMenu":   '{% trans "Show _MENU_ entries"|escapejs %}',
+                "sZeroRecords":  '{% trans "No matching records found"|escapejs %}',
+                "sInfo":         '{% trans "Showing _START_ to _END_ of _TOTAL_ entries"|escapejs %}',
+                "sInfoEmpty":    '{% trans "Nothing to show"|escapejs %}',
+                "sInfoFiltered": '{% trans "(filtered from _MAX_ total entries)"|escapejs %}',
                 "sInfoPostFix":  "",
-                "sSearch":       '{% trans "Search:" %}',
+                "sSearch":       '{% trans "Search:"|escapejs %}',
                 "sUrl":          "",
                 "oPaginate": {
-                        "sFirst":    '{% trans "First" %}',
-                        "sPrevious": '{% trans "Previous" %}',
-                        "sNext":     '{% trans "Next" %}',
-                        "sLast":     '{% trans "Last" %}'
+                        "sFirst":    '{% trans "First"|escapejs %}',
+                        "sPrevious": '{% trans "Previous"|escapejs %}',
+                        "sNext":     '{% trans "Next"|escapejs %}',
+                        "sLast":     '{% trans "Last"|escapejs %}'
                 }
             },
             "bJQueryUI": false,
             ],
             "fnServerData": function (sSource, aoData, fnCallback) {
 
-              $("div#notification-container div").html('{% trans "Loading strings..." %}');
+              $("div#notification-container div").html('{% trans "Loading strings..."|escapejs %}');
               $("div#notification-container").fadeIn("slow");
               if (filter_var) {
                 aoData.push( { "name" : "filters", "value": filter_var});
                 stringset.unbindSaveButton();
                 stringset.bindBlurTextArea();
                 stringset.push();
-                alert('{% trans "Translation text will be saved automatically." %}');
+                alert('{% trans "Translation text will be saved automatically."|escapejs %}');
             } else { 
                 stringset.unbindBlurTextArea();
                 stringset.bindSaveButton();
-                alert('{% trans "Translation text will no longer be saved automatically." %}');
+                alert('{% trans "Translation text will no longer be saved automatically."|escapejs %}');
             }
         });
 
                 to_delete.push( $("span#sourceid_"+j).text() );
             }
             if(to_delete.length == 0){
-                alert('{% trans "This page does not have any translations (to delete)!" %}');
-            }else if(confirm('{% trans "This action will delete all '+ to_delete.length +' translations in this page. Are you sure you want to proceed?" %}')){
+                alert('{% trans "This page does not have any translations (to delete)!"|escapejs %}');
+            }else if(confirm('{% trans "This action will delete all '+ to_delete.length +' translations in this page. Are you sure you want to proceed?"|escapejs %}')){
                 {% if resource %}
                 var delete_url = '{% url delete_translation project.slug resource.slug target_language.code %}';
                 {% else %}

transifex/addons/lotte/templates/view_strings.html

 
         oTable = $('#stringset_table').dataTable({
             "oLanguage": {
-                "sProcessing":   '{% trans "Processing..." %}',
-                "sLengthMenu":   '{% trans "Show _MENU_ entries" %}',
-                "sZeroRecords":  '{% trans "No matching records found" %}',
-                "sInfo":         '{% trans "Showing _START_ to _END_ of _TOTAL_ entries" %}',
-                "sInfoEmpty":    '{% trans "Nothing to show" %}',
-                "sInfoFiltered": '{% trans "(filtered from _MAX_ total entries)" %}',
+                "sProcessing":   '{% trans "Processing..."|escapejs %}',
+                "sLengthMenu":   '{% trans "Show _MENU_ entries"|escapejs %}',
+                "sZeroRecords":  '{% trans "No matching records found"|escapejs %}',
+                "sInfo":         '{% trans "Showing _START_ to _END_ of _TOTAL_ entries"|escapejs %}',
+                "sInfoEmpty":    '{% trans "Nothing to show"|escapejs %}',
+                "sInfoFiltered": '{% trans "(filtered from _MAX_ total entries)"|escapejs %}',
                 "sInfoPostFix":  "",
-                "sSearch":       '{% trans "Search:" %}',
+                "sSearch":       '{% trans "Search:"|escapejs %}',
                 "sUrl":          "",
                 "oPaginate": {
-                        "sFirst":    '{% trans "First" %}',
-                        "sPrevious": '{% trans "Previous" %}',
-                        "sNext":     '{% trans "Next" %}',
-                        "sLast":     '{% trans "Last" %}'
+                        "sFirst":    '{% trans "First"|escapejs %}',
+                        "sPrevious": '{% trans "Previous"|escapejs %}',
+                        "sNext":     '{% trans "Next"|escapejs %}',
+                        "sLast":     '{% trans "Last"|escapejs %}'
                 }
             },
             "bJQueryUI": false,
             ],
             "fnServerData": function (sSource, aoData, fnCallback) {
 
-              $("div#notification-container div").html('{% trans "Loading strings..." %}');
+              $("div#notification-container div").html('{% trans "Loading strings..."|escapejs %}');
               $("div#notification-container").fadeIn("slow");
               if ( filter_var) {
                 aoData.push( { "name" : "filters", "value": filter_var});

transifex/templates/projects/release_language_detail.html

                             request_url = window.location+'l/{{ language.code }}/clone/'+target_lang_code+'/';
                             window.location = request_url;
                         } else {
-                            alert('{% trans "Please select a target language first." %}');
+                            alert('{% trans "Please select a target language first."|escapejs %}');
                         }
                     });
                     if(!$("#download_for_translation a").hasClass('disabled')){
                                 contentType : 'application/json',
                                 type : 'POST',
                                 beforeSend: function(){
-                                $("div#notification-container div").html('{% trans "Trying to lock resource..." %}');
+                                $("div#notification-container div").html('{% trans "Trying to lock resource..."|escapejs %}');
                                 $("div#notification-container").fadeIn("fast");
                                 },
                                 complete : function(xmlhttpreq, textStatus) {

transifex/templates/resources/resource_actions.html

             {% if request.user.is_authenticated %}
                 <a href="{% url download_translation resource.project.slug resource.slug target_language.code %}">{% trans "Download for viewing" %}</a>
             {% else %}
-                <a class="disabled" title='{% trans "You must login to be able to download the translations." %}'>{% trans "Download for viewing" %}</a>
+                <a class="disabled" title='{% trans "You must login to be able to download the translations."|escapejs %}'>{% trans "Download for viewing" %}</a>
             {% endif %}
 			</span>
           </li>
           <li>
             {% if request.user.is_authenticated %}
             <span id="download_for_translation" class="i16 lock">
-              <a {% if lock %}{% ifnotequal request.user lock.owner %}class="disabled" title="{% trans "Resource cannot be locked" %}" {% else %}href="#"{% endifnotequal %}{% else %}{% if can_submit_translation and resource.accept_translations %}href="#"{% else %}class="disabled"{% endif %}{% endif %}>{% trans "Download for translation" %}</a>
+              <a {% if lock %}{% ifnotequal request.user lock.owner %}class="disabled" title='{% trans "Resource cannot be locked'|escapejs %}" {% else %}href="#"{% endifnotequal %}{% else %}{% if can_submit_translation and resource.accept_translations %}href="#"{% else %}class="disabled"{% endif %}{% endif %}>{% trans "Download for translation" %}</a>
             </span>
             {% else %}
             <span id="download_for_translation" class="i16 lock">
-              <a class="disabled" title='{% trans "You must login to use this action" %}'>{% trans "Download for translation" %}</a>
+              <a class="disabled" title='{% trans "You must login to use this action"|escapejs %}'>{% trans "Download for translation" %}</a>
             </span>
             {% endif %}
-            <span class="tipsy_enable" title="{% trans "Lock the file under your ownership and download it locally to edit it, in one action." %}" style="border:0">(?)</span>
+            <span class="tipsy_enable" title='{% trans "Lock the file under your ownership and download it locally to edit it, in one action."|escapejs %}' style="border:0">(?)</span>
             <div class="error_notes"></div>
           </li>
           <li>

transifex/templates/resources/resource_detail.html

                 
                 window.location = request_url;
             } else {
-                alert('{% trans "Please select a target language first." %}');
+                alert('{% trans "Please select a target language first."|escapejs %}');
             }
         });
         {% endif %}
                             request_url = window.location+'l/{{ stat.language.code }}/clone/'+target_lang_code+'/';
                             window.location = request_url;
                         } else {
-                            alert('{% trans "Please select a target language first." %}');
+                            alert('{% trans "Please select a target language first."|escapejs %}');
                         }
                     });
                     if(!$("#download_for_translation a").hasClass('disabled')){
                             contentType : 'application/json',
                             type : 'POST',
                             beforeSend: function(){
-                            $("div#notification-container div").html('{% trans "Trying to lock resource..." %}');
+                            $("div#notification-container div").html('{% trans "Trying to lock resource..."|escapejs %}');
                             $("div#notification-container").fadeIn("fast");
                             },
                             complete : function(xmlhttpreq, textStatus) {
                 },
                 'titleShow': true,
                 'titlePosition': 'outside',
-                'title': '{% trans "Translation Details"%}'
+                'title': '{% trans "Translation Details"|escapejs %}'
            });
         });
     </script>

transifex/templates/resources/upload_resource_translation_button.html

         var language = $("[name='" + prefix + "_0']").val();
         if(uuid != ""){
             var url_api_project = sprintf('{{ api_resource_storage }}', project_slug, resource_slug, language);
-            $("div#notification-container div").html('{% trans "Adding translations. This might take a while..." %}');
+            $("div#notification-container div").html('{% trans "Adding translations. This might take a while..."|escapejs %}');
             $("div#notification-container").fadeIn("fast");
             $.ajax({
                 type : 'PUT',

transifex/templates/teams/team_detail.html

                             contentType : 'application/json',
                             type : 'POST',
                             beforeSend: function(){
-                            $("div#notification-container div").html('{% trans "Trying to lock resource..." %}');
+                            $("div#notification-container div").html('{% trans "Trying to lock resource..."|escapejs %}');
                             $("div#notification-container").fadeIn("fast");
                             },
                             complete : function(xmlhttpreq, textStatus) {
                 },
                 'titleShow': true,
                 'titlePosition': 'outside',
-                'title': '{% trans "Translation Details"%}'
+                'title': '{% trans "Translation Details"|escapejs %}'
            });
         });
     </script>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.