Jan 17

The current will_paginate plugin doesn’t support localization. Adding the following code into the application_helper will enable i18n for will_paginate.


include WillPaginate::ViewHelpers

def will_paginate_with_i18n(collection, options = {})
will_paginate_without_i18n(collection, options.merge(:previous_label => I18n.t(:previous), :next_label => I18n.t(:next)))
end

alias_method_chain :will_paginate, :i18n

And add ‘next’ and ‘previous’ attribute in the locales file.

for example zh.yml under RAILS_ROOT/config/locales

zh:
previous: '前一页'
next: '下一页'