[RUBY] How to display error messages in Japanese

1. Describe config.i18n.default_locale =: ja

config/application.rb
 class Application < Rails::Application
   #Japanese language setting
   config.i18n.default_locale = :ja
  #abridgement
end

Install 2rails-i18n

#Gemfile
gem 'rails-i18n'

After writing Terminal bundle install

Japanese registered in rails-i18n https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/ja.yml

Now I can translate what is written in rails-i18n However, other words have not been translated into Japanese.

3 Create a Japanese localization file for login

config>locales>devise.ja.yml Create a file

Copy the Japanese translation of devise and paste it into the devise.ja.yml you just created https://github.com/tigrish/devise-i18n/blob/master/rails/locales/ja.yml

4 Create a Japanese translation file (ja.yml) for other forms

config>locals>ja.yml

ja:
 activerecord:
   attributes:
     user:
       nickname:nickname
     tweet:
       text:text
       image:image

The nickname of the user table is translated into Japanese The text of the tweet table is translated into Japanese image is translated into Japanese

Recommended Posts

How to display error messages in Japanese
[Rails] How to display error messages individually
[Ruby on Rails] How to display error messages
[Rails] How to display error messages for comment function (for beginners)
How to display a web page in Java
Settings to display Japanese Javadoc in IntelliJ IDEA
How to translate Rails into Japanese in general
Convert error messages to Japanese Supports multiple tables
[Rails] How to convert UC time display to Japanese time display
How to display error messages and success messages when registering as a user
Japanese localization of error messages
How to set the display time to Japan time in Rails
Japanese localization of error messages
[Ruby on Rails] How to write enum in Japanese
[Java] How to display Wingdings
[Rails] validates How to translate error sentences into Japanese
How to display a browser preview in VS Code
Display Flash messages in Rails
[RSpec] How to test error messages set by Shoulda-Matchers
[Rails] How to display an image in the view
How to resolve SSL_connect error in PayPal Ruby SDK
[Java] How to display the day of the week acquired by LocalDate, DateTimeformatter in Japanese
[Rails] How to display the weather forecast of the registered address in Japanese using OpenWeatherMap
How to display a graph in Ruby on Rails (LazyHighChart)
How to implement one-line display of TextView in Android development
[Rails] How to display information stored in the database in view
[Rails] Japanese localization of error messages
How to use Lombok in Spring
How to find May'n in XPath
How to hide scrollbars in WebView
[Rails] How to use flash messages
[rails] How to display db information
How to iterate infinitely in Ruby
How to run Ant in Gradle
How to master programming in 3 months
[Rails] Display form error messages asynchronously
How to learn JAVA in 7 days
How to install Bootstrap in Ruby
How to use InjectorHolder in OpenAM
Japanese localization of error messages (rails)
Animated display of Swift error messages
How to introduce jQuery in Rails 6
How to use classes in Java?
How to name variables in Java
How to set Lombok in Eclipse
How to concatenate strings in java
How to install Swiper in Rails
How to deal with 405 Method Not Allowed error in Tomcat + JSP
How to fix garbled Japanese characters in JAVA (including Arduino IDE)
[Behavior confirmed in December 2020] How to implement the alert display function
What to do if you get a DISPLAY error in gym.render ()
How to solve the unknown error when using slf4j in Java
[swift5] How to specify color in hexadecimal
How to implement date calculation in Java
How to implement Kalman filter in Java
Multilingual Locale in Java How to use Locale
How to change app name in rails
I want to eliminate duplicate error messages
How to use custom helpers in rails
How to reflect seeds.rb in production environment
How to use named volume in docker-compose.yml