Commits

Andreas Loupasakis committed 1220f25

Fixed whitespace highlight for plural source entity fiedls in Lotte.

Comments (0)

Files changed (4)

transifex/addons/lotte/media/css/dataTable.css

   padding-bottom:16px;
 }
 
-.source_string {
+.source_string, .source_string_plural {
   overflow:visible;
   text-shadow: 1px 1px 0px #fff;
   padding-bottom:1.25em;

transifex/addons/lotte/media/js/jquery.whitespaceHighlight.js

                 if(matchedStartSpace){
                     startSpaces = matchedStartSpace[0].replace(
                         new RegExp(/\u00A0|\u0020/g),
-                        '<span class="whitespace space"> </span>');
+                        '<span class="whitespace space" title="Space"> </span>');
                     // left trim
-                    string.replace(reWhiteSpaceStartSpace, "");
+                    string = string.replace(reWhiteSpaceStartSpace, "");
                 }
                 var matchedEndSpace = reWhiteSpaceEndSpace.exec(string);
                 var endSpaces;
                 if(matchedEndSpace){
                     endSpaces = matchedEndSpace[0].replace(
                         new RegExp(/\u00A0|\u0020/g),
-                        '<span class="whitespace space"> </span>');
+                        '<span class="whitespace space" title="Space"> </span>');
                     // right trim
-                    string.replace(reWhiteSpaceEndSpace, "");
+                    string = string.replace(reWhiteSpaceEndSpace, "");
                 }
 
                 // Find the middle space sequences
                 var obj = $('<div>'+this.html()+'</div>');
                 // Restrict searching in obj context searching
                 $(".whitespace.space", obj).replaceWith(' ');
-                $(".whitespace.newline", obj).replaceWith('\n');
+                // Empty it, as we have included the original new line after span!!!
+                $(".whitespace.newline", obj).replaceWith('');
 
                 // TODO: Reset all the other whitespace chars!!!
 

transifex/addons/lotte/media/js/tx.lotte2.js

                 var a=$(this), str=a.html();
                 a.removeClass("action");
                 a.addClass("action_go");
-                var plural_orig = $('.msg .source_string .plural_title', a.parents('tr'));
+                var plural_orig = $('.msg .source_string_plural', a.parents('tr'));
                 var orig=$('.msg .source_string', a.parents('tr')).whitespaceHighlight("reset");
                 if(plural_orig.length > 0)
                   orig = orig.substring(orig.indexOf('</span>')+7);
         // 2. Copy source string
         $('.lotte-actions a.copy_source').click(function() {
             var a=$(this);
-            var plural_orig = $('.msg .source_string .plural_title', a.parents('tr'));
+            var plural_orig = $('.msg .source_string_plural', a.parents('tr'));
             var orig=$('.msg .source_string', a.parents('tr')).whitespaceHighlight("reset"); //html();
             if(plural_orig.length > 0)
               orig = orig.substring(orig.indexOf('</span>')+7);

transifex/addons/lotte/templates/translate.html

                                 source_divs += '<span class="plural_title">'+plural_types[rule]+':</span>&nbsp;'
                               source_divs += html_escape(clean_array["source_dict"]["source_strings"][plural_types[rule]]) + '</div>'
                             }else
-                              source_divs += '<p title="{% trans "Source string" %}"><span class="plural_title">'+plural_types[rule]+':</span>&nbsp;' + html_escape(clean_array["source_dict"]["source_strings"][plural_types[rule]]) + '</p>'
+                              source_divs += '<p class="source_string_plural" title="{% trans "Source string" %}"><span class="plural_title">'+plural_types[rule]+':</span>&nbsp;' + html_escape(clean_array["source_dict"]["source_strings"][plural_types[rule]]) + '</p>'
                             plurals_counter++;
                         }
                     }
 
                 stringset.current_box = null;
 
-                $('.source_string').whitespaceHighlight();
+                // Highlight source strings.
+                $('.source_string, .source_string_plural').whitespaceHighlight();
             }
         });