Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add rake tolk:html_keys for finding html phrases without _html postfix

  • Loading branch information...
commit 58e78ee0874588591be9bde7ec2a3a2405ba3722 1 parent f3fc2d1
@lifo lifo authored
Showing with 14 additions and 0 deletions.
  1. +7 −0 app/models/tolk/locale.rb
  2. +7 −0 tasks/tolk_tasks.rake
View
7 app/models/tolk/locale.rb
@@ -163,6 +163,13 @@ def [](key)
end
end
+ def translations_with_html
+ translations = self.translations.all(:conditions => "tolk_translations.text LIKE '%>%' AND
+ tolk_translations.text LIKE '%<%' AND tolk_phrases.key NOT LIKE '%_html'", :joins => :phrase)
+ Translation.send :preload_associations, translations, :phrase
+ translations
+ end
+
private
def remove_invalid_translations_from_target
View
7 tasks/tolk_tasks.rake
@@ -15,4 +15,11 @@ namespace :tolk do
Tolk::Locale.import_secondary_locales
end
+ desc "Show all the keys potentially containing HTML values and no _html postfix"
+ task :html_keys => :environment do
+ bad_translations = Tolk::Locale.primary_locale.translations_with_html
+ bad_translations.each do |bt|
+ puts "#{bt.phrase.key} - #{bt.text}"
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.