2011-01-07 3 views
1

나는이 문제가 activesupport 2.3.5로 옮겨 졌기 때문에 발생할 수 있다고 생각했지만 지금은 다른 일이 있었어야한다고 생각합니다.레일이 time_ago_in_words의 출력이 좋지 않음

모델은 유효한 RFC822 스타일의 날짜가 있습니다

>> s.lastVisitDate 
=> "Thu, 06 Jan 2011 22:24:10 -0800" 

를하지만 내보기 : 다른 사람이 동작을 볼 경우

<%=h time_ago_in_words(@site.lastVisitDate) -%> 

renders: *about {{count}} hours ago* 
instead of: *about 2 hours ago* which was working just fine earlier. 

궁금. 모델 및 뷰에 대한 내 버전 기록을 검토 했으므로 최근에 변경된 사항이 없으므로 구성 측면에서 뭔가를 엉망으로 만들었어야한다고 생각합니다.

답변

0

로케일 파일에서 적절한 값이 누락되었습니다.

그래서 내 경우에는 내가 내가이 이전에 작업 한 또는 어떤 특정 보석이나 설정 변경이 문제를 유발하지만, 여기에 적절한 정의를 가진 이유를 모르겠습니다

을 /config/locales/en.yml하려면 다음 추가 액션 팩을 행복하게 만드십시오.

# Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() 
    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" 
+0

이전에'gemfile'에'rails-i18n' 보석이 있었을 수도 있습니다. –

관련 문제