# Gettext does not work, but no errors!

**URL:** <https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150>\
**Category:** Rails\
**Created:** [March 28, 2008, 10:44am UTC](https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150 "2008-03-28T10:44:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@asoto](https://www.ruby-forum.com/u/asoto)\
**Post date:** [March 28, 2008, 10:44am UTC](https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150/1 "2008-03-28T10:44:57Z")

</div>

Hi  
I have a problem with gettext. I did some eays steps from a forum wihout  
any problems:

1. Replace Strings with \_(‘balbalbal’)
2. build po file with rake-task /po/de\_DE/domain.po
3. Edit this file
4. build mo file with rake-task /locale/de\_DE/LC\_MESSAGES/domain.mo
5. insert “require ‘gettext/rails’” and “init\_gettext ‘domain’” to  
applicationController

If I start my application it works without any error-message but the  
Strings are not replaced with strings from the domian.mo file. If I  
check GetText.local it is “de\_DE”! So why does it not work?

I also fount out this: If I remove “require ‘gettext/rails’” from  
ApplicationController the init\_gettext method already works without  
errors. I don’t know why.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![asoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@asoto](https://www.ruby-forum.com/u/asoto)\
**Post date:** [March 29, 2008, 11:53am UTC](https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150/2 "2008-03-29T11:53:44Z")

</div>

I also get exactly the same problem. Have you found any solution yet.

What do you mean by "f I remove “require ‘gettext/rails’” from

> ApplicationController the init\_gettext method already works without  
> errors."? Does this mean you have already made it working?

Thanks.

On Mar 28, 8:44 pm, Alex S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![asoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@asoto](https://www.ruby-forum.com/u/asoto)\
**Post date:** [March 29, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150/3 "2008-03-29T12:06:43Z")

</div>

We also got the same problem on Fedora Linux 8 and RH enterprise  
server 5.

However, it seems ok for Ubuntu. I tried all the fixes and ideas  
available from the forums, but cannot make it working for FC8 and RH  
ES5.

The problem is some like this:

1. It works for error messages, for example, those for validations in  
model files.
2. It does not working for all the translations in templates in app/  
views directory.
3. There is no error message at all for rake tasks and the pot and mo  
files are generated ok.

Masao, I suggest you have a close look into this issue.

Thanks.

On Mar 28, 8:44 pm, Alex S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![asoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@asoto](https://www.ruby-forum.com/u/asoto)\
**Post date:** [March 29, 2008, 12:24pm UTC](https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150/4 "2008-03-29T12:24:45Z")

</div>

Hi,

I fount a solution. But at first a comment:

> What do you mean by "f I remove “require ‘gettext/rails’” from
> 
> > ApplicationController the init\_gettext method already works without  
> > errors."? Does this mean you have already made it working?

With no errors I mean no exceptions in error log!

So the solution was very easy: I switched from Rails 1.2.3 to 2.0.2!  
Thats all! I worked with a tutorial which based on 1.2.3. In this  
tutorial was also a descrition of gettext, but without any comment about  
the version of gettext. I think the latest Version of gettext does not  
work with some old rails version.

---

<div class="post-metadata">

**Author:** ![asoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@asoto](https://www.ruby-forum.com/u/asoto)\
**Post date:** [March 29, 2008, 3:07pm UTC](https://www.ruby-forum.com/t/gettext-does-not-work-but-no-errors/133150/5 "2008-03-29T15:07:31Z")

</div>

No, it seems we have different problems.

I am using Rails 2.0.2 and Ruby 1.8.6. Both are the newest versions.  
Only validation error messages in models are displayed based on  
locale.  
This seems OS package dependent, since we do not have the problem with  
Ubuntu but only for RH Linux.

Anyone can help?

Thanks,

On 3ÔÂ29ÈÕ, ÏÂÎç10Ê±24·Ö, Alex S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
