Ruby Forum Rails I18n > Problems using Gettext 1.90.0 update_pofiles

Posted by Vaughan Jackson (vaughanjackson)
on 27.04.2008 17:00
Hi,

I'm a newbie to Ruby and Rails. I am following Sascha Ebach's tutorial
on Gettext at http://manuals.rubyonrails.com/read/chapter/105#page298.
This tutorial describes a step in which update_pofiles is used to
generate the .pot and .po files from .rb and .rhtml files containing
gettext calls. However, when I try to use this from rake, it only seems
to partially succeed. I see this error:

C:\Users\Vaughan\Ruby\test_app>rake updatepo --trace
(in C:/Users/Vaughan/Ruby/test_app)
** Invoke updatepo (first_time)
** Execute updatepo
po/testapp.pot
rake aborted!
No such file or directory - msgmerge po/testapp.pot tmp.pot
c:/ruby/lib/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/utils.rb:51:in
``'
c:/ruby/lib/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/utils.rb:51:in
`msgmer
ge'
c:/ruby/lib/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/utils.rb:74:in
`msgmer
ge_all'
c:/ruby/lib/ruby/gems/1.8/gems/gettext-1.90.0/lib/gettext/utils.rb:123:in
`updat
e_pofiles'
C:/Users/Vaughan/Ruby/test_app/lib/tasks/updatepo.rake:14
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in
`invoke_with_call_c
hain'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
`synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
`invoke_with_call_c
hain'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in
`invoke_task'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
`standard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in
`top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
`standard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
c:/ruby/bin/rake:19:in `load'
c:/ruby/bin/rake:19

This produced a testapp.pot file, but no .po files in the relevant
subdirectories.
The content of the testapp.pot included:

#: app/controllers/application.rb:6
msgid "blah"
msgstr ""

I tried changing utils.rb to call rmsgmerge instead of msgmerge, but
this seemed to make things worse, as I ended up with a testapp.pot only
with no msgid/msgstr pairs in it (the error message disappears).

What am I doing wrong?

Thanks,
Vaughan.
Posted by Max Lindholm (mrmax1984)
on 29.04.2008 19:49
Make the language-specific subdirectories in /po by hand, then copy the 
.pot file in to each of the folders, renaming it to .po in the process. 
Now, running updatepo will update the template as well as the .po files 
automatically. This is how I've always done it, as I don't believe that 
the rake task creates the directories and copies the files for you.

Hope this helps,
Max
Posted by Vaughan Jackson (vaughanjackson)
on 01.05.2008 19:57
Hi Max,

Yes, that's it! I just need to ignore the error messages
generated by the rake updatepo step and create the .po
files by hand as you say.

Thanks for your help,
Vaughan.