[RUBY] [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 (rails)
Japanese localization of error messages
Japanese localization of error messages
Rails: Japanese localization of validation messages including devise
[Rails] Japanese localization of validation error message ~ ja.yml ~
Introduction of Rspec and Japanese localization of error messages
[Rails] Japanese localization of error message when using Form object
Japanese localization of Ubuntu20.04
Japanese localization of Eclipse
Rails error messages cannot be translated into Japanese
[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
From Ruby on Rails error message display to Japanese localization
[Rails] Validation settings and Japanese localization
Animated display of Swift error messages
[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
[Ruby on Rails] How to display error messages
[Rails] Let's translate the error message into Japanese
[Japanese localization] i18n rails Easy Japanese localization view display only
Convert error messages to Japanese Supports multiple tables
[Rails] How to get success and error messages
About Ruby error messages
Implementation of flash messages
One case of solving a migration error in Rails
Catch Rails Routing Error
[Rails] Introduction of PAY.JP
[Rails error] unexpected tIDENTIFIER
Mac Rails Install Error
Rails Tutorial/Significance of Indexing
[Rails] validates How to translate error sentences into Japanese
rails heroku error log
rails error resolution summary
[Rails] Create initial data with seed.rb [Faker] [Japanese localization]
[Note] Error message when using Rails Form object pattern Japanese
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] How to display error messages for comment function (for beginners)
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 6] Implementation of search function
[Rails] Implementation of category function
Error in rails db: migrate
Display Flash messages in Rails
[Rails] Rails version upgrade error memorandum
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.