views:

27

answers:

1

HI ,

In ROR , i m having a line like

     <%= link_to("NAME (#{@name})", user_path(@user, :in => :s)) %>

i want to change the string NAME to t(:str_name) ..

how to change it . when i change it , i am getting errors..

A: 

Put your translation in corresponding .yml files in /config/locales For example in /config/locales/en.yml

en:
  link_text:
    name: "Name (%{:name})"

Then from your views:

<%= link_to(t('link_text.name', :name => @name), user_path(@user, :in => :s)) %>
Yannis