Sha256: 321c1643f2fa1e7e1d0a6b546cbac2b4ad19f91724fb97de6a548d6b2d297355
Contents?: true
Size: 1.33 KB
Versions: 5
Compression:
Stored size: 1.33 KB
Contents
require "fileutils" desc 'Locale specific tasks: locale:find' namespace :locale do desc 'Extract strings from model' task :find_model => "gettext:store_model_attributes" do # Add some extra comments for translators and remove the following entires: # # something/something # Puppet::something # ignored = /_\('(\w+\/\w+|Puppet:)/ filename = "locale/model_attributes" File.rename "#{filename}.rb", "#{filename}.tmp" File.open("#{filename}.rb", "w") do |output| IO.foreach("#{filename}.tmp") do |line| if not line =~ /^\s*#/ and not line =~ ignored output.puts '# TRANSLATORS: "Table name" or "Table name|Column name" for error messages' output.puts line end end end FileUtils.rm "#{filename}.tmp" end desc 'Extract strings from codebase' task :find_code => [:find_model, "gettext:find"] desc 'Extract strings from model and from codebase' task :find => [:find_model, :find_code] do errors = File.open("locale/foreman.pot") {|f| f.grep /(%s.*%s|#\{)/} if errors.count > 0 errors.each {|e| puts "MALFORMED: #{e}"} puts "Malformed strings found: #{errors.count}" puts "Please read http://projects.theforeman.org/projects/foreman/wiki/Translating" end end desc 'Alias for gettext:pack' task :pack => "gettext:pack" end
Version data entries
5 entries across 5 versions & 1 rubygems