--I want to replace the parts written in English such as error messages with Japanese. --When displaying DB column names and class attributes, I want to display the ones that have been replaced with Japanese in advance.
--Set the word you want to convert in the
#The place to write is at the bottom of the file or group:development, group :development, :Described in a place other than test gem 'rails-i18n'
--Set the ** default locale in
config / application.rb to ja **
#↑ Codes above this are omitted module App class Application < Rails::Application config.i18n.default_locale = :ja config.time_zone = 'Tokyo' end end
--Create a file of
config / locales / ja.yml
ja.yml, describe the settings you want to convert to Japanese in
Example: Characters related to DB columns → ʻactiverecord: attributes: Model name:
<br /> Characters related to view → views: resource name:`
ja: activerecord: attributes: user: name:username email:Email password:password password_confirmation:Password confirmation) tweet: name:name title:title body:Text comment: name:name comment:comment views: pagination: first:the first last:last previous:Before next:Next truncate: ...
--When the settings are complete, restart the server (because it will not be reflected unless you do this)