[Rails] Japanese localization of error messages

Overview

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.

bcb5b66aaa2336c94683fe2b94ccc49d.png

environment

Ruby 2.6. Ruby on Rails 6.0.0

procedure

① 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

[Rails] Japanese localization of error messages
Japanese localization of error messages
Introduction of Rspec and Japanese localization of error messages
[Rails] Japanese localization of error message when using Form object
Japanese localization of Eclipse
[Ruby on Rails] Individual display of error messages
[Rails] Japanese localization using rails-i18n
[Japanese localization of gem: devise]
Japaneseization of Rails error messages [devise / Form objects, etc.]
[Rails] Display form error messages asynchronously
[Rails] Validation settings and Japanese localization
[Rails] How to display error messages individually
Testing for Error Messages: Rails Tutorial Notes-Chapter 7
Japanese localization of CentOS 8 and Japanese keyboard layout
[Ruby on Rails] Japanese notation of errors
How to display error messages in Japanese
The road to Japaneseizing Rails devise error messages
[Rails] Let's translate the error message into Japanese
[Japanese localization] i18n rails Easy Japanese localization view display only
[Rails] How to get success and error messages
[Note] Rails error list
About Ruby error messages
Catch Rails Routing Error
[Rails] Introduction of PAY.JP
Mac Rails Install Error
I made a Japanese version of Rails / devise automatic email
[Rails] Workaround for classes automatically generated by devise error messages
Japanese localization of Docker container of CentOS7 / CentOS8 and Japan time setting
Rails implementation of ajax removal
[Rails] Introduction of devise Basics
Cleansing processing of Japanese sentences
[Rails] Japanese longest surname (validation)
rails error Library not loaded
Utilization of Rails Boolean type
[Rails] Implementation of category function
Error when using rails capybara
[Rails] Implementation of tutorial function
[Rails] Creation of the second vertical axis and Japanese localization in graph drawing using amCharts4, etc.
[Rails] Implementation of like function
[rails] error during devise installation
Summary of java error processing
[Rails] About Uglifier :: Error: Unexpected token: at the time of deployment