I have 8 controllers using will_paginate to paginate their index pages. I\'d like to override the defaults for \"Previous\" and \"Next\" on each without having to specify the s
will_paginate uses I18n so you can just use that.
Given you use English as the default locale the following line should be present in application.rb
:
config.i18n.default_locale = :en
you can then change the text of the pagination links by adding the following to config/locales/will_paginate.en.yml
:
en:
will_paginate:
previous_label: "← go back"
next_label: "go forward →"
Alternatively you can add them to your default translations file: config/locales/en.yml
but I have found that it quickly becomes to large to handle.
Note: If you use another locale, for instance es
, for this to work you need to at least replace the en:
keys within the YAML files to es:
and to be concise about naming your files,
use either config/locales/will_paginate.es.yml
or config/locales/es.yml
.