# Help with Gettext

**URL:** <https://www.ruby-forum.com/t/help-with-gettext/129367>\
**Category:** Rails\
**Created:** [February 17, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/help-with-gettext/129367 "2008-02-17T19:54:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 17, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/help-with-gettext/129367/1 "2008-02-17T19:54:42Z")

</div>

I have .rhtml.erb files to use Gettext with them, but it doesn’t wok  
always with all the \<%= \_(’ ') %\> text. Why?

My rakefile has that:

desc “Update po/pot files”  
task :updatepo do  
MY\_APP\_DOMAIN = “prob”  
MY\_APP\_VERSION = “1.0”  
GetText.update\_pofiles(MY\_APP\_DOMAIN,  
Dir.glob("{app,lib}/\*\*/\*.{rb,html.erb}"),  
MY\_APP\_VERSION)

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 21, 2008, 2:01pm UTC](https://www.ruby-forum.com/t/help-with-gettext/129367/2 "2008-02-21T14:01:00Z")

</div>

Hi John, maybe you’re using .rhtml files? I mean, instead of .html.erb.

To make your rake task find translatable strings on .rhtml as well,  
change  
this line:

```
                     Dir.glob("{app,lib}/**/*.{rb,html.erb}"),

```

to:

```
                     Dir.glob("{app,lib}/**/*.{rb,rhtml,erb}"),

```

Here goes my localization.rake:  
################################  
require ‘gettext/utils’  
desc “Create mo-files”  
task :makemo do  
GetText.create\_mofiles(true, “po”, “locale”)  
end

desc “Update pot/po files to match new version.”  
task :updatepo do  
TEXT\_DOMAIN = “myapp”  
APP\_VERSION = “myapp 1.1.0”  
GetText.update\_pofiles(TEXT\_DOMAIN,  
Dir.glob(“{app,lib}/\*\*/\*.{rb,rhtml,erb}”),  
APP\_VERSION)  
end  
################################

Hope this helps!  
Jaime

2008/2/17, John S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> ## MY\_APP\_VERSION = “1.0” GetText.update\_pofiles(MY\_APP\_DOMAIN, Dir.glob(“{app,lib}/\*\*/\*.{rb,html.erb}”), MY\_APP\_VERSION)
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Jaime I.  
[http://jaimeiniesta.com](http://jaimeiniesta.com) - [http://railes.net](http://railes.net)
