当使用I18n配置mode时, 可以用yml配置'zh-CN':
activerecord:
models:
user: "用户"
attributes:
user:
username: "用户名"
email: "邮箱"
password: "密码"
因此在form_for里的
f.label :username
便会自动转化为 用户名
那在其他views要使用I18n呢? 很简单, 使用 User.human_attribute_name(:username), 就可以获得 用户名