[RUBY] Japanese localization of error messages

Introduction

Since I am creating an application with a young target age, I wanted to translate the error message into Japanese, so I introduced it.

Japanese localization of error messages

In Gemfile ① Describe rails-i18n.

config/application.rb


module app name
  class Application < Rails::Application
    (Omission)
    config.i18n.default_locale = :ja
    config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
  end
end

Add the bottom two lines starting from config.

③ Create ja.yml under config / locales / models.

config/locales/models/ja.yml


ja:
  activerecord:
    models:
Model name:Japanese translation of model name
    attributes:
Model name:
Column name:Japanese translation of column names

Other models and columns can be added.

Recommended Posts

Japanese localization of error messages
Japanese localization of error messages
[Rails] Japanese localization of error messages
Japanese localization of error messages (rails)
Introduction of Rspec and Japanese localization of error messages
Japanese localization of Ubuntu20.04
Japanese localization of Eclipse
Rails: Japanese localization of validation messages including devise
[Rails] Japanese localization of validation error message ~ ja.yml ~
[Japanese localization of gem: devise]
Animated display of Swift error messages
[Rails] Japanese localization of error message when using Form object
Japanese localization of CentOS 8 and Japanese keyboard layout
How to display error messages in Japanese
Rails error messages cannot be translated into Japanese
Convert error messages to Japanese Supports multiple tables
[Ruby on Rails] Individual display of error messages
About Ruby error messages
Implementation of flash messages
Japaneseization of Rails error messages [devise / Form objects, etc.]
Cleansing processing of Japanese sentences
[Rails] Japanese localization using rails-i18n
From Ruby on Rails error message display to Japanese localization
Japanese localization of Docker container of CentOS7 / CentOS8 and Japan time setting
Summary of java error processing
About error handling of comment function
[Rails] Display form error messages asynchronously
Validation of log messages using mockito
[Rails] Validation settings and Japanese localization