views:

15

answers:

1

I have a validation message

self.errors.add_to_base(_("country cannot be deleted #{self.country_name}")) 

this is not working.

But simple messages like

self.errors.add_to_base(_("country cannot be deleted"))

working fine.

I am converting this messages to spanish.

Any idea or solution?

+1  A: 

I believe you need to use a parameter in the call to gettext and then interpolate that with the value you want to pass in. E.g.

self.errors.add_to_base(_("country cannot be deleted %{country}") % { :country => self.country_name})

More information here.

Shadwell