Try modifying your haml_parser.rb to see where the parser gets stuck. def parse(file, ary = []) haml = Haml::Engine.new(IO.readlines(file).join) code = haml.precompiled.split(/$/) puts "Parsing Haml File: #{file}" RubyParser.parse_lines(file, code, ary) end
I'm having problems of my own in upgrading my setup. Rails 2.3.4 gettext 2.0.4 haml 2.2.8 >From what I have gathered it is largely due to the change of in HAML 2.2 Engine that made it's output unparseable by the gettext's default RubyParser. I have tried the gems retoo-ruby_gettext_extractor (0.2.1) that depends on ruby_parser without success. This ruby_parser has a RubyParser class of it's own and conflicts with Gettext's RubyParser module. So here's a classical case of why we should namespace our code. -_- After hacking it to work by changing the names of the RubyParser in the gems, I can make it work to parse en template files, using retoo's gettext_extractor/rubyparser gems. However, the parser doesn't work on my non-latin template files. My HamlParser class as below. Anyone can have a go and fix this? A million thanks! # haml_parser.rb require 'rubygems' require 'haml' require 'gettext_rails/tools' require 'ruby_gettext_extractor' module HamlParser module_function def target?(file) File.extname(file) == '.haml' end def parse(file, ary = []) bypass = ! File.basename(file, '.haml').match(/(vi|zh|zh_HK|id|th)$/).nil? puts "HamlParser:#{file}:bypass:#{bypass}" return ary if bypass haml = Haml::Engine.new(IO.readlines(file).join) result = nil begin #result = GetText::RubyParser.parse_lines(file, haml.precompiled.split(/$/), ary) result = RubyGettextExtractor.parse_string(haml.precompiled, file, ary) rescue Exception => e puts "Error:#{file}" raise e end result end end GetText::RGetText.add_parser(HamlParser) -- Posted via http://www.ruby-forum.com/. _______________________________________________ Railsi18n-discussion mailing list Railsi18n-discussion@rubyforge.org http://rubyforge.org/mailman/listinfo/railsi18n-discussion