Patch #6729 » fix_localized_weekday_and_month_names.patch
| lib/redmine/i18n.rb 2010-10-20 16:37:31.612267815 +0200 → lib/redmine/i18n.rb 2010-10-20 23:47:41.962268688 +0200 | ||
|---|---|---|
| 37 | 37 | |
| 38 | 38 |
def format_date(date) |
| 39 | 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 |
return ::I18n.l(date.to_date, :count => date.strftime('%d')) if Setting.date_format.blank?
|
|
| 41 |
fmt = Setting.date_format.dup |
|
| 42 |
fmt.gsub!('%a', abbr_day_name(date.day))
|
|
| 43 |
fmt.gsub!('%A', day_name(date.day))
|
|
| 44 |
fmt.gsub!('%b', abbr_month_name(date.month))
|
|
| 45 |
fmt.gsub!('%B', month_name(date.month))
|
|
| 46 |
return date.strftime(fmt) |
|
| 41 | 47 |
end |
| 42 | 48 |
|
| 43 | 49 |
def format_time(time, include_date = true) |
| ... | ... | |
| 49 | 55 |
((include_date ? "#{format_date(time)} " : "") + "#{local.strftime(Setting.time_format)}")
|
| 50 | 56 |
end |
| 51 | 57 | |
| 58 |
def abbr_day_name(day) |
|
| 59 |
::I18n.t('date.abbr_day_names')[day % 7]
|
|
| 60 |
end |
|
| 61 | ||
| 52 | 62 |
def day_name(day) |
| 53 | 63 |
::I18n.t('date.day_names')[day % 7]
|
| 54 | 64 |
end |
| 55 | 65 |
|
| 66 |
def abbr_month_name(month) |
|
| 67 |
::I18n.t('date.abbr_month_names')[month]
|
|
| 68 |
end |
|
| 69 | ||
| 56 | 70 |
def month_name(month) |
| 57 | 71 |
::I18n.t('date.month_names')[month]
|
| 58 | 72 |
end |