diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 7323e84ee..5b9aaa289 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -146,7 +146,7 @@ if show_days width = zoom - 1 %>
5 %>" class="gantt_hdr"> - <%= day_name(wday).first %> + <%= day_letter(wday) %>
<% left = left + width + 1 diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index fade9a9ae..12445b450 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -58,6 +58,10 @@ module Redmine ::I18n.t('date.day_names')[day % 7] end + def day_letter(day) + ::I18n.t('date.abbr_day_names')[day % 7].first + end + def month_name(month) ::I18n.t('date.month_names')[month] end diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb index 2ec6dc2f9..d234ddf3c 100644 --- a/test/unit/lib/redmine/i18n_test.rb +++ b/test/unit/lib/redmine/i18n_test.rb @@ -25,6 +25,10 @@ class Redmine::I18nTest < ActiveSupport::TestCase User.current.language = nil end + def teardown + set_language_if_valid 'en' + end + def test_date_format_default set_language_if_valid 'en' today = Date.today @@ -155,6 +159,18 @@ class Redmine::I18nTest < ActiveSupport::TestCase end end + def test_day_name + set_language_if_valid 'fr' + assert_equal 'dimanche', day_name(0) + assert_equal 'jeudi', day_name(4) + end + + def test_day_letter + set_language_if_valid 'fr' + assert_equal 'd', day_letter(0) + assert_equal 'j', day_letter(4) + end + def test_valid_languages assert valid_languages.is_a?(Array) assert valid_languages.first.is_a?(Symbol)