と:しかし取得{{countが}} time_ago_in_words
def comment_poster(comment)
if comment.user
"posted by #{comment.user.username} #{time_ago_in_words(comment.created_at)} ago"
else
"posted by anonymous"
end
end
を、これは私が秒前に掲載している場合にのみ動作し、数年前:
posted by teejay about 1 year ago
posted by teejay about 1 month ago
私は数日前にはcreated_atの値を編集するとき
は、それが私にこの与える:
posted by thorpe {{count}} days ago
私はそれが仕事とロスにするには、このために何をすべき私はconfig/locales/en.yml
datetime:
distance_in_words:
half_a_minute: "half a minute"
less_than_x_seconds:
one: "less than 1 second"
other: "less than %{count} seconds"
x_seconds:
one: "1 second"
other: "%{count} seconds"
less_than_x_minutes:
one: "less than a minute"
other: "less than %{count} minutes"
x_minutes:
one: "1 minute"
other: "%{count} minutes"
about_x_hours:
one: "about 1 hour"
other: "about %{count} hours"
x_days:
one: "1 day"
other: "%{count} days"
about_x_months:
one: "about 1 month"
other: "about %{count} months"
x_months:
one: "1 month"
other: "%{count} months"
about_x_years:
one: "about 1 year"
other: "about %{count} years"
over_x_years:
one: "over 1 year"
other: "over %{count} years"
almost_x_years:
one: "almost 1 year"
other: "almost %{count} years"
prompts:
year: "Year"
month: "Month"
day: "Day"
hour: "Hour"
minute: "Minute"
second: "Seconds"
でき、誰にthis codeを貼り付けることにより、問題を修正しました#2
:Eその{{count}}
編集:それは
編集何を意味している場合、私はRailsの2.3.5を使用しています問題の内容を説明してください。
あなたのコードは動作するはずです - actionpack/lib/action_view/helpers/date_helper.rbのActionPackを変更しましたか? – Codebeef
私はしていません。私はどのように知りません。 –
そのコードは、i18n gemの変数にアクセスする新しい方法を使用します。 {{変数}}の代わりに%{変数}を使用します。ちょうどあなたはそれがあなたの問題を解決した理由を知っています – nunopolonia