Here are the steps to translate the Rails application error message into Japanese. The following message is output when there is no input or incompleteness on the settlement screen.
Ruby 2.6. Ruby on Rails 6.0.0
① Described in config / application.rb
module Pictweet
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
#Japanese language setting
config.i18n.default_locale = :ja
#abridgement
end
end
② Described in gemfile
gem ‘rails-i18n'
Execute bundle install
③ Copy the code of the following URL to config / locales / devise.en.yml https://github.com/tigrish/devise-i18n/blob/master/rails/locales/ja.yml
④ Create ja.yml in config / locales
ja:
activerecord:
attributes:
user:
nickname:nickname
tweet:
text:text
image:image
With this description, Nickname, Text and Image will be translated into Japanese!
Recommended Posts