本文介绍了Rails 3 - time_ago_in_words 说“大约 2 小时前";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代码:
<%="#{time_ago_in_words(comment.created_at)} ago "%>
我想要的是在 2 小时前不要有关于",它会显示几个小时而不是几分钟......
What i'd like is for it not to have "ABOUT" in front of the 2 hours ago, which shows up for hours but not for minutes...
是否有其他功能或方法可以在不查找和替换的情况下将其删除?
Is there another function or a way to remove it without finding and replacing?
推荐答案
您可以通过您的 I18n 语言环境文件更改此设置.在 config/locales/en.yml...
You can change this via your I18n locale file. In config/locales/en.yml...
"en":
datetime:
distance_in_words:
about_x_hours:
# The defaults are "about 1 hour" and "about %{count} hours"
one: "1 hour"
other: "%{count} hours"
查看 actionpack 中的默认语言环境文件一个完整的参考.
See the default locale file in actionpack for a complete reference.
这篇关于Rails 3 - time_ago_in_words 说“大约 2 小时前";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!