0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

rails 日本語にする!

Posted at

はじめに

今回はrails6でgemをインストールした際に、日本語ではない場合があります。
日本語に変更したい場合に、ファイルに記述することで日本語に変更することができます。
今回simple_calendarをgemでインストールしましたので、そのgemのカレンダーを日本語にしてみたいと思います。

開発環境

macOs: catalina
rails: 6.0.0
ruby: 2.7.2

方法

まずはsimple_calendarを導入します。
こちらはどこに記述しても構いません

gem  'simple_calendar', '~> 2.4'
次に
bundle install

このままではカレンダーが英語のままです。
日本語にしたい場合は、gemをインストールして、以下のコードをファイルに指定します。

gemfile
gem 'rails-i18n'
bundle install
application.rb
module Scheduler
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 6.0
    config.i18n.default_locale = :ja これを追加
    // 省略
  end
end

これでカレンダーは日本語に変わります。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?