From d85ada6750c4700839e087f8d64307c1b47093ad Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 22 Jan 2013 10:58:11 -0500 Subject: [PATCH] Fix localization of recurrence editor --- UI/Scheduler/UIxRecurrenceEditor.m | 50 +++++++++++++++---- .../SchedulerUI/UIxRecurrenceEditor.wox | 20 +++----- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/UI/Scheduler/UIxRecurrenceEditor.m b/UI/Scheduler/UIxRecurrenceEditor.m index cdc4ba4e1..d4449b40a 100644 --- a/UI/Scheduler/UIxRecurrenceEditor.m +++ b/UI/Scheduler/UIxRecurrenceEditor.m @@ -22,6 +22,7 @@ #import #import +#import /* for locale string constants */ #import @@ -29,6 +30,19 @@ @implementation UIxRecurrenceEditor +- (NSArray *) shortWeekDaysList +{ + static NSArray *shortWeekDaysList = nil; + + if (!shortWeekDaysList) + { + shortWeekDaysList = [locale objectForKey: NSShortWeekDayNameArray]; + [shortWeekDaysList retain]; + } + + return shortWeekDaysList; +} + - (NSArray *) monthlyRepeatList { static NSArray *monthlyRepeatList = nil; @@ -45,13 +59,12 @@ - (NSArray *) monthlyDayList { - static NSArray *monthlyDayList = nil; + static NSMutableArray *monthlyDayList = nil; if (!monthlyDayList) { - monthlyDayList = [NSArray arrayWithObjects: @"Sunday", @"Monday", @"Tuesday", - @"Wednesday", @"Thursday", @"Friday", - @"Saturday", @"DayOfTheMonth", nil]; + monthlyDayList = [NSMutableArray arrayWithArray: [locale objectForKey: NSWeekDayNameArray]]; + [monthlyDayList addObject: @"DayOfTheMonth"]; [monthlyDayList retain]; } @@ -64,9 +77,7 @@ if (!yearlyMonthList) { - yearlyMonthList = [NSArray arrayWithObjects: @"January", @"February", @"March", - @"April", @"May", @"June", @"July", @"August", - @"September", @"October", @"November", @"December", nil]; + yearlyMonthList = [locale objectForKey: NSMonthNameArray]; [yearlyMonthList retain]; } @@ -79,9 +90,7 @@ if (!yearlyDayList) { - yearlyDayList = [NSArray arrayWithObjects: @"Sunday", @"Monday", @"Tuesday", - @"Wednesday", @"Thursday", @"Friday", - @"Saturday", nil]; + yearlyDayList = [locale objectForKey: NSWeekDayNameArray]; [yearlyDayList retain]; } @@ -128,4 +137,25 @@ return text; } +- (NSString *) idForWeekDay +{ + static NSArray *shortWeekDaysList = nil; + NSString *id; + + if (!shortWeekDaysList) + { + shortWeekDaysList = [locale objectForKey: NSShortWeekDayNameArray]; + [shortWeekDaysList retain]; + } + + id = [NSString stringWithFormat: @"weekDay%i", [shortWeekDaysList indexOfObject: item]]; + + return id; +} + +- (NSString *) labelForWeekDay +{ + return item; +} + @end diff --git a/UI/Templates/SchedulerUI/UIxRecurrenceEditor.wox b/UI/Templates/SchedulerUI/UIxRecurrenceEditor.wox index 7ced27de7..c58733c8e 100644 --- a/UI/Templates/SchedulerUI/UIxRecurrenceEditor.wox +++ b/UI/Templates/SchedulerUI/UIxRecurrenceEditor.wox @@ -70,13 +70,9 @@
-

-

-

-

-

-

-

+

+
@@ -98,9 +94,9 @@ @@ -177,7 +173,7 @@ class="textField" var:value="title" /> + string="itemText"/> @@ -190,7 +186,7 @@ + string="itemText"/> @@ -200,7 +196,7 @@ + string="itemText"/>