开发者

Rails i18n strings auto-lowercased?

I've noticed t开发者_开发技巧hat in my new Rails 3.0 application all German i18n strings are converted to lowercase (except for the first letter).

When having a string like this:

de:
  email: "E-Mail"

the output is always like "E-mail". Same story with all the other strings - uppercase letters within a sentence are auto-converted to lowercase.

Is this default behaviour that I have to disable, or is there any other problem? I have successfully set the locale correctly, as these strings to actually work.

Thanks for your help

Arne


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.

However, it isn't ideal. I think you may also run into problems with the generated validation error messages.


Got the same issue. solved it by adding the _html suffix to the I18n translation key. it seems that using this suffix suppresses the humanize usage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜