rails-i18n(Gem) A Gem that can handle Japanese.
A file required to translate all error messages into Japanese, and a file that can be used in various languages. By creating a file for Japanese localization in this, you can translate English into Japanese.
config/application.rb
require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
module Asakatu5757
class Application < Rails::Application
config.load_defaults 6.0
config.i18n.default_locale = :ja
config.time_zone = 'Tokyo'
end
end
The description added this time is "** config.i18n.default_locale =: ja **", and it can be made into the standard language Japanese.
Gemfile
gem 'rails-i18n'
Terminal
% bundle install
Example) When the nickname column of the User model is translated into Japanese.
config/locales/ja.yml
ja:
activerecord:
attributes:
user:
nickname:nickname
Recommended Posts