How can change the text that will_paginate shows?
Right now, it renders Previous ... Next
. I need to put that in french Précédent ... Suivant
. I checked on google and got this link : http://thewebfellas.com/blog/2010/8/22/revisited-roll-your-own-pagination-links-with-will_paginate-and-rails-3
However, I was wondering if there was an easier way.
You can override the default of Previous and Next this way:
<%= will_paginate @posts, :previous_label => 'Précédent', :next_label => 'Suivant' %>
Note: :previous_label
was called :prev_label
in versions 2.3.2 and older
So you have to ensure that the following is in place:
application.rb
the default locale (german for me): config.i18n.default_locale = :de
The directory config/locales
contains a file fr.yml
with the following content (there could be more customization):
views:
pagination:
first: "F"
previous: "« Prev"
next: "Next »"
last: "L"
truncate: "..."
This works for me in the current version of Rails 3.2.2 with gem 'will_paginate', '>= 3.0'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With