[英]Rails date_field translation
I'm trying to find a way to translate the headers of the rails date_field. 我正在尝试找到一种方法来转换rails date_field的标题。
<%= form_for @foo do |f| %>
<%= f.date_field :startdate %>
<% end %>
I allready have my swedish locale and it works when outputting things in the view (eg: I18n.localize(@startdate, format: "%a %e %b")), but I can't find anywhere how to translate the date helper. 我已经准备好了瑞典语区域设置,并且在视图中输出内容时可以使用它(例如:I18n.localize(@startdate,format:“%a%e%b”)),但是我找不到任何如何翻译日期的方法帮手。
I'm on Rails 4. 我在Rails 4上。
该格式由浏览器处理,因为f.date_field
生成HTML5 <input type="date" ... >
标记,并且根据此问题 ,浏览器尚不支持自定义格式。
If you need a translated version, skip the date field and use jquery datepicker: 如果需要翻译版本,请跳过日期字段,并使用jquery datepicker:
http://jqueryui.com/datepicker/#localization http://jqueryui.com/datepicker/#localization
https://github.com/joliss/jquery-ui-rails https://github.com/joliss/jquery-ui-rails
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.