aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Goce <carlosgoce@gmail.com>2015-01-23 18:59:53 +0100
committerCarlos Goce <carlosgoce@gmail.com>2015-01-23 18:59:53 +0100
commitf31f9b3c634e357757086c9737be8d6780bf1921 (patch)
tree71cdbfde9af20dbb69e493bc5a6fd8d0ea8cbd46
parentcaa0a9f01c4f3a8ca85a0ce4e335c71235006432 (diff)
downloadpdf-calendars-f31f9b3c634e357757086c9737be8d6780bf1921.tar.gz
pdf-calendars-f31f9b3c634e357757086c9737be8d6780bf1921.tar.bz2
pdf-calendars-f31f9b3c634e357757086c9737be8d6780bf1921.zip
Day names are localized
-rw-r--r--lib/carlosgoce/calendar.rb2
-rw-r--r--spec/calendar_spec.rb5
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/carlosgoce/calendar.rb b/lib/carlosgoce/calendar.rb
index d51df90..96ac182 100644
--- a/lib/carlosgoce/calendar.rb
+++ b/lib/carlosgoce/calendar.rb
@@ -22,7 +22,7 @@ module CarlosGoce
m[:days_names] = Array.new.tap {|a|
m[:days].each do |d|
t = Time.new @year, month, d
- a << t.strftime('%A').downcase
+ a << I18n.t('date.day_names')[t.wday].downcase
end
}
}
diff --git a/spec/calendar_spec.rb b/spec/calendar_spec.rb
index fc78cc0..770634a 100644
--- a/spec/calendar_spec.rb
+++ b/spec/calendar_spec.rb
@@ -7,6 +7,7 @@ I18n.backend.load_translations
describe 'Calendar' do
before(:each) do
+ I18n.locale = 'en'
@calendar = CarlosGoce::Calendar.new 2015
end
@@ -35,9 +36,7 @@ describe 'Calendar' do
expect(@calendar.to_h[1][:days_names].count).to eq 31
end
- it 'return the day names localized',
- :pending => "Not working!!! Months are localized, why days aren't?" do
- skip 'Is not working, the names are localized so why days are not?'
+ it 'return the day names localized' do
I18n.locale = 'es'
expect(@calendar.to_h[1][:days_names].first).to eq 'jueves'
end