表单: RailsNotes
用户: dreamable
创建日期: 2021-05-02 23:57:46 UTC
更新日期: 2021-05-02 23:57:46 UTC
引用:(Table ID 3, Record ID 46)

标题 :
Rails i18n strings auto-lowercased?
笔记 :

source

There should be no modifications to the content you specify as part of the internationalization process. It sounds like something is calling humanize on the string before it is output. Some of the standard Rails form helper methods do this I believe. If you just output the translation using t('email') you should see 'E-Mail' correctly.

Update: From your comments it seems like it is a label that is causing the problem. If you explicitly specify the text for the label rather than relying on the default behaviour you will get the translation exactly as you specify. So,

<%= f.label(:email, t('email')) %>

should generate the correct label from the translations.

标签: