Mercurial > hg > soundsoftware-site
comparison lib/redmine/i18n.rb @ 514:7eba09d624db live
Merge
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:50:53 +0100 |
parents | 051f544170fe |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
512:b9aebdd7dd40 | 514:7eba09d624db |
---|---|
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 (include_date ? "#{format_date(local)} " : "") + |
49 ((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}") | 49 (Setting.time_format.blank? ? ::I18n.l(local, :format => :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] |
54 end | 54 end |