Mercurial > hg > soundsoftware-site
comparison lib/redmine/.svn/text-base/i18n.rb.svn-base @ 37:94944d00e43c
* Update to SVN trunk rev 4411
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 19 Nov 2010 13:24:41 +0000 |
parents | 513646585e45 |
children | af80e5618e9b |
comparison
equal
deleted
inserted
replaced
22:40f7cfd4df19 | 37:94944d00e43c |
---|---|
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) : date.strftime(Setting.date_format) | 40 Setting.date_format.blank? ? ::I18n.l(date.to_date, :count => date.strftime('%d')) : 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, :format => (include_date ? :default : :time)) : | 48 Setting.time_format.blank? ? ::I18n.l(local, :count => local.strftime('%d'), :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] |