From 41b41137bc1c2b73f8940e7965c65b80056f1726 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 18 Oct 2007 17:17:29 +0000 Subject: [PATCH] Monotone-Parent: 269150da497e736104a81ea8ce9ab74f8c6b6027 Monotone-Revision: c1039e97ecb95a8e1dd4a1ca25d457f206daeac3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-18T17:17:29 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoUser.h | 6 ++++++ SoObjects/SOGo/SOGoUser.m | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index 335e371ec..97711c563 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -48,6 +48,12 @@ extern NSString *SOGoWeekStartJanuary1; extern NSString *SOGoWeekStartFirst4DayWeek; extern NSString *SOGoWeekStartFirstFullWeek; +@interface SoUser (SOGoExtension) + +- (NSString *) language; + +@end + @interface SOGoUser : SoUser { NSString *currentPassword; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 0197ca939..9cd0c562b 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -57,6 +57,27 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; @end +@implementation SoUser (SOGoExtension) + +- (NSString *) language +{ + NSArray *bLanguages; + WOContext *context; + NSString *language; + + context = [[WOApplication application] context]; + bLanguages = [[context request] browserLanguages]; + if ([bLanguages count] > 0) + language = [bLanguages objectAtIndex: 0]; + + if (![language length]) + language = defaultLanguage; + + return language; +} + +@end + @implementation SOGoUser + (void) initialize