THere is no such function.
Anyway I have writen one to sarch in all views and controllers and also 
translate the errr messages.
Look here:
 #this one will parse all views and contrller from disk to search 
strings that need to be translated. It also will add to the DB the error 
message as needing translation
  def get_translatable_strings
    @strs = []
    Dir.glob("#{RAILS_ROOT}/app/views/**/*.rhtml").collect do |f|
      @strs << File.read(f).scan(/[\"\']([A-Za-z0-9% ]*)[\"\']\.t/)
    end.uniq.flatten.uniq
    @new_strs=Array.new
    @[EMAIL PROTECTED]
    0.upto @strs.size-1 do |i|
      @strs[i].each do |str|
        @new_strs << str
      end
    end
    @strs = []
    Dir.glob("#{RAILS_ROOT}/app/controllers/**/*.rb").collect do |f|
      @strs << File.read(f).scan(/[\"\']([A-Za-z0-9% ]*)[\"\']\.t/)
    end.uniq.flatten.uniq
    @[EMAIL PROTECTED]
    0.upto @strs.size-1 do |i|
      @strs[i].each do |str|
        @new_strs << str
      end
    end
    @[EMAIL PROTECTED]
    Locale::LOCALES.values.each do |loc|
      Locale.set "#{loc}"
      @new_strs.each do |str|
        str.to_s.translate
      end
      ActiveRecord::Errors.default_error_messages.each_value do 
|error_msg|
        error_msg.translate
      end
    end
  end


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion@rubyforge.org
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to