# Rails 3.x, Ruby 1.9.x + HAML = Terror?

**URL:** <https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339>\
**Category:** Rails I18n\
**Created:** [March 28, 2012, 4:47pm UTC](https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339 "2012-03-28T16:47:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 28, 2012, 4:47pm UTC](https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339/1 "2012-03-28T16:47:14Z")

</div>

Hi everyone,

It seems ruby\_parser is required to parse HAML files for gettext msgids  
with the gettext:find rake task from gettext. However, ruby\_parser  
doesn’t  
seem to work on Ruby 1.9.x.

So is it impossible to extract gettext msgids with reasonably new Rubies  
and HAML?

Cheers,

Ramn

---

<div class="post-metadata">

**Author:** ![psy-q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/898d66/32.png) [@psy-q](https://www.ruby-forum.com/u/psy-q)\
**Post date:** [March 30, 2012, 2:19pm UTC](https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339/2 "2012-03-30T14:19:03Z")

</div>

Hi again,

Perhaps some more context. I’ve added the gems to my Gemfile as  
instructed  
here: [GitHub - grosser/gettext\_i18n\_rails: Rails: FastGettext, I18n integration -- simple, threadsafe and fast!](https://github.com/grosser/gettext_i18n_rails)

I’ve also added ruby\_parser because that readme says it’s needed to  
parse  
HAML. Yet rake gettext:find explodes on any and all HAML files:

Error parsing app/views/admin/contexts/\_form.html.haml  
rake aborted!

parse error on value “}” (tRCURLY)  
/home/rca/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/racc/parser.rb:349:in  
`on_error' /home/rca/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/racc/parser.rb:99:in `\_racc\_do\_parse\_c’  
/home/rca/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/racc/parser.rb:99:in  
`do_parse' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:750:in `process’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext\_i18n\_rails-0.4.5/lib/gettext\_i18n\_rails/ruby\_gettext\_extractor.rb:55:in  
`run' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext_i18n_rails-0.4.5/lib/gettext_i18n_rails/ruby_gettext_extractor.rb:26:in `parse\_string’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext\_i18n\_rails-0.4.5/lib/gettext\_i18n\_rails/haml\_parser.rb:20:in  
`parse' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:140:in `block (2 levels) in parse’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:134:in  
`each' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:134:in `block in parse’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:132:in  
`each' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:132:in `parse’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:121:in  
`generate_pot' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:223:in `block in run’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:221:in  
`open' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:221:in `run’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools/rgettext.rb:243:in  
`rgettext' /home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext-2.2.0/lib/gettext/tools.rb:128:in `update\_pofiles’  
/home/rca/.rvm/gems/ruby-1.9.2-p318/gems/gettext\_i18n\_rails-0.4.5/lib/gettext\_i18n\_rails/tasks.rb:28:in  
`block (2 levels) in <top (required)>' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in  
`block in execute' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in  
`execute' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke\_with\_call\_chain’  
/home/rca/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in  
`mon_synchronize' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke\_with\_call\_chain’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in  
`invoke' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke\_task’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in  
`block (2 levels) in top_level' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in  
`block in top_level' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard\_exception\_handling’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in  
`top_level' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in  
`standard_exception_handling' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/bin/rake:33:in  
`<top (required)>' /home/rca/.rvm/gems/ruby-1.9.2-p318@global/bin/rake:19:in `load’  
/home/rca/.rvm/gems/ruby-1.9.2-p318@global/bin/rake:19:in `’  
Tasks: TOP =\> gettext:find

The file it’s complaining about is:

[https://github.com/zhdk/madek/blob/next/app/views/admin/contexts/\_form.html.haml](https://github.com/zhdk/madek/blob/next/app/views/admin/contexts/_form.html.haml)

It seems to be valid HAML, it works fine in our app.

Any ideas?

Cheers,

Ramn

---

<div class="post-metadata">

**Author:** ![psy-q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/898d66/32.png) [@psy-q](https://www.ruby-forum.com/u/psy-q)\
**Post date:** [April 4, 2012, 8:34am UTC](https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339/3 "2012-04-04T08:34:53Z")

</div>

Hi yet again,

Sorry for replying to my own post, but I found a workaround: It seems  
that  
ruby\_parser cannot deal with Ruby 1.9 syntax yet, so if your HAML files  
contain any Ruby 1.9 syntax in their Ruby, it will break gettext’s  
gettext:find rake task (it relies on ruby\_parser).

If ruby\_parser ever starts supporting 1.9 syntax or if gettext starts  
using  
a different Ruby parser, this limitation could go away. So until then,  
no  
Ruby 1.9 in your HAML, even on Ruby 1.9.

Cheers,

Ramn

---

<div class="post-metadata">

**Author:** ![psy-q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/898d66/32.png) [@psy-q](https://www.ruby-forum.com/u/psy-q)\
**Post date:** [August 15, 2014, 11:29am UTC](https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339/4 "2014-08-15T11:29:37Z")

</div>

I love all of your recipes!

---

<div class="post-metadata">

**Author:** ![psy-q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/898d66/32.png) [@psy-q](https://www.ruby-forum.com/u/psy-q)\
**Post date:** [August 9, 2013, 4:01pm UTC](https://www.ruby-forum.com/t/rails-3-x-ruby-1-9-x-haml-terror/218339/5 "2013-08-09T16:01:26Z")

</div>

[image: Inline image 1]
