Thank you for your contribution Eduard.
I am saving myself pretty some work using it.

Still, I have (tried to have) improve your code a little, mainly the
regexp:
  def harvest
    @strs = []
    allowed = ' \w0-9%:;@&#<>\/\\\?\!\+\)\(-=\*'
    regexp =
Regexp.new('[\"](['+allowed+'\']*)[\"]\.t|[\'](['+allowed+'\"]*)[\']\.t')
    Dir.glob("#{RAILS_ROOT}/app/views/**/*.rhtml").collect do |f|
      @strs << File.read(f).scan(regexp)
    end
    @new_strs=Array.new
    @[EMAIL PROTECTED]
    0.upto @strs.size-1 do |i|
      if @strs[i] then
        @strs[i].each do |str|
          @new_strs << str
        end
      end
    end
    @strs = []
    Dir.glob("#{RAILS_ROOT}/app/controllers/**/*.rb").collect do |f|
      @strs << File.read(f).scan(regexp)
    end
    @[EMAIL PROTECTED]
    0.upto @strs.size-1 do |i|
      if @strs[i] then
        @strs[i].each do |str|
          @new_strs << str
        end
      end
    end
    @[EMAIL PROTECTED]
    LOCALES.each do |key,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
[email protected]
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to