Permalink
Browse files

added present translations count

  • Loading branch information...
gnagno committed Jul 16, 2011
1 parent 792221f commit 8ba79b0f2dacc5f8bb6add68ea3e4506f7092304
@@ -1,12 +1,18 @@
$(document).ready(function() {
var $translation_missing_count = $('.translation_missing').length;
+ var $translation_present_count = $('.translation_present').length;
var $newdiv = $('<div id="lost-i18n-translation-div"/>');
var $tr_missing = $('<span id="lost-i18n-translation-tr-missing-count" />');
$tr_missing.append( $translation_missing_count );
$newdiv.append("Missing translations: " , $tr_missing );
+
+ var $tr_present = $('<span id="lost-i18n-translation-tr-present-count" />');
+ $tr_present.append( $translation_present_count );
+ $newdiv.append("Present translations: ", $tr_present );
+
$('body').append($newdiv);
});
@@ -1,3 +1,7 @@
span.translation_missing {
border: 1px solid red;
}
+
+span.translation_present {
+ border: 1px solid green;
+}
@@ -1,7 +1,19 @@
module ActionView::Helpers::TranslationHelper
alias :t_old :t
+ def add_span str
+ #TODO: add the title part, this will be used to identify the string
+ "<span class=\"translation_present\">#{str}</span>".html_safe
+ end
+
def t(*args)
- "prova: #{t_old(args)}"
+ r = /<span class="translation_missing" title="translation missing:/
+ str = t_old(args)
+
+ if str =~ r
+ return str
+ else
+ add_span str
+ end
end
end
@@ -1,3 +1,4 @@
<h1>Home#index</h1>
<p>Find me in app/views/home/index.html.erb</p>
-<%= t 'test' %>
+<%= t 'test' %><br />
+<%= t 'hello' %>

0 comments on commit 8ba79b0

Please sign in to comment.