Why is not passing model in locale flash message?

def update

if @unsafe_building.update_attributes(params[:company])
format.html { redirect_to @unsafe_building, notice:
t(‘flash.actions.update.notice’) }

in it.yml locale file I have:

it:
flash:
actions:
create:
notice: “%{model} stato creato con successo.”
update:
notice: “%{model} stato modificato con successo.”

The message, when I update, is:

%{model} stato modificato con successo.

Why %{model} is not translated?

Il 30/10/12 12:12, Mauro ha scritto:

 actions:
   create:
     notice: "%{model} č stato creato con successo."
   update:
     notice: "%{model} č stato modificato con successo."

The message, when I update, is:

%{model} č stato modificato con successo.

Why %{model} is not translated?

Maybe you should pass model as argument?

t(‘flash.actions.update.notice’, :model => @unsafe_building.class)

On 30 October 2012 12:16, Tommaso V. [email protected]
wrote:

it:

Why %{model} is not translated?

Maybe you should pass model as argument?

t(‘flash.actions.update.notice’, :model => @unsafe_building.class)

Yes, now model is passed but not translated.

Here:

submit:
create: ‘Crea %{model}’
update: ‘Aggiorna %{model}’
submit: ‘Invia %{model}’

the model is translated in italian, so why

flash:
actions:
create:
notice: “%{model} č stato creato con successo.”

does not translate?

Il 30/10/12 12:40, Mauro ha scritto:

   update: 'Aggiorna %{model}'
   submit: 'Invia %{model}'

the model is translated in italian, so why

flash:
actions:
create:
notice: “%{model} č stato creato con successo.”

does not translate?

The submit tag uses interpolation passing %{model}:
http://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-submit

I don’t think flashes use it

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs