comparison lib/redmine/i18n.rb @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 94944d00e43c
children 051f544170fe
comparison
equal deleted inserted replaced
39:150ceac17a8d 119:8661b858af72
35 ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }) 35 ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" })
36 end 36 end
37 37
38 def format_date(date) 38 def format_date(date)
39 return nil unless date 39 return nil unless date
40 Setting.date_format.blank? ? ::I18n.l(date.to_date, :count => date.strftime('%d')) : date.strftime(Setting.date_format) 40 Setting.date_format.blank? ? ::I18n.l(date.to_date) : date.strftime(Setting.date_format)
41 end 41 end
42 42
43 def format_time(time, include_date = true) 43 def format_time(time, include_date = true)
44 return nil unless time 44 return nil unless time
45 time = time.to_time if time.is_a?(String) 45 time = time.to_time if time.is_a?(String)
46 zone = User.current.time_zone 46 zone = User.current.time_zone
47 local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) 47 local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
48 Setting.time_format.blank? ? ::I18n.l(local, :count => local.strftime('%d'), :format => (include_date ? :default : :time)) : 48 Setting.time_format.blank? ? ::I18n.l(local, :format => (include_date ? :default : :time)) :
49 ((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}") 49 ((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}")
50 end 50 end
51 51
52 def day_name(day) 52 def day_name(day)
53 ::I18n.t('date.day_names')[day % 7] 53 ::I18n.t('date.day_names')[day % 7]