Forum: Ruby on Rails Multilingual Validation Messages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nickolay K. (Guest)
on 2006-03-08 17:50
(Received via mailing list)
Hi all,

I have a mutilingual app and want to customize the validation error
messasges. I cannot override them as I need them in more than one
language, so I have done the following:

validates_presence_of :some_attr, :message => _('should not be blank')

I am using gettext to translate the message.

This works in development mode, but not in production, even after a
server restart and the killing of all fcgi processes, i.e. a
completely fresh server. Why is that so and how can I remedy tha
situation?

Many thanks in advance,
- Nicky
Masao M. (Guest)
on 2006-03-09 17:36
(Received via mailing list)
Hi,

On Wed, 8 Mar 2006 16:49:55 +0100
Nickolay K. <removed_email_address@domain.invalid> wrote:

> This works in development mode, but not in production, even after a
> server restart and the killing of all fcgi processes, i.e. a
> completely fresh server. Why is that so and how can I remedy tha
> situation?

This was a bug of Ruby-GetText-Package.
# I misunderstood the difference between development and
# production mode.

I've fixed it and applied it to CVS just now.

But you will need to call N_() instead of _():

 validates_presence_of :some_attr, :message => N_('should not be blank')

Please try CVS version or wait the next release of Ruby-GetText-Pacakge.
#I'll release it soon.
Nickolay K. (Guest)
on 2006-03-10 09:25
(Received via mailing list)
> I've fixed it and applied it to CVS just now.

Thanks for the quick reaction. I ended up translating the whole
messages by hand as they were just a few and I needed it pretty
quickly. But it is good to know that it works now.

Thanks again!

-- Nicky
This topic is locked and can not be replied to.