如何更改will_paginate顯示的文字?更改文字will_paginate呈現
現在,它呈現Previous ... Next
。我需要用法語Précédent ... Suivant
。我檢查了谷歌,並得到這個鏈接:http://thewebfellas.com/blog/2010/8/22/revisited-roll-your-own-pagination-links-with-will_paginate-and-rails-3
但是,我想知道是否有一個更簡單的方法。
如何更改will_paginate顯示的文字?更改文字will_paginate呈現
現在,它呈現Previous ... Next
。我需要用法語Précédent ... Suivant
。我檢查了谷歌,並得到這個鏈接:http://thewebfellas.com/blog/2010/8/22/revisited-roll-your-own-pagination-links-with-will_paginate-and-rails-3
但是,我想知道是否有一個更簡單的方法。
你可以根據一個和下一個這樣override the default:
<%= will_paginate @posts, :previous_label => 'Précédent', :next_label => 'Suivant' %>
注::previous_label
在2.3.2和版本稱爲:prev_label
年長
所以,你必須確保以下到位:
application.rb
設置默認的語言環境(德語對我來說):config.i18n.default_locale = :de
目錄config/locales
包含文件fr.yml
,內容如下(可能有更多的自定義):
views:
pagination:
first: "F"
previous: "« Prev"
next: "Next »"
last: "L"
truncate: "..."
該作品對於我在當前版本的Rails 3.2.2中使用gem 'will_paginate', '>= 3.0'
。