@@ -78,3 +78,17 module AsynchronousMailer | |||||
78 | end |
|
78 | end | |
79 |
|
79 | |||
80 | ActionMailer::Base.send :include, AsynchronousMailer |
|
80 | ActionMailer::Base.send :include, AsynchronousMailer | |
|
81 | ||||
|
82 | # TODO: Hack to support i18n 4.x on Rails 2.3.5. Remove post 2.3.6. | |||
|
83 | # See http://www.redmine.org/issues/6428 and http://www.redmine.org/issues/5608 | |||
|
84 | module I18n | |||
|
85 | module Backend | |||
|
86 | module Base | |||
|
87 | def warn_syntax_deprecation! | |||
|
88 | return if @skip_syntax_deprecation | |||
|
89 | warn "The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead.\nDowngrade your i18n gem to 0.3.7 (everything above must be deinstalled) to remove this warning, see http://www.redmine.org/issues/5608 for more information." | |||
|
90 | @skip_syntax_deprecation = true | |||
|
91 | end | |||
|
92 | end | |||
|
93 | end | |||
|
94 | end |
@@ -37,7 +37,7 module Redmine | |||||
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) | |
@@ -45,7 +45,7 module Redmine | |||||
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 |
@@ -29,7 +29,7 class Redmine::I18nTest < ActiveSupport::TestCase | |||||
29 | set_language_if_valid 'en' |
|
29 | set_language_if_valid 'en' | |
30 | today = Date.today |
|
30 | today = Date.today | |
31 | Setting.date_format = '' |
|
31 | Setting.date_format = '' | |
32 | assert_equal I18n.l(today), format_date(today) |
|
32 | assert_equal I18n.l(today, :count => today.strftime('%d')), format_date(today) | |
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | def test_date_format |
|
35 | def test_date_format | |
@@ -47,7 +47,7 class Redmine::I18nTest < ActiveSupport::TestCase | |||||
47 | format_date(Date.today) |
|
47 | format_date(Date.today) | |
48 | format_time(Time.now) |
|
48 | format_time(Time.now) | |
49 | format_time(Time.now, false) |
|
49 | format_time(Time.now, false) | |
50 | assert_not_equal 'default', ::I18n.l(Date.today, :format => :default), "date.formats.default missing in #{lang}" |
|
50 | assert_not_equal 'default', ::I18n.l(Date.today, :count => Date.today.strftime('%d'), :format => :default), "date.formats.default missing in #{lang}" | |
51 | assert_not_equal 'time', ::I18n.l(Time.now, :format => :time), "time.formats.time missing in #{lang}" |
|
51 | assert_not_equal 'time', ::I18n.l(Time.now, :format => :time), "time.formats.time missing in #{lang}" | |
52 | end |
|
52 | end | |
53 | assert l('date.day_names').is_a?(Array) |
|
53 | assert l('date.day_names').is_a?(Array) | |
@@ -63,8 +63,8 class Redmine::I18nTest < ActiveSupport::TestCase | |||||
63 | now = Time.now |
|
63 | now = Time.now | |
64 | Setting.date_format = '' |
|
64 | Setting.date_format = '' | |
65 | Setting.time_format = '' |
|
65 | Setting.time_format = '' | |
66 | assert_equal I18n.l(now), format_time(now) |
|
66 | assert_equal I18n.l(now, :count => now.strftime('%d')), format_time(now) | |
67 | assert_equal I18n.l(now, :format => :time), format_time(now, false) |
|
67 | assert_equal I18n.l(now, :count => now.strftime('%d'), :format => :time), format_time(now, false) | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def test_time_format |
|
70 | def test_time_format |
General Comments 0
You need to be logged in to leave comments.
Login now