Project

General

Profile

Defect #5091 ยป i18n.rb.patch

don't apply this, it doesn't work - Wang Congming, 2010-05-12 10:22

View differences:

i18n.rb (working copy)
def format_date(date)
return nil unless date
Setting.date_format.blank? ? ::I18n.l(date.to_date) : date.strftime(Setting.date_format)
time = date.to_time
zone = User.current.time_zone
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
Setting.date_format.blank? ? ::I18n.l(local.to_date) : local.to_date.strftime(Setting.date_format)
end
def format_time(time, include_date = true)
......
time = time.to_time if time.is_a?(String)
zone = User.current.time_zone
local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
Setting.time_format.blank? ? ::I18n.l(local, :format => (include_date ? :default : :time)) :
((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}")
if Setting.time_format.blank?
if include_date
Setting.date_format.blank? ?
::I18n.l(local, :format => :default) :
local.strftime(Setting.date_format+' '+::I18n.t(:'time.formats.time'))
else
::I18n.l(local, :format => :time)
end
else
if include_date
Setting.date_format.blank? ?
::I18n.l(local, :format => ::I18n.t(:'date.formats.default')+' '+Setting.time_format) :
local.strftime(Setting.date_format+' '+Setting.time_format)
else
local.strftime(Setting.time_format)
end
end
end
def day_name(day)
    (1-1/1)