# Generic Tranlation for controllers

**URL:** <https://www.ruby-forum.com/t/generic-tranlation-for-controllers/201413>\
**Category:** Rails I18n\
**Created:** [January 6, 2011, 10:47pm UTC](https://www.ruby-forum.com/t/generic-tranlation-for-controllers/201413 "2011-01-06T22:47:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 6, 2011, 10:47pm UTC](https://www.ruby-forum.com/t/generic-tranlation-for-controllers/201413/1 "2011-01-06T22:47:09Z")

</div>

I need something to translate

format.html { redirect\_to(@news, :notice =\> ‘News was successfully  
created.’) }

This --\> ‘News was successfully created.’

so I make

controller\_created: “%{model} was successfully created”

For using it on every controller, but on the browser Im getting

%{model} was successfully created, so %{model} isn’t replaced by the  
model name, Is there a way of doing this?

---

<div class="post-metadata">

**Author:** ![josetomas\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@josetomas\_r](https://www.ruby-forum.com/u/josetomas_r)\
**Post date:** [January 7, 2011, 12:24pm UTC](https://www.ruby-forum.com/t/generic-tranlation-for-controllers/201413/2 "2011-01-07T12:24:38Z")

</div>

Hi,  
I’m not 100% sure, but I think you have to close the -\>"" and add %  
(model).name.to\_s or %(model).to\_s !!
