Reputation: 60203
In my Rails3 app I have:
<%= link_to "Sign out", destroy_user_session_path %>
I know how to localize text, but how to localize link text? I defined "sign_out" in tried:
<%= link_to t( sign_out ), destroy_user_session_path %>
But it generates an error:
undefined local variable or method `sign_out'
What is the correct syntax?
PS: It is even more basic than this question, but I could not find any answer.
Upvotes: 0
Views: 525
Reputation: 9167
<%= link_to t(:sign_out), destroy_user_session_path %>
or
<%= link_to t('sign_out'), destroy_user_session_path %>
You can check other details here.
Upvotes: 1
Reputation: 2526
<%= link_to t('sign_out'), destroy_user_session_path %>
And you must define the key sign_out: in your local yml file after
Upvotes: 1