From 07e108baf5ba3115d12de79ab5b5f3e8fee831fd Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 23 Dec 2008 00:12:14 +0000 Subject: [PATCH] Fix for bug #3097 Monotone-Parent: 30278078dfd012e96e074c87b01c0c3a5fab2bbc Monotone-Revision: 4aebe8e414a3fcd8c8f09db947a8221f926ab5cd Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-12-23T00:12:14 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoUser.m | 2 +- UI/PreferencesUI/UIxPreferences.h | 1 + UI/PreferencesUI/UIxPreferences.m | 18 +++++++++++++----- UI/Scheduler/UIxCalDayTable.m | 10 ++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index c9c6a1322..617a971ec 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -447,7 +447,7 @@ _timeValue (NSString *key) if (!dateFormatter) { dateFormatter = [SOGoDateFormatter new]; - [dateFormatter setLocale: [context valueForKey: @"locale"]]; + [dateFormatter setLocale: [[WOApplication application] localeForLanguageNamed: [self language]]]; ud = [self userDefaults]; format = [ud stringForKey: @"ShortDateFormat"]; if (format) diff --git a/UI/PreferencesUI/UIxPreferences.h b/UI/PreferencesUI/UIxPreferences.h index 1ccc15ae7..745f5605b 100644 --- a/UI/PreferencesUI/UIxPreferences.h +++ b/UI/PreferencesUI/UIxPreferences.h @@ -34,6 +34,7 @@ { id item; SOGoUser *user; + NSDictionary *locale; NSUserDefaults *userDefaults; NSCalendarDate *today; NSMutableArray *hours; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index ef374b5a6..d7aadb460 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -65,16 +65,20 @@ static BOOL shouldDisplayAdditionalPreferences = NO; - (id) init { - NSDictionary *locale; + //NSDictionary *locale; + NSString *language; if ((self = [super init])) { + language = [[context activeUser] language]; + item = nil; hours = nil; ASSIGN (user, [context activeUser]); ASSIGN (userDefaults, [user userDefaults]); ASSIGN (today, [NSCalendarDate date]); - locale = [context valueForKey: @"locale"]; + //locale = [context valueForKey: @"locale"]; + ASSIGN (locale, [[WOApplication application] localeForLanguageNamed: language]); ASSIGN (daysOfWeek, [locale objectForKey: NSWeekDayNameArray]); hasChanged = NO; @@ -91,6 +95,7 @@ static BOOL shouldDisplayAdditionalPreferences = NO; [userDefaults release]; [hours release]; [daysOfWeek release]; + [locale release]; [super dealloc]; } @@ -185,7 +190,8 @@ static BOOL shouldDisplayAdditionalPreferences = NO; - (NSString *) itemShortDateFormatText { return [today descriptionWithCalendarFormat: item - locale: [context valueForKey: @"locale"]]; + locale: locale]; + //locale: [context valueForKey: @"locale"]]; } - (NSString *) userShortDateFormat @@ -228,7 +234,8 @@ static BOOL shouldDisplayAdditionalPreferences = NO; - (NSString *) itemLongDateFormatText { return [today descriptionWithCalendarFormat: item - locale: [context valueForKey: @"locale"]]; + locale: locale]; + //locale: [context valueForKey: @"locale"]]; } - (NSString *) userLongDateFormat @@ -271,7 +278,8 @@ static BOOL shouldDisplayAdditionalPreferences = NO; - (NSString *) itemTimeFormatText { return [today descriptionWithCalendarFormat: item - locale: [context valueForKey: @"locale"]]; + locale: locale]; + //locale: [context valueForKey: @"locale"]]; } - (NSString *) userTimeFormat diff --git a/UI/Scheduler/UIxCalDayTable.m b/UI/Scheduler/UIxCalDayTable.m index 37df0f3d4..9b3b36a5c 100644 --- a/UI/Scheduler/UIxCalDayTable.m +++ b/UI/Scheduler/UIxCalDayTable.m @@ -44,17 +44,23 @@ { if ((self = [super init])) { + NSDictionary *locale; + NSString *language; + + language = [[context activeUser] language]; + locale = [[WOApplication application] localeForLanguageNamed: language]; + daysToDisplay = nil; hoursToDisplay = nil; numberOfDays = 1; startDate = nil; currentTableDay = nil; currentTableHour = nil; - weekDays = [[context valueForKey: @"locale"] objectForKey: NSShortWeekDayNameArray]; + weekDays = [locale objectForKey: NSShortWeekDayNameArray]; [weekDays retain]; dateFormatter = [[context activeUser] dateFormatterInContext: context]; } - + return self; }