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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Tommaso Visconti
2012-Oct-30 11:16 UTC
Re: why is not passing model in locale flash message?
Il 30/10/12 12:12, Mauro ha scritto:> 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?Maybe you should pass model as argument? t(''flash.actions.update.notice'', :model => @unsafe_building.class) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On 30 October 2012 12:16, Tommaso Visconti <tommaso.visconti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Il 30/10/12 12:12, Mauro ha scritto: > >> 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? > > > 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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Tommaso Visconti
2012-Oct-30 11:45 UTC
Re: why is not passing model in locale flash message?
Il 30/10/12 12:40, Mauro ha scritto:>> 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?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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.