1. Visit the official website of the Rails i18n plugin to view the information
Http://guides.rubyonrails.org/i18n.html
2. Add the test to Gemfile rails4.2.1 do not install this gem
Gem ' rails-i18n '
3. Install by using bundle install
4. Configure CONFIG/APPLICATION.RB
[Ruby] View plaincopy
1. # CONFIG/APPLICATION.RB
2. Config.i18n.load_path + = dir[rails.root.join (' config ', ' locales ', ' * * ', ' *.{ RB,YML} ')]
3. Config.i18n.default_locale =: ' ZH-CN '
5. Create the model's Chinese information
Add Chinese config file/config/locales/models/dps/zh_cn.yml
Where DPS is the name of model
The contents of ZH_CN.YML are as follows:
[Ruby] View plaincopy
1. ZH-CN:
2. ActiveRecord:
3. Models:
4. DPS: ' Data processing system '
5. Attributes:
6. DPS:
7. SYS_ID: ' System number '
8. Description: ' System description '
9. Pulse: ' System pulse '
Last_received: ' Last Record count '
One. Last_received_time: ' Last data Time Received '
Amount: ' Total number of records accepted '
6. Use the following statement where you want to call the display
<%= Dps.human_attribute_name:sys_id%>
Rails Scaffold generated crud display custom column names