From: znek Date: Tue, 20 Jul 2004 20:19:47 +0000 (+0000) Subject: changes for proper localization X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3dea32a7d6c9924ecad72ce47a183a45e14e59d;p=scalable-opengroupware.org changes for proper localization git-svn-id: http://svn.opengroupware.org/SOGo/trunk@151 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SOGo.xcode/project.pbxproj b/SOGo/SOGo.xcode/project.pbxproj index 3d62590a..79685e58 100644 --- a/SOGo/SOGo.xcode/project.pbxproj +++ b/SOGo/SOGo.xcode/project.pbxproj @@ -107,6 +107,33 @@ refType = 4; sourceTree = ""; }; + ADCDE53106ADA8AC00BFCE2B = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/default.strings; + refType = 4; + sourceTree = ""; + }; + ADCDE53206ADA8C800BFCE2B = { + children = ( + ADCDE53106ADA8AC00BFCE2B, + ADCDE53306ADA8CF00BFCE2B, + ); + isa = PBXVariantGroup; + name = default.strings; + refType = 4; + sourceTree = ""; + }; + ADCDE53306ADA8CF00BFCE2B = { + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = French; + path = French.lproj/default.strings; + refType = 4; + sourceTree = ""; + }; //AD0 //AD1 //AD2 @@ -982,13 +1009,14 @@ }; E87207EA0692E3D20099CBBD = { children = ( - E872088E0692E3D30099CBBD, E872088F0692E3D30099CBBD, E87208910692E3D30099CBBD, E87208920692E3D30099CBBD, E872090C0692E3D30099CBBD, E87208D30692E3D30099CBBD, + E872088E0692E3D30099CBBD, E87208E20692E3D30099CBBD, + ADCDE53206ADA8C800BFCE2B, E8720A0C0692E4940099CBBD, E87208960692E3D30099CBBD, E8720A3B0692E4C20099CBBD, @@ -1042,28 +1070,31 @@ sourceTree = ""; }; E87208930692E3D30099CBBD = { + explicitFileType = sourcecode.make; fileEncoding = 4; isa = PBXFileReference; - lastKnownFileType = text; path = GNUmakefile; refType = 4; sourceTree = ""; + tabWidth = 4; }; E87208940692E3D30099CBBD = { + explicitFileType = sourcecode.make; fileEncoding = 4; isa = PBXFileReference; - lastKnownFileType = text; path = GNUmakefile.postamble; refType = 4; sourceTree = ""; + tabWidth = 4; }; E87208950692E3D30099CBBD = { + explicitFileType = sourcecode.make; fileEncoding = 4; isa = PBXFileReference; - lastKnownFileType = text; path = GNUmakefile.preamble; refType = 4; sourceTree = ""; + tabWidth = 4; }; E87208960692E3D30099CBBD = { children = ( diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index e7f21c57..46426be0 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,8 @@ +2004-07-20 Marcus Mueller + + * UIxComponent.[hm]: new method -labelForKey: implemented very similar to + new WOLabelAssociation in SOPE. Also implemented -locale. (v0.9.2) + 2004-07-19 Marcus Mueller * UIxComponent.m: new method -backendTimeZone. diff --git a/SOGo/UI/SOGoUI/UIxComponent.h b/SOGo/UI/SOGoUI/UIxComponent.h index b97ec2cd..f6cbfa69 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.h +++ b/SOGo/UI/SOGoUI/UIxComponent.h @@ -52,6 +52,12 @@ - (NSString *)dateStringForDate:(NSCalendarDate *)_date; - (NSCalendarDate *)dateForDateString:(NSString *)_dateString; +/* labels */ +- (NSString *)labelForKey:(NSString *)_key; + +/* locale */ +- (NSDictionary *)locale; + @end #endif /* __UIxComponent_H_ */ diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index 5bda9cd0..e0d633b9 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -194,4 +194,74 @@ static NSTimeZone *GMT = nil; calendarFormat:@"%Y%m%d %H:%M:%S %Z"]; } + +/* labels */ + +- (NSString *)labelForKey:(NSString *)_str { + WOResourceManager *rm; + NSArray *languages; + WOContext *ctx; + NSString *label; + NSString *lKey, *lTable, *lVal; + NSRange r; + + if ([_str length] == 0) { + return nil; + } + + /* lookup languages */ + + ctx = [self context]; + languages = [ctx hasSession] + ? [[ctx session] languages] + : [[ctx request] browserLanguages]; + + /* find resource manager */ + + if ((rm = [self resourceManager]) == nil) + rm = [[WOApplication application] resourceManager]; + if (rm == nil) + [self debugWithFormat:@"WARNING: missing resource manager!"]; + + /* get parameters */ + + r = [_str rangeOfString:@"/"]; + if (r.length > 0) { + lTable = [_str substringToIndex:r.location]; + lKey = [_str substringFromIndex:(r.location + r.length)]; + } + else { + lTable = nil; + lKey = _str; + } + lVal = lKey; + + if([lKey hasPrefix:@"$"]) { + lKey = [self valueForKeyPath:[lKey substringFromIndex:1]]; + } + if([lTable hasPrefix:@"$"]) { + lTable = [self valueForKeyPath:[lTable substringFromIndex:1]]; + } +#if 0 + if([lVal hasPrefix:@"$"]) { + lVal = [self valueForKeyPath:[lVal substringFromIndex:1]]; + } +#endif + /* lookup string */ + + label = [rm stringForKey:lKey inTableNamed:lTable withDefaultValue:lVal + languages:languages]; + return label; +} + +/* locale */ + +- (NSDictionary *)locale { + /* we need no fallback here, as locale is guaranteed to be set by sogod */ + NSLog(@"%s locale:%@", + __PRETTY_FUNCTION__, + [[self context] valueForKey:@"locale"]); + return [[self context] valueForKey:@"locale"]; +} + @end /* UIxComponent */ diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index f5832bdd..434e1ad2 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,5 +1,5 @@ # $Id$ -SUBMINOR_VERSION:=1 +SUBMINOR_VERSION:=2 # 1.1.0 requires NGObjWeb 4.2.202 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 288dc8cc..31915fa8 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,16 @@ +2004-07-20 Marcus Mueller + + * v0.9.2 + + * GNUmakefile: added new .lproj resources. + + * {English,French}.lproj/default.plist: localizable strings for the + Scheduler bundle. + + * UIxCalSelectTab.m, UIxCalWeekOverview.wox, + UIxCalMonthOverview.[m|wox]: changes for using new localization + features. + 2004-07-19 Marcus Mueller * UIxAppointmentEditor.m: Use -backendTimeZone from UIxComponent. diff --git a/SOGo/UI/Scheduler/GNUmakefile b/SOGo/UI/Scheduler/GNUmakefile index 09d45692..3df9e56b 100644 --- a/SOGo/UI/Scheduler/GNUmakefile +++ b/SOGo/UI/Scheduler/GNUmakefile @@ -8,6 +8,8 @@ BUNDLE_INSTALL_DIR = $(GNUSTEP_USER_ROOT)/Library/SOGo SchedulerUI_PRINCIPAL_CLASS = SchedulerUIProduct +SchedulerUI_LANGUAGES = English French + SchedulerUI_OBJC_FILES = \ SchedulerUIProduct.m \ UIxAppointmentFormatter.m \ @@ -46,6 +48,9 @@ SchedulerUI_RESOURCE_FILES += \ images/icon_apt_list.gif \ images/icon_apt_list_inactive.gif \ +SchedulerUI_LOCALIZED_RESOURCE_FILES += \ + default.strings + ADDITIONAL_INCLUDE_DIRS += \ -I.. -I../.. -I../../.. diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.m b/SOGo/UI/Scheduler/UIxCalMonthOverview.m index 17526f66..4f784818 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.m +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.m @@ -18,6 +18,21 @@ @implementation UIxCalMonthOverview +static NSMutableArray *dayLabelKeys = nil; + ++ (void)initialize { + if (dayLabelKeys == nil) { + dayLabelKeys = [[NSMutableArray alloc] initWithCapacity:7]; + [dayLabelKeys addObject:@"Sunday"]; + [dayLabelKeys addObject:@"Monday"]; + [dayLabelKeys addObject:@"Tuesday"]; + [dayLabelKeys addObject:@"Wednesday"]; + [dayLabelKeys addObject:@"Thursday"]; + [dayLabelKeys addObject:@"Friday"]; + [dayLabelKeys addObject:@"Saturday"]; + } +} + - (void)dealloc { [self->currentWeekStart release]; [super dealloc]; @@ -72,18 +87,10 @@ } - (NSString *)localizedNameOfDayOfWeek { - // TODO: move this to some locale method - static char *dayNames[] = { - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" - }; - return [[[NSString alloc] initWithCString: - dayNames[self->dayOfWeek]] autorelease]; + NSString *key; + + key = [dayLabelKeys objectAtIndex:self->dayOfWeek]; + return [self labelForKey:key]; } - (NSDictionary *)currentWeekQueryParameters { diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox index dd690808..6010cb11 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox @@ -4,6 +4,7 @@ xmlns:var="http://www.skyrix.com/od/binding" xmlns:const="http://www.skyrix.com/od/constant" xmlns:rsrc="OGo:url" + xmlns:label="OGo:label" > @@ -32,7 +33,7 @@ prevQueryParameters="prevMonthQueryParameters" currentQueryParameters="todayQueryParameters" nextQueryParameters="nextMonthQueryParameters" - const:label="this month" + label:label="this month" /> @@ -131,7 +132,7 @@ - + diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index d64ce5ad..434e1ad2 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,5 +1,5 @@ -# $Id: Version,v 1.1 2003/11/24 01:24:40 helge Exp $ +# $Id$ -SUBMINOR_VERSION:=1 +SUBMINOR_VERSION:=2 # 1.1.0 requires NGObjWeb 4.2.202
diff --git a/SOGo/UI/Scheduler/UIxCalSelectTab.m b/SOGo/UI/Scheduler/UIxCalSelectTab.m index cc693f8f..759fb230 100644 --- a/SOGo/UI/Scheduler/UIxCalSelectTab.m +++ b/SOGo/UI/Scheduler/UIxCalSelectTab.m @@ -68,11 +68,17 @@ } - (NSString *)weekLabel { - return [NSString stringWithFormat:@"Week %d", [self->currentDate weekOfYear]]; + NSString *wlbl; + + wlbl = [self labelForKey:@"Week"]; + return [NSString stringWithFormat:@"%@ %d", + wlbl, + [self->currentDate weekOfYear]]; } - (NSString *)monthLabel { - return [self->currentDate descriptionWithCalendarFormat:@"%B"]; + return [self->currentDate descriptionWithCalendarFormat:@"%B" + locale:[self locale]]; } - (NSString *)yearLabel { diff --git a/SOGo/UI/Scheduler/UIxCalWeekOverview.wox b/SOGo/UI/Scheduler/UIxCalWeekOverview.wox index eea16c9e..4a238f5f 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalWeekOverview.wox @@ -3,6 +3,7 @@ xmlns:var="http://www.skyrix.com/od/binding" xmlns:const="http://www.skyrix.com/od/constant" xmlns:rsrc="OGo:url" + xmlns:label="OGo:label" xmlns:uix="OGo:uix" className="UIxPageFrame" title="name"> @@ -34,7 +35,7 @@ prevQueryParameters="prevWeekQueryParameters" currentQueryParameters="todayQueryParameters" nextQueryParameters="nextWeekQueryParameters" - const:label="this week" + label:label="this week" />