[Japanese localization] i18n rails Easy Japanese localization view display only


Switch only view to Japanese display


■ Improvement of UI ■ Because it is in Japanese, readability is improved and development efficiency is improved.

【Development environment】

■ Mac OS catalina ■ Ruby on Rails ( ■ Virtual Box:6.1 ■ Vagrant: 2.2.7


Application creation


$ rails new japoanese
$ rails g controller homes index
$ cd config/locale
$ touch ja.yml

gemfile.add to

gem 'rails-i18n', '~> 5.1' 


root 'homes#index'


      title: 'Title'

##The writing style changes a little when the model is related. It looks like the following. .. ..

      user: "user"
        name: "name"
        age: "age"

*** The following important **


config.i18n.default_locale = :ja #add to


<h2><%= t '.title'%></h2>
<h2><%= t '.name'%></h2>
<h2><%= t '.text'%></h2>

that's all! !!

[I want to read it together]

■ More detailed articles https://qiita.com/shimadama/items/7e5c3d75c9a9f51abdd5

■ Error message https://qiita.com/tanaka-yu3/items/63b189d3f15653cae263

■ rails method for beginners https://qiita.com/tanaka-yu3/items/89abad875187494bec53

Recommended Posts

[Japanese localization] i18n rails Easy Japanese localization view display only
[Rails] Display popular posts in ranking format [Easy]
[Rails] How to display an image in the view
[Rails] Japanese localization using rails-i18n
View monthly calendar in Rails
[Rails] How to display information stored in the database in view
[Rails] Japanese localization of error messages
[Rails] Validation settings and Japanese localization
Specify home view in rails app [root]
[Rails] Store only checked items in DB
How to display error messages in Japanese
Settings to display Japanese Javadoc in IntelliJ IDEA
How to translate Rails into Japanese in general
Implement iteration in View by rendering collection [Rails]
Display text character by character in Android Surface View
Simple notification function in Rails (only when followed)
Easy to display hello world with Rails + Docker
[Rails] How to convert UC time display to Japanese time display
Group_by in Rails
[Rails] View sharing
[Rails] How to display the weather forecast of the registered address in Japanese using OpenWeatherMap
How to set the display time to Japan time in Rails
[Ruby on Rails] How to write enum in Japanese
Some subtly different repetitive writing styles in Rails View
[Rails] How to load JavaScript in a specific view