公告
财富商城
积分规则
提问
发文
2019-02-04 15:06发布
在下西门庆
Is it possible to use time_ago_in_words with i18n.locale?
time_ago_in_words
i18n.locale
how?
thanks
If you are using Rails > 2.2, the helper is already locale-aware.
Just download the right localization file from the locale repository and store it into your /config/locales path. Then set your locale preferences.
/config/locales
Avoid doing it on the server and try it on the client instead by using the jQuery timeago plugin. Timeago has support for i18n.
This turns this:
<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
Into this:
<abbr class="timeago" title="July 17, 2008">about a year ago</abbr>
And supports language overrides.
最多设置5个标签!
If you are using Rails > 2.2, the helper is already locale-aware.
Just download the right localization file from the locale repository and store it into your
/config/locales
path. Then set your locale preferences.Avoid doing it on the server and try it on the client instead by using the jQuery timeago plugin. Timeago has support for i18n.
This turns this:
Into this:
And supports language overrides.