Forum: Rails I18n Rails 3.x, Ruby 1.9.x + HAML = Terror?

38679f9f3d546cc3214bf02e560fc2d0?d=identicon&s=25 Ramon Cahenzli (psy-q)
on 2012-03-28 16:47
(Received via mailing list)
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
38679f9f3d546cc3214bf02e560fc2d0?d=identicon&s=25 Ramon Cahenzli (psy-q)
on 2012-03-30 14:19
(Received via mailing list)
Hi again,

Perhaps some more context. I've added the gems to my Gemfile as
instructed
here: 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 `<main>'
Tasks: TOP => gettext:find


The file it's complaining about is:

https://github.com/zhdk/madek/blob/next/app/views/...

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

Any ideas?

Cheers,

Ramn
38679f9f3d546cc3214bf02e560fc2d0?d=identicon&s=25 Ramon Cahenzli (psy-q)
on 2012-04-04 08:34
(Received via mailing list)
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
B08130c062fb41479f7e1c3b33e75a7c?d=identicon&s=25 top 3. (top_3)
on 2013-08-09 06:24
منتديات توب عرب للمبدعين احساس منتديات عامة
افضل المنتديات العربية
http://www.top3rab.mrsaal.com
http://www.top3rab.mrsaal.com/forums/toparab10
http://www.top3rab.mrsaal.com/forums/toparab14
http://www.top3rab.mrsaal.com/forums/toparab41
http://www.top3rab.mrsaal.com/forums/toparab47
http://www.top3rab.mrsaal.com/forums/toparab54
http://www.top3rab.mrsaal.com/forums/toparab49
http://www.top3rab.mrsaal.com/forums/toparab49
http://www.top3rab.mrsaal.com/forums/toparab48
http://www.top3rab.mrsaal.com/forums/toparab48
http://www.top3rab.mrsaal.com/forums/toparab50
http://www.top3rab.mrsaal.com/forums/toparab51
http://www.top3rab.mrsaal.com/forums/toparab52
http://www.top3rab.mrsaal.com/forums/toparab53
http://www.top3rab.mrsaal.com/forums/toparab53
http://www.top3rab.mrsaal.com/forums/toparab55
http://www.top3rab.mrsaal.com/forums/toparab56
http://www.top3rab.mrsaal.com/forums/toparab57
http://www.top3rab.mrsaal.com/forums/toparab57
http://www.top3rab.mrsaal.com/forums/toparab58
http://www.top3rab.mrsaal.com/forums/toparab59
http://www.top3rab.mrsaal.com/forums/toparab60
http://www.top3rab.mrsaal.com/forums/toparab61
http://www.top3rab.mrsaal.com/forums/toparab62
http://www.top3rab.mrsaal.com/forums/toparab62
http://www.top3rab.mrsaal.com/forums/toparab64
http://www.top3rab.mrsaal.com/forums/toparab65
http://www.top3rab.mrsaal.com/forums/toparab66
http://www.top3rab.mrsaal.com/forums/toparab67
http://www.top3rab.mrsaal.com/forums/toparab67
http://www.top3rab.mrsaal.com/forums/toparab68
http://www.top3rab.mrsaal.com/forums/toparab69
http://www.top3rab.mrsaal.com/forums/toparab69
http://www.top3rab.mrsaal.com/forums/toparab70/
http://www.top3rab.mrsaal.com/forums/toparab71
http://www.top3rab.mrsaal.com/forums/toparab72
http://www.top3rab.mrsaal.com/forums/toparab72
http://www.top3rab.mrsaal.com/forums/toparab73
http://www.top3rab.mrsaal.com/forums/toparab74
http://www.top3rab.mrsaal.com/forums/toparab75
http://www.top3rab.mrsaal.com/forums/toparab75
http://www.top3rab.mrsaal.com/forums/toparab75
http://www.top3rab.mrsaal.com/forums/toparab76
http://www.top3rab.mrsaal.com/forums/toparab76
http://www.top3rab.mrsaal.com/forums/toparab77
http://www.top3rab.mrsaal.com/forums/toparab78
http://www.top3rab.mrsaal.com/forums/toparab79
http://www.top3rab.mrsaal.com/forums/toparab79
http://www.top3rab.mrsaal.com/forums/toparab80
http://www.top3rab.mrsaal.com/forums/toparab80
http://www.top3rab.mrsaal.com/forums/toparab81
http://www.top3rab.mrsaal.com/forums/toparab81
http://www.top3rab.mrsaal.com/forums/toparab81
http://www.top3rab.mrsaal.com/forums/toparab82
http://www.top3rab.mrsaal.com/forums/toparab82
http://www.top3rab.mrsaal.com/forums/toparab82
http://www.top3rab.mrsaal.com/forums/toparab42
http://www.top3rab.mrsaal.com/forums/toparab43
http://www.top3rab.mrsaal.com/forums/toparab43
http://www.top3rab.mrsaal.com/forums/toparab45
http://www.top3rab.mrsaal.com/forums/toparab46
http://www.top3rab.mrsaal.com/forums/toparab44
http://www.top3rab.mrsaal.com/forums/toparab44
7e565a1681dc0137f43826aa840686af?d=identicon&s=25 "Andrés Mejía" <andmej@gmail.com> (Guest)
on 2013-08-09 16:01
(Received via mailing list)
[image: Inline image 1]
30e0434c99d6ddbfcaa733288790de7b?d=identicon&s=25 Maggie Davis (withful)
on 2014-08-15 11:29
I love all of your recipes!
A73fe11679ad1f865d835e60596e5c98?d=identicon&s=25 Greek Store (greek21)
on 2014-10-14 18:12
[Delta Delta Delta Dolphin] Dolphin Dolphin Dolphin~ So cute! Kawaiii
http://greek21.com/images/DDD-P007.jpg

[Delta Gamma Anchor] Hard Anchor, It can not be distoryed!
http://greek21.com/images/DG-P004.jpg
This topic is locked and can not be replied to.