LoginSignup
12
9

More than 3 years have passed since last update.

【Rails】kaminariのページネーションを日本語化する方法

Posted at

kaminariを日本語化する方法

kaminariを日本語化する方法はたったの2ステップです。

ステップ1:ステップ1:config/application.rbを編集

config/application.rbを開いて、以下のコードを書いてください。

config/application.rb
config.i18n.default_locale = :ja

image.png

ステップ2:config/lacales/ja.ymlを作成

次にconfig/lacales/ja.ymlといファイルを作りましょう。

ファイルを作ったら、以下のように記述します。

config/lacales/ja.yml
ja:
  views:
      pagination:
        first: '最初'
        last: '最後'
        previous: '前'
        next: '次'
        truncate: '...'

記述したら、rails sでサーバーを再起動してください。

以下のように、日本語になっていたら成功です。

image.png

12
9
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
12
9