From 58f7304844b3650384df8776356ae284b2e23dbb Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 19 Jul 2004 16:23:38 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@147 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/Main/ChangeLog | 9 ++++--- SOGo/Main/sogod.m | 66 ++++++++++++++++++++++----------------------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/SOGo/Main/ChangeLog b/SOGo/Main/ChangeLog index 985d128b..dd0797df 100644 --- a/SOGo/Main/ChangeLog +++ b/SOGo/Main/ChangeLog @@ -2,11 +2,12 @@ * v0.9.2 - * sogod.m: added localization methods. Current locale is put into WOContext - upon first request. All locales are cached in the application object. + * sogod.m: added localization methods. Current locale is put into + WOContext upon first request. All locales are cached in the + application object. - * [English,French].lproj: created. Put appropriate Locale representations - here. + * [English,French].lproj: created. Put appropriate Locale + representations here. * GNUmakefile: added LANGUAGES and LOCALIZED_RESOURCES. diff --git a/SOGo/Main/sogod.m b/SOGo/Main/sogod.m index c63b6419..b4643267 100644 --- a/SOGo/Main/sogod.m +++ b/SOGo/Main/sogod.m @@ -206,44 +206,44 @@ static BOOL doCrashOnSessionCreate = NO; /* localization */ - (NSDictionary *)currentLocaleConsideringLanguages:(NSArray *)_langs { - unsigned i, count; - - // assume _langs is ordered by priority - count = [_langs count]; - for(i = 0; i < count; i++) { - NSString *lname; - NSDictionary *locale; - - lname = [_langs objectAtIndex:i]; - locale = [self localeForLanguageNamed:lname]; - if(locale) - return locale; - } - // no appropriate language, fallback to default - return [self localeForLanguageNamed:@"English"]; + unsigned i, count; + + /* assume _langs is ordered by priority */ + count = [_langs count]; + for (i = 0; i < count; i++) { + NSString *lname; + NSDictionary *locale; + + lname = [_langs objectAtIndex:i]; + locale = [self localeForLanguageNamed:lname]; + if (locale) + return locale; + } + /* no appropriate language, fallback to default */ + return [self localeForLanguageNamed:@"English"]; } - (NSDictionary *)localeForLanguageNamed:(NSString *)_name { - NSString *lpath; - NSDictionary *locale; + NSString *lpath; + NSDictionary *locale; - NSAssert(_name != nil, @"_name MUST NOT be nil!"); - if((locale = [self->localeLUT objectForKey:_name]) != nil) - return locale; - lpath = [[self resourceManager] - pathForResourceNamed:@"Locale" - inFramework:nil - languages:[NSArray arrayWithObject:_name]]; - locale = [[NSString stringWithContentsOfFile:lpath] - propertyList]; - if(locale == nil) { - NSLog(@"%s didn't find locale with name:%@", - __PRETTY_FUNCTION__, - _name); - return nil; - } - [self->localeLUT setObject:locale forKey:_name]; + NSAssert(_name != nil, @"_name MUST NOT be nil!"); + if ((locale = [self->localeLUT objectForKey:_name]) != nil) return locale; + + lpath = [[self resourceManager] + pathForResourceNamed:@"Locale" + inFramework:nil + languages:[NSArray arrayWithObject:_name]]; + locale = [[NSString stringWithContentsOfFile:lpath] propertyList]; + if (locale == nil) { + NSLog(@"%s didn't find locale with name:%@", + __PRETTY_FUNCTION__, + _name); + return nil; + } + [self->localeLUT setObject:locale forKey:_name]; + return locale; } @end /* SOGo */ -- 2.39.5