I'm wondering about something with Rails 4 and i18n. I've set up some attributes like this:
en:
activerecord:
models:
tutor: Tutor
attributes:
tutor:
country: Country
rate: Rate
ja:
activerecord:
models:
tutor: チューター
attributes:
tutor:
country: 国籍
rate: 料金
In my view I am now doing the following:
<%= table_sort( t('activerecord.attributes.tutor.rate') ) %>
Is activerecord.attributes.tutor.rate
correct or is there any shorter, better or preferred ways to translate table column names?
Cheers!
您可以使用human_attribute_name
方法
Tutor.human_attribute_name :rate
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.