[英]Rails error when using %d (deprecated) on translating dates, what should i use instead?
In language file es.yml
i have 在语言文件es.yml
我有
time: formats: short: "%d %b %H:%M"
when i try using it like: 当我尝试使用它时:
<%= l my_object.created_at, :format => :short %>
it shows the following error 它显示以下错误
ActionView::TemplateError (missing interpolation argument in "%{count} %b %H:%M" ({:object=>Fri, 11 Jun 2010 09:00:00 CDT -05:00} given)) on line #68 of app/views/matches/_by_session.html.erb:
65: `</div>`
66:
67: `<div>`
68: `<%= l match.starts_at, :format => :short %>`
69: `</div>`
70:
71: `</div>`
How should I display the day... if %d
doesnt work anymore.... Any ideas??? 我应该如何显示日期...如果%d
不再起作用...。有什么想法吗???
I ran into this problem and it took me ages to work it out. 我遇到了这个问题,我花了很长时间才解决。
For me the problem was I also had Rails version 3 beta installed and a prerequisite for that is the I18n gem. 对我来说,问题是我还安装了Rails 3 beta版,而这的前提是I18n gem。
This is not required for version 2.* of rails and simply uninstalling this gem (I18n) resolved my issues. 2. *版的rails不需要此功能,只需卸载此gem(I18n)就可以解决我的问题。
Yep indeed i had the same kind of error: 是的,的确我有同样的错误:
I18n::MissingInterpolationArgument in Admin/campaigns#index
Showing app/views/admin/campaigns/_campaign.html.erb where line #3 raised:
missing interpolation argument in "%Y/%m/%{count}" ({:object=>Mon, 19 Jul 2010 15:15:57 CEST +02:00} given)
Uninstalling the i18n gem fixed it 卸载i18n gem可以修复它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.