Use abbr_day_name to get the first letter of the day name (#9839).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10202 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-08-13 18:13:10 +00:00
parent 11d4d8177c
commit 3119d1996c
3 changed files with 21 additions and 1 deletions

View File

@ -146,7 +146,7 @@ if show_days
width = zoom - 1
%>
<div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr">
<%= day_name(wday).first %>
<%= day_letter(wday) %>
</div>
<%
left = left + width + 1

View File

@ -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

View File

@ -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)