Skip to content

Commit f4af245

Browse files
authored
Merge pull request ice-cube-ruby#358 from joelmeyerhamme/master
German locale, testing
2 parents c08b913 + 22bcc01 commit f4af245

File tree

2 files changed

+391
-0
lines changed

2 files changed

+391
-0
lines changed

config/locales/de.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
de:
2+
ice_cube:
3+
pieces_connector: ' / '
4+
not: 'außer %{target}'
5+
not_on: 'außer am %{target}'
6+
date:
7+
formats:
8+
default: '%-d. %B %Y'
9+
month_names:
10+
-
11+
- Januar
12+
- Februar
13+
- März
14+
- April
15+
- Mai
16+
- Juni
17+
- Juli
18+
- August
19+
- September
20+
- Oktober
21+
- November
22+
- Dezember
23+
day_names:
24+
- Sonntag
25+
- Montag
26+
- Dienstag
27+
- Mittwoch
28+
- Donnerstag
29+
- Freitag
30+
- Samstag
31+
times:
32+
other: '%{count} mal'
33+
one: '%{count} mal'
34+
until: 'bis zum %{date}'
35+
days_of_week: '%{segments} %{day}'
36+
days_of_month:
37+
one: '%{segments} Tag des Monats'
38+
other: '%{segments} Tag des Monats'
39+
days_of_year:
40+
one: '%{segments} Tag des Jahres'
41+
other: '%{segments} Tag des Jahres'
42+
at_hours_of_the_day:
43+
one: in der %{segments} Stunde des Tages
44+
other: in der %{segments} Stunde des Tages
45+
on_minutes_of_hour:
46+
one: in der %{segments} Minute der Stunde
47+
other: in der %{segments} Minute der Stunde
48+
at_seconds_of_minute:
49+
one: in der %{segments} Sekunde
50+
other: in der %{segments} Sekunde
51+
on_seconds_of_minute:
52+
one: in der %{segments} Sekunde der Minute
53+
other: in der %{segments} Sekunde der Minute
54+
each_second:
55+
one: Jede Sekunde
56+
other: Alle %{count} Sekunden
57+
each_minute:
58+
one: Jede Minute
59+
other: Alle %{count} Minuten
60+
each_hour:
61+
one: Stündlich
62+
other: Alle %{count} Stunden
63+
each_day:
64+
one: Täglich
65+
other: Alle %{count} Tage
66+
each_week:
67+
one: Wöchentlich
68+
other: Alle %{count} Wochen
69+
each_month:
70+
one: Monatlich
71+
other: Alle %{count} Monate
72+
each_year:
73+
one: Jährlich
74+
other: Alle %{count} Jahre
75+
'on': am %{sentence}
76+
in: 'im %{target}'
77+
integer:
78+
negative: '%{ordinal}. letzter'
79+
literal_ordinals:
80+
-1: letzten
81+
-2: vorletzten
82+
ordinal: '%{number}%{ordinal}'
83+
ordinals:
84+
default: '.'
85+
# 1: st
86+
# 2: nd
87+
# 3: rd
88+
# 11: th
89+
# 12: th
90+
# 13: th
91+
on_weekends: am Wochenende
92+
on_weekdays: an Wochentagen
93+
days_on:
94+
- Sonntags
95+
- Montags
96+
- Dienstags
97+
- Mittwochs
98+
- Donnerstags
99+
- Freitags
100+
- Samstags
101+
on_days: '%{days}'
102+
array:
103+
last_word_connector: ' und '
104+
two_words_connector: ' und '
105+
words_connector: ', '
106+
string:
107+
format:
108+
day: '%{rest} %{current}'
109+
day_of_week: '%{rest} %{current}'
110+
day_of_month: '%{rest} %{current}'
111+
day_of_year: '%{rest} %{current}'
112+
hour_of_day: '%{rest} %{current}'
113+
minute_of_hour: '%{rest} %{current}'
114+
until: '%{rest} %{current}'
115+
count: '%{rest} %{current}'
116+
default: '%{rest} %{current}'
117+
118+
date:
119+
abbr_day_names:
120+
- So
121+
- Mo
122+
- Di
123+
- Mi
124+
- Do
125+
- Fr
126+
- Sa
127+
abbr_month_names:
128+
-
129+
- Jan
130+
- Feb
131+
- Mär
132+
- Apr
133+
- Mai
134+
- Jun
135+
- Jul
136+
- Aug
137+
- Sep
138+
- Okt
139+
- Nov
140+
- Dez
141+
day_names:
142+
- Sonntag
143+
- Montag
144+
- Dinstag
145+
- Mittwoch
146+
- Donnerstag
147+
- Freitag
148+
- Samstag
149+
formats:
150+
default: "%Y-%m-%d"
151+
long: "%B %d, %Y"
152+
short: "%b %d"
153+
month_names:
154+
-
155+
- Januar
156+
- Februar
157+
- März
158+
- April
159+
- Mai
160+
- Juni
161+
- Juli
162+
- August
163+
- September
164+
- Oktober
165+
- November
166+
- Dezember
167+
order:
168+
- :year
169+
- :month
170+
- :day
171+
172+
time:
173+
am: am
174+
formats:
175+
default: "%a, %d %b %Y %H:%M:%S %z"
176+
long: "%B %d, %Y %H:%M"
177+
short: "%d %b %H:%M"
178+
pm: pm

spec/examples/to_s_de_spec.rb

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
# encoding: utf-8
2+
require File.dirname(__FILE__) + '/../spec_helper'
3+
4+
describe IceCube::Schedule, 'to_s' do
5+
6+
before :each do
7+
I18n.locale = :de
8+
end
9+
10+
after :all do
11+
I18n.locale = :en
12+
end
13+
14+
15+
it 'should represent its start time by default' do
16+
t0 = Time.local(2013, 2, 14)
17+
IceCube::Schedule.new(t0).to_s.should == '14. Februar 2013'
18+
end
19+
20+
it 'should have a useful base to_s representation for a secondly rule' do
21+
IceCube::Rule.secondly.to_s.should == 'Jede Sekunde'
22+
IceCube::Rule.secondly(2).to_s.should == 'Alle 2 Sekunden'
23+
end
24+
25+
it 'should have a useful base to_s representation for a minutely rule' do
26+
IceCube::Rule.minutely.to_s.should == 'Jede Minute'
27+
IceCube::Rule.minutely(2).to_s.should == 'Alle 2 Minuten'
28+
end
29+
30+
it 'should have a useful base to_s representation for a hourly rule' do
31+
IceCube::Rule.hourly.to_s.should == 'Stündlich'
32+
IceCube::Rule.hourly(2).to_s.should == 'Alle 2 Stunden'
33+
end
34+
35+
it 'should have a useful base to_s representation for a daily rule' do
36+
IceCube::Rule.daily.to_s.should == 'Täglich'
37+
IceCube::Rule.daily(2).to_s.should == 'Alle 2 Tage'
38+
end
39+
40+
it 'should have a useful base to_s representation for a weekly rule' do
41+
IceCube::Rule.weekly.to_s.should == 'Wöchentlich'
42+
IceCube::Rule.weekly(2).to_s.should == 'Alle 2 Wochen'
43+
end
44+
45+
it 'should have a useful base to_s representation for a monthly rule' do
46+
IceCube::Rule.monthly.to_s.should == 'Monatlich'
47+
IceCube::Rule.monthly(2).to_s.should == 'Alle 2 Monate'
48+
end
49+
50+
it 'should have a useful base to_s representation for a yearly rule' do
51+
IceCube::Rule.yearly.to_s.should == 'Jährlich'
52+
IceCube::Rule.yearly(2).to_s.should == 'Alle 2 Jahre'
53+
end
54+
55+
it 'should work with various sentence types properly' do
56+
IceCube::Rule.weekly.to_s.should == 'Wöchentlich'
57+
IceCube::Rule.weekly.day(:monday).to_s.should == 'Wöchentlich Montags'
58+
IceCube::Rule.weekly.day(:monday, :tuesday).to_s.should == 'Wöchentlich Montags und Dienstags'
59+
IceCube::Rule.weekly.day(:monday, :tuesday, :wednesday).to_s.should == 'Wöchentlich Montags, Dienstags und Mittwochs'
60+
end
61+
62+
it 'should show saturday and sunday as weekends' do
63+
IceCube::Rule.weekly.day(:saturday, :sunday).to_s.should == 'Wöchentlich am Wochenende'
64+
end
65+
66+
it 'should not show saturday and sunday as weekends when other days are present also' do
67+
IceCube::Rule.weekly.day(:sunday, :monday, :saturday).to_s.should ==
68+
'Wöchentlich Sonntags, Montags und Samstags'
69+
end
70+
71+
it 'should reorganize days to be in order' do
72+
IceCube::Rule.weekly.day(:tuesday, :monday).to_s.should ==
73+
'Wöchentlich Montags und Dienstags'
74+
end
75+
76+
it 'should show weekdays as such' do
77+
IceCube::Rule.weekly.day(
78+
:monday, :tuesday, :wednesday,
79+
:thursday, :friday
80+
).to_s.should == 'Wöchentlich an Wochentagen'
81+
end
82+
83+
it 'should not show weekdays as such when a weekend day is present' do
84+
IceCube::Rule.weekly.day(
85+
:sunday, :monday, :tuesday, :wednesday,
86+
:thursday, :friday
87+
).to_s.should == 'Wöchentlich Sonntags, Montags, Dienstags, Mittwochs, Donnerstags und Freitags'
88+
# 'Weekly on Sundays, Mondays, Tuesdays, Wednesdays, Thursdays, and Fridays'
89+
end
90+
91+
it 'should show start time for an empty schedule' do
92+
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
93+
schedule.to_s.should == "20. März 2010"
94+
end
95+
96+
it 'should work with a single date' do
97+
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
98+
schedule.add_recurrence_time Time.local(2010, 3, 20)
99+
schedule.to_s.should == "20. März 2010"
100+
end
101+
102+
it 'should work with additional dates' do
103+
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
104+
schedule.add_recurrence_time Time.local(2010, 3, 20)
105+
schedule.add_recurrence_time Time.local(2010, 3, 21)
106+
schedule.to_s.should == '20. März 2010 / 21. März 2010'
107+
end
108+
109+
it 'should order dates that are out of order' do
110+
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
111+
schedule.add_recurrence_time Time.local(2010, 3, 19)
112+
schedule.to_s.should == '19. März 2010 / 20. März 2010'
113+
end
114+
115+
it 'should remove duplicated start time' do
116+
schedule = IceCube::Schedule.new t0 = Time.local(2010, 3, 20)
117+
schedule.add_recurrence_time t0
118+
schedule.to_s.should == '20. März 2010'
119+
end
120+
121+
it 'should remove duplicate rtimes' do
122+
schedule = IceCube::Schedule.new Time.local(2010, 3, 19)
123+
schedule.add_recurrence_time Time.local(2010, 3, 20)
124+
schedule.add_recurrence_time Time.local(2010, 3, 20)
125+
schedule.to_s.should == '19. März 2010 / 20. März 2010'
126+
end
127+
128+
it 'should work with rules and dates' do
129+
schedule = IceCube::Schedule.new Time.local(2010, 3, 19)
130+
schedule.add_recurrence_time Time.local(2010, 3, 20)
131+
schedule.add_recurrence_rule IceCube::Rule.weekly
132+
schedule.to_s.should == '20. März 2010 / Wöchentlich'
133+
end
134+
135+
it 'should work with rules and times and exception times' do
136+
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
137+
schedule.add_recurrence_rule IceCube::Rule.weekly
138+
schedule.add_recurrence_time Time.local(2010, 3, 20)
139+
schedule.add_exception_time Time.local(2010, 3, 20) # ignored
140+
schedule.add_exception_time Time.local(2010, 3, 21)
141+
schedule.to_s.should == 'Wöchentlich / außer am 20. März 2010 / außer am 21. März 2010'
142+
end
143+
144+
it 'should work with a single rrule' do
145+
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
146+
schedule.add_recurrence_rule IceCube::Rule.weekly.day_of_week(:monday => [1])
147+
schedule.to_s.should == schedule.rrules[0].to_s
148+
end
149+
150+
it 'should be able to say the last Thursday of the month' do
151+
rule_str = IceCube::Rule.monthly.day_of_week(:thursday => [-1]).to_s
152+
rule_str.should == 'Monatlich am letzten Donnerstag'
153+
end
154+
155+
it 'should be able to say what months of the year something happens' do
156+
rule_str = IceCube::Rule.yearly.month_of_year(:june, :july).to_s
157+
rule_str.should == 'Jährlich im Juni und Juli'
158+
end
159+
160+
it 'should be able to say the second to last monday of the month' do
161+
rule_str = IceCube::Rule.monthly.day_of_week(:thursday => [-2]).to_s
162+
rule_str.should == 'Monatlich am vorletzten Donnerstag'
163+
end
164+
165+
it 'should join the first and last weekdays of the month' do
166+
rule_str = IceCube::Rule.monthly.day_of_week(:thursday => [1, -1]).to_s
167+
rule_str.should == 'Monatlich am 1. Donnerstag und letzten Donnerstag'
168+
end
169+
170+
it 'should be able to say the days of the month something happens' do
171+
rule_str = IceCube::Rule.monthly.day_of_month(1, 15, 30).to_s
172+
rule_str.should == 'Monatlich am 1., 15. und 30. Tag des Monats'
173+
end
174+
175+
it 'should be able to say what day of the year something happens' do
176+
rule_str = IceCube::Rule.yearly.day_of_year(30).to_s
177+
rule_str.should == 'Jährlich am 30. Tag des Jahres'
178+
end
179+
180+
it 'should be able to say what hour of the day something happens' do
181+
rule_str = IceCube::Rule.daily.hour_of_day(6, 12).to_s
182+
rule_str.should == 'Täglich in der 6. und 12. Stunde des Tages'
183+
end
184+
185+
it 'should be able to say what minute of an hour something happens - with special suffix minutes' do
186+
rule_str = IceCube::Rule.hourly.minute_of_hour(10, 11, 12, 13, 14, 15).to_s
187+
rule_str.should == 'Stündlich in der 10., 11., 12., 13., 14. und 15. Minute der Stunde'
188+
end
189+
190+
it 'should be able to say what seconds of the minute something happens' do
191+
rule_str = IceCube::Rule.minutely.second_of_minute(10, 11).to_s
192+
rule_str.should == 'Jede Minute in der 10. und 11. Sekunde der Minute'
193+
end
194+
195+
it 'should be able to reflect until dates' do
196+
schedule = IceCube::Schedule.new(Time.now)
197+
schedule.rrule IceCube::Rule.weekly.until(Time.local(2012, 2, 3))
198+
schedule.to_s.should == 'Wöchentlich bis zum 3. Februar 2012'
199+
end
200+
201+
it 'should be able to reflect count' do
202+
schedule = IceCube::Schedule.new(Time.now)
203+
schedule.add_recurrence_rule IceCube::Rule.weekly.count(1)
204+
schedule.to_s.should == 'Wöchentlich 1 mal'
205+
end
206+
207+
it 'should be able to reflect count (proper pluralization)' do
208+
schedule = IceCube::Schedule.new(Time.now)
209+
schedule.add_recurrence_rule IceCube::Rule.weekly.count(2)
210+
schedule.to_s.should == 'Wöchentlich 2 mal'
211+
end
212+
213+
end

0 commit comments

Comments
 (0)