+2004-07-21 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * UIxComponent.[hm]: date specific labels (weekday names, month names)
+ (v0.9.3)
+
2004-07-20 Marcus Mueller <znek@mulle-kybernetik.com>
* UIxComponent.[hm]: new method -labelForKey: implemented very similar to
/* labels */
- (NSString *)labelForKey:(NSString *)_key;
+- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek;
+- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek;
+- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear;
+- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear;
+
/* locale */
- (NSDictionary *)locale;
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 {
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"];
}
# $Id$
-SUBMINOR_VERSION:=2
+SUBMINOR_VERSION:=3
# 1.1.0 requires NGObjWeb 4.2.202
+2004-07-21 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * 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 <znek@mulle-kybernetik.com>
* v0.9.2
--- /dev/null
+/* 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";
--- /dev/null
+/* 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";
// $Id$
-#include <NGObjWeb/NGObjWeb.h>
+#include <SOGoUI/UIxComponent.h>
+#include <Foundation/Foundation.h>
-
-@interface UIxCalDateLabel : WOComponent
+@interface UIxCalDateLabel : UIxComponent
{
NSString *selection;
NSCalendarDate *startDate;
}
- (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:@"<nobr>%@ / %@</nobr>",
- label,
- ext];
+
+ label = [NSString stringWithFormat:@"%@ %d",
+ [self localizedNameForMonthOfYear:[self->startDate monthOfYear]],
+ [self->startDate yearOfCommonEra]];
+ if([self->startDate monthOfYear] != [self->endDate monthOfYear]) {
+ label = [NSString stringWithFormat:@"<nobr>%@ / %@ %d</nobr>",
+ 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
@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];
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 {
<table border='0' cellpadding='0' cellspacing='1'>
<tr>
<td class="button_auto_env" nowrap="true" valign='middle' align='center'>
- <a class="button_auto" href="monthprintview" var:queryDictionary="queryParameters" target="SOGoPrintView">printview</a>
+ <a class="button_auto" href="monthprintview" var:queryDictionary="queryParameters" target="SOGoPrintView"><var:string label:value="printview" /></a>
</td>
<td class="button_auto_env" nowrap="true" valign='middle' align='center'>
- <a class="button_auto" href="proposal" var:queryDictionary="queryParameters">proposal</a>
+ <a class="button_auto" href="proposal" var:queryDictionary="queryParameters"><var:string label:value="proposal" /></a>
</td>
</tr>
</table>
dayOfWeek="dayOfWeek"
const:class="monthoverview_title"
>
- <var:string value="localizedNameOfDayOfWeek" />
+ <var:string value="localizedDayOfWeekName" />
</var:month-label>
<var:month-label const:orientation="left"
weekOfYear="weekOfYear"
<br />
<span class="monthoverview_day_new">
<a href="new" var:queryDictionary="currentDayQueryParameters"
- >[new]</a>
+ >[<var:string label:value="new" />]</a>
</span>
</var:month-title>
}
- (void)setCurrentDate:(NSCalendarDate *)_date {
+ [_date setTimeZone:[self viewTimeZone]];
ASSIGN(self->currentDate, _date);
}
- (NSString *)dayLabel {
- return [self->currentDate descriptionWithCalendarFormat:@"%d"];
+ return [NSString stringWithFormat:@"%d",
+ [self->currentDate dayOfMonth]];
}
- (NSString *)weekLabel {
}
- (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]];
}
/* current day related */
- (void)setCurrentDay:(NSCalendarDate *)_day {
+ [_day setTimeZone:[self viewTimeZone]];
ASSIGN(self->currentDay, _day);
}
- (NSCalendarDate *)currentDay {
}
- (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 {
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td><img rsrc:src="icon_apt_overview_inactive.gif"
- title="Overview" alt="Overview" border="0"
+ label:title="Overview" label:alt="Overview" border="0"
valign="top" /></td>
<td><a href="weekchartview"><img
- rsrc:src="icon_apt_chart.gif" title="Chart"
- alt="Chart" border="0" valign="top" /></a></td>
+ rsrc:src="icon_apt_chart.gif" label:title="Chart"
+ label:alt="Chart" border="0" valign="top" /></a></td>
<td><a href="weeklistview"><img
- rsrc:src="icon_apt_list.gif" title="List"
- alt="List" border="0" valign="top" /></a></td>
+ rsrc:src="icon_apt_list.gif" label:title="List"
+ label:alt="List" border="0" valign="top" /></a></td>
<td>
<a href="weekcolumnview"><img
- rsrc:src="icon_apt_column_view.gif" title="Columns"
- alt="Columns" border="0" valign="top" /></a>
+ rsrc:src="icon_apt_column_view.gif" label:title="Columns"
+ label:alt="Columns" border="0" valign="top" /></a>
</td>
</tr>
</table>
align='center'>
<a class="button_auto" href="weekprintview"
var:queryDictionary="queryParameters"
- target="SOGoPrintView">printview</a>
+ target="SOGoPrintView"><var:string label:value="printview" /></a>
</td>
<td class="button_auto_env" nowrap="true" valign='middle'
align='center'>
<a class="button_auto" href="proposal"
- var:queryDictionary="queryParameters">proposal</a>
+ var:queryDictionary="queryParameters"><var:string label:value="proposal" /></a>
</td>
</tr>
</table>
[<a href="new"
var:queryDictionary="currentDayQueryParameters"
class="weekoverview_title_newlink"
- >new</a>]
+ ><var:string label:value="new" /></a>]
</td>
</tr>
</table>