From: znek Date: Wed, 21 Jul 2004 13:49:24 +0000 (+0000) Subject: Ongoing localization X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05a7dce82406ba77359a3b1d000eee20aaf7619c;p=scalable-opengroupware.org Ongoing localization git-svn-id: http://svn.opengroupware.org/SOGo/trunk@152 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index 46426be0..da9d49fe 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,8 @@ +2004-07-21 Marcus Mueller + + * UIxComponent.[hm]: date specific labels (weekday names, month names) + (v0.9.3) + 2004-07-20 Marcus Mueller * UIxComponent.[hm]: new method -labelForKey: implemented very similar to diff --git a/SOGo/UI/SOGoUI/UIxComponent.h b/SOGo/UI/SOGoUI/UIxComponent.h index f6cbfa69..937a1837 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.h +++ b/SOGo/UI/SOGoUI/UIxComponent.h @@ -55,6 +55,11 @@ /* labels */ - (NSString *)labelForKey:(NSString *)_key; +- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek; +- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek; +- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear; +- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear; + /* locale */ - (NSDictionary *)locale; diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index e0d633b9..2d035892 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -37,11 +37,63 @@ static NSTimeZone *MET = nil; static NSTimeZone *GMT = nil; +static NSMutableArray *dayLabelKeys = nil; +static NSMutableArray *abbrDayLabelKeys = nil; +static NSMutableArray *monthLabelKeys = nil; +static NSMutableArray *abbrMonthLabelKeys = nil; + + (void)initialize { - if (MET == nil) { - MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain]; - GMT = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain]; - } + if (MET == nil) { + MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain]; + GMT = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain]; + } + 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"]; + + abbrDayLabelKeys = [[NSMutableArray alloc] initWithCapacity:7]; + [abbrDayLabelKeys addObject:@"Sun"]; + [abbrDayLabelKeys addObject:@"Mon"]; + [abbrDayLabelKeys addObject:@"Tue"]; + [abbrDayLabelKeys addObject:@"Wed"]; + [abbrDayLabelKeys addObject:@"Thu"]; + [abbrDayLabelKeys addObject:@"Fri"]; + [abbrDayLabelKeys addObject:@"Sat"]; + + monthLabelKeys = [[NSMutableArray alloc] initWithCapacity:12]; + [monthLabelKeys addObject:@"January"]; + [monthLabelKeys addObject:@"February"]; + [monthLabelKeys addObject:@"March"]; + [monthLabelKeys addObject:@"April"]; + [monthLabelKeys addObject:@"May"]; + [monthLabelKeys addObject:@"June"]; + [monthLabelKeys addObject:@"July"]; + [monthLabelKeys addObject:@"August"]; + [monthLabelKeys addObject:@"September"]; + [monthLabelKeys addObject:@"October"]; + [monthLabelKeys addObject:@"November"]; + [monthLabelKeys addObject:@"December"]; + + abbrMonthLabelKeys = [[NSMutableArray alloc] initWithCapacity:12]; + [abbrMonthLabelKeys addObject:@"Jan"]; + [abbrMonthLabelKeys addObject:@"Feb"]; + [abbrMonthLabelKeys addObject:@"Mar"]; + [abbrMonthLabelKeys addObject:@"Apr"]; + [abbrMonthLabelKeys addObject:@"May"]; + [abbrMonthLabelKeys addObject:@"Jun"]; + [abbrMonthLabelKeys addObject:@"Jul"]; + [abbrMonthLabelKeys addObject:@"Aug"]; + [abbrMonthLabelKeys addObject:@"Sep"]; + [abbrMonthLabelKeys addObject:@"Oct"]; + [abbrMonthLabelKeys addObject:@"Nov"]; + [abbrMonthLabelKeys addObject:@"Dec"]; + } } - (id)init { @@ -254,13 +306,30 @@ static NSTimeZone *GMT = nil; return label; } +- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek { + NSString *key = [dayLabelKeys objectAtIndex:_dayOfWeek % 7]; + return [self labelForKey:key]; +} + +- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek { + NSString *key = [abbrDayLabelKeys objectAtIndex:_dayOfWeek % 7]; + return [self labelForKey:key]; +} + +- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear { + NSString *key = [monthLabelKeys objectAtIndex:(_monthOfYear - 1) % 12]; + return [self labelForKey:key]; +} + +- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear { + NSString *key = [abbrMonthLabelKeys objectAtIndex:(_monthOfYear - 1) % 12]; + return [self labelForKey:key]; +} + /* 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"]; } diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index 434e1ad2..6300d3ac 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,5 +1,5 @@ # $Id$ -SUBMINOR_VERSION:=2 +SUBMINOR_VERSION:=3 # 1.1.0 requires NGObjWeb 4.2.202 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 31915fa8..3fb9b3b0 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,19 @@ +2004-07-21 Marcus Mueller + + * v0.9.3 + + * *.wox: Use label associations where appropriate + + * UIxCalView.m: Use labels for localization + + * UIxCalMonthOverview.m: removed date specific labels, moved + to SOGoUI/UIxComponent.m. + + * UIxCalDateLabel.m: subclasses from UIxComponent now. Corrected + localization using labels now. + + * *.lproj/default.strings: new entries + 2004-07-20 Marcus Mueller * v0.9.2 diff --git a/SOGo/UI/Scheduler/English.lproj/default.strings b/SOGo/UI/Scheduler/English.lproj/default.strings new file mode 100644 index 00000000..e73e41cd --- /dev/null +++ b/SOGo/UI/Scheduler/English.lproj/default.strings @@ -0,0 +1,72 @@ +/* this file is in ISO-8859-1 format! */ + +/* Day */ + +"Sunday" = "Sunday"; +"Monday" = "Monday"; +"Tuesday" = "Tuesday"; +"Wednesday" = "Wednesday"; +"Thursday" = "Thursday"; +"Friday" = "Friday"; +"Saturday" = "Saturday"; + +"Sun" = "Sun"; +"Mon" = "Mon"; +"Tue" = "Tue"; +"Wed" = "Wed"; +"Thu" = "Thu"; +"Fri" = "Fri"; +"Sat" = "Sat"; + +"dayLabelFormat" = "%Y-%m-%d"; + + +/* Week */ + +"Week" = "Week"; +"this week" = "this week"; + + +/* Month */ + +"this month" = "this month"; + +"January" = "January"; +"February" = "February"; +"March" = "March"; +"April" = "April"; +"May" = "May"; +"June" = "June"; +"July" = "July"; +"August" = "August"; +"September" = "September"; +"October" = "October"; +"November" = "November"; +"December" = "December"; + +"Jan" = "Jan"; +"Feb" = "Feb"; +"Mar" = "Mar"; +"Apr" = "Apr"; +"May" = "May"; +"Jun" = "Jun"; +"Jul" = "Jul"; +"Aug" = "Aug"; +"Sep" = "Sep"; +"Oct" = "Oct"; +"Nov" = "Nov"; +"Dec" = "Dec"; + +/* Misc */ + +"new" = "new"; +"printview" = "printview"; +"proposal" = "proposal"; + + +/* calendar modes */ + +"Overview" = "Overview"; +"Chart" = "Chart"; +"List" = "List"; +"Columns" = "Columns"; diff --git a/SOGo/UI/Scheduler/French.lproj/default.strings b/SOGo/UI/Scheduler/French.lproj/default.strings new file mode 100644 index 00000000..8fa8deac --- /dev/null +++ b/SOGo/UI/Scheduler/French.lproj/default.strings @@ -0,0 +1,72 @@ +/* this file is in ISO-8859-1 format! */ + +/* Day */ + +"Sunday" = "Dimanche"; +"Monday" = "Lundi"; +"Tuesday" = "Mardi"; +"Wednesday" = "Mercredi"; +"Thursday" = "Jeudi"; +"Friday" = "Vendredi"; +"Saturday" = "Samedi"; + +"Sun" = "Dim"; +"Mon" = "Lun"; +"Tue" = "Mar"; +"Wed" = "Mer"; +"Thu" = "Jeu"; +"Fri" = "Ven"; +"Sat" = "Sam"; + +"dayLabelFormat" = "%Y-%m-%d"; + + +/* Week */ + +"Week" = "Semaine"; +"this week" = "cette semaine"; + + +/* Month */ +"this month" = "ce mois"; + +"January" = "Janvier"; +"February" = "Février"; +"March" = "Mars"; +"April" = "Avril"; +"May" = "Mai"; +"June" = "Juin"; +"July" = "Juillet"; +"August" = "Août"; +"September" = "Septembre"; +"October" = "Octobre"; +"November" = "Novembre"; +"December" = "Décembre"; + +"Jan" = "Jan"; +"Feb" = "Fév"; +"Mar" = "Mar"; +"Apr" = "Avr"; +"May" = "Mai"; +"Jun" = "Jun"; +"Jul" = "Jul"; +"Aug" = "Aoû"; +"Sep" = "Sep"; +"Oct" = "Oct"; +"Nov" = "Nov"; +"Dec" = "Déc"; + + +/* Misc */ + +"new" = "new"; +"printview" = "printview"; +"proposal" = "proposal"; + + +/* calendar modes */ + +"Overview" = "Overview"; +"Chart" = "Chart"; +"List" = "List"; +"Columns" = "Columns"; diff --git a/SOGo/UI/Scheduler/UIxCalDateLabel.m b/SOGo/UI/Scheduler/UIxCalDateLabel.m index 5e7fa489..3b538afc 100644 --- a/SOGo/UI/Scheduler/UIxCalDateLabel.m +++ b/SOGo/UI/Scheduler/UIxCalDateLabel.m @@ -21,10 +21,10 @@ // $Id$ -#include +#include +#include - -@interface UIxCalDateLabel : WOComponent +@interface UIxCalDateLabel : UIxComponent { NSString *selection; NSCalendarDate *startDate; @@ -84,30 +84,36 @@ } - (NSString *)dayLabel { - return [self->startDate descriptionWithCalendarFormat:@"%Y-%m-%d"]; + NSString *fmt; + + fmt = [self labelForKey:@"dayLabelFormat"]; + return [self->startDate descriptionWithCalendarFormat:fmt]; } - (NSString *)weekLabel { NSString *label; - - label = [self->startDate descriptionWithCalendarFormat:@"%B %Y"]; - if([self->startDate monthOfYear] != [self->endDate monthOfYear]) { - NSString *ext; - - ext = [self->endDate descriptionWithCalendarFormat:@"%B %Y"]; - label = [NSString stringWithFormat:@"%@ / %@", - label, - ext]; + + label = [NSString stringWithFormat:@"%@ %d", + [self localizedNameForMonthOfYear:[self->startDate monthOfYear]], + [self->startDate yearOfCommonEra]]; + if([self->startDate monthOfYear] != [self->endDate monthOfYear]) { + label = [NSString stringWithFormat:@"%@ / %@ %d", + label, + [self localizedNameForMonthOfYear:[self->endDate monthOfYear]], + [self->endDate yearOfCommonEra]]; } return label; } - (NSString *)monthLabel { - return [self->startDate descriptionWithCalendarFormat:@"%B %Y"]; + return [NSString stringWithFormat:@"%@ %d", + [self localizedNameForMonthOfYear:[self->startDate monthOfYear]], + [self->startDate yearOfCommonEra]]; } - (NSString *)yearLabel { - return [self->startDate descriptionWithCalendarFormat:@"%Y"]; + return [NSString stringWithFormat:@"%d", + [self->startDate yearOfCommonEra]]; } @end diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.m b/SOGo/UI/Scheduler/UIxCalMonthOverview.m index 4f784818..756f85a1 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.m +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.m @@ -18,20 +18,6 @@ @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]; @@ -86,11 +72,8 @@ static NSMutableArray *dayLabelKeys = nil; return [[self startDate] monthOfYear]; } -- (NSString *)localizedNameOfDayOfWeek { - NSString *key; - - key = [dayLabelKeys objectAtIndex:self->dayOfWeek]; - return [self labelForKey:key]; +- (NSString *)localizedDayOfWeekName { + return [self localizedNameForDayOfWeek:self->dayOfWeek]; } - (NSDictionary *)currentWeekQueryParameters { diff --git a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox index 6010cb11..cccb20e4 100644 --- a/SOGo/UI/Scheduler/UIxCalMonthOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalMonthOverview.wox @@ -56,10 +56,10 @@
- printview + - proposal +
@@ -95,7 +95,7 @@ dayOfWeek="dayOfWeek" const:class="monthoverview_title" > - + [new] + >[] diff --git a/SOGo/UI/Scheduler/UIxCalSelectTab.m b/SOGo/UI/Scheduler/UIxCalSelectTab.m index 759fb230..fcd77366 100644 --- a/SOGo/UI/Scheduler/UIxCalSelectTab.m +++ b/SOGo/UI/Scheduler/UIxCalSelectTab.m @@ -52,6 +52,7 @@ } - (void)setCurrentDate:(NSCalendarDate *)_date { + [_date setTimeZone:[self viewTimeZone]]; ASSIGN(self->currentDate, _date); } @@ -64,7 +65,8 @@ - (NSString *)dayLabel { - return [self->currentDate descriptionWithCalendarFormat:@"%d"]; + return [NSString stringWithFormat:@"%d", + [self->currentDate dayOfMonth]]; } - (NSString *)weekLabel { @@ -77,12 +79,13 @@ } - (NSString *)monthLabel { - return [self->currentDate descriptionWithCalendarFormat:@"%B" - locale:[self locale]]; + return [NSString stringWithFormat:@"%@", + [self localizedNameForMonthOfYear:[self->currentDate monthOfYear]]]; } - (NSString *)yearLabel { - return [self->currentDate descriptionWithCalendarFormat:@"%Y"]; + return [NSString stringWithFormat:@"%d", + [self->currentDate yearOfCommonEra]]; } diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index 50746474..69fa83ae 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -73,6 +73,7 @@ /* current day related */ - (void)setCurrentDay:(NSCalendarDate *)_day { + [_day setTimeZone:[self viewTimeZone]]; ASSIGN(self->currentDay, _day); } - (NSCalendarDate *)currentDay { @@ -80,9 +81,7 @@ } - (NSString *)currentDayName { - // TODO: this is slow, use locale dictionary to speed this up - [self->currentDay setTimeZone:[self viewTimeZone]]; - return [self->currentDay descriptionWithCalendarFormat:@"%A"]; + return [self localizedNameForDayOfWeek:[self->currentDay dayOfWeek]]; } - (BOOL)hasDayInfo { diff --git a/SOGo/UI/Scheduler/UIxCalWeekOverview.wox b/SOGo/UI/Scheduler/UIxCalWeekOverview.wox index 4a238f5f..8628b480 100644 --- a/SOGo/UI/Scheduler/UIxCalWeekOverview.wox +++ b/SOGo/UI/Scheduler/UIxCalWeekOverview.wox @@ -56,18 +56,18 @@ + rsrc:src="icon_apt_chart.gif" label:title="Chart" + label:alt="Chart" border="0" valign="top" /> + rsrc:src="icon_apt_list.gif" label:title="List" + label:alt="List" border="0" valign="top" />
Overview Chart List Columns + rsrc:src="icon_apt_column_view.gif" label:title="Columns" + label:alt="Columns" border="0" valign="top" />
@@ -80,12 +80,12 @@ align='center'> printview + target="SOGoPrintView"> proposal + var:queryDictionary="queryParameters"> @@ -117,7 +117,7 @@ [new] + >]