Since I am creating an application with a young target age, I wanted to translate the error message into Japanese, so I introduced it.
In Gemfile
① Describe rails-i18n
.
②
config/application.rb
module app name
class Application < Rails::Application
(Omission)
config.i18n.default_locale = :ja
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
end
end
Add the bottom two lines starting from config.
③ Create ja.yml under config / locales / models.
config/locales/models/ja.yml
ja:
activerecord:
models:
Model name:Japanese translation of model name
attributes:
Model name:
Column name:Japanese translation of column names
Other models and columns can be added.
Recommended Posts