Reputation: 477
I am using the twitter-bootstrap-rails
gem in my app. It seems to come with a range of helper methods that create for example the edit and delete buttons in a themed view:
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
cohort_path(cohort),
:method => :delete,
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-mini btn-danger' %>
Where are these t() methods and helpers defined? How can I alter them? For example, if I want to change the label on the Destroy button to "Delete" I can change the above to:
<%= link_to t('.destroy', :default => "Delete"),
cohort_path(cohort),
:method => :delete,
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-mini btn-danger' %>
What I would really like to do is change t("helpers.links.destroy")
to display "Delete" instead of "Destroy" in all my views. Can I do that? Appreciate your help!
Upvotes: 4
Views: 1441
Reputation: 41
All you have to do is add the following to your i18n Rails file (in path "config/locales/en.yml"):
<pre>
en:
helpers:
links:
back: "Back Page"
destroy: "Delete"
</pre>
The method t() is using to i18n a Rails Application.
Upvotes: 4