LoginSignup
18
13

More than 5 years have passed since last update.

kaminariの日本語対応

Posted at

ページネーション用のgem、kaminari の日本語化。
kaminari用のファイルを新たに作ると管理しやすいかと。

config/locales/kaminari_ja.yml
ja:
  views:
    pagination:
      first: "« 最初"
      last: "最後 »"
      previous: "‹ 前"
      next: " ›"
      truncate: "..."
  helpers:
    page_entries_info:
      one_page:
        display_entries:
          zero: ""
          one: "<strong>1-1</strong>/1件中"
          other: "<strong>1-%{count}</strong>/%{count}件中"
      more_pages:
        display_entries: "<strong>%{first}-%{last}</strong>/%{total}件中"

参考
- kaminariのpage_entries_info はデフォルトだと英語環境でしか使えないので対応 - Qiita
- 【Ruby on Rails】gem(Kaminari)でページネーション機能を追加してBootstrapを適用する。 - Qiita

18
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
13