+2005-01-26 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * SOGoDateFormatter.[hm]: new method -setFrenchDateFormat: to override
+ the default ISO format. This will be chosen depending on locale
+ automatically. The full description uses this setting when generating
+ the appropriate part of the description. (v0.9.23)
+
2004-12-17 Marcus Mueller <znek@mulle-kybernetik.com>
* SOGoAptFormatter.m: remove "appointment" prefix from tooltips
{
NSDictionary *locale;
SEL formatAction;
+ SEL auxFormatAction;
}
- (id)initWithLocale:(NSDictionary *)_locale;
- (void)setISODateFormat;
+- (void)setFrenchDateFormat;
+
- (void)setFullWeekdayNameAndDetails;
- (NSString *)stringForObjectValue:(id)_obj;
- (id)initWithLocale:(NSDictionary *)_locale {
if ((self = [super init])) {
self->locale = [_locale retain];
- [self setISODateFormat];
+ if ([[self->locale objectForKey:@"NSLocaleCode"] isEqualToString:@"fr"]) {
+ [self setFrenchDateFormat];
+ }
+ else {
+ [self setISODateFormat];
+ }
}
return self;
}
self->formatAction = @selector(isoDateFormatForDate:);
}
+- (void)setFrenchDateFormat {
+ self->formatAction = @selector(frenchDateFormatForDate:);
+}
+
- (void)setFullWeekdayNameAndDetails {
- self->formatAction = @selector(fullWeekdayNameAndDetailsForDate:);
+ self->auxFormatAction = self->formatAction;
+ self->formatAction = @selector(fullWeekdayNameAndDetailsForDate:);
}
/* operation */
[_date dayOfMonth]];
}
+- (NSString *)frenchDateFormatForDate:(NSCalendarDate *)_date {
+ return [NSString stringWithFormat:@"%02d/%02d/%04d",
+ [_date dayOfMonth],
+ [_date monthOfYear],
+ [_date yearOfCommonEra]];
+}
+
- (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date {
NSMutableString *desc;
desc = [NSMutableString stringWithCapacity:24];
[desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]];
[desc appendString:@", "];
- [desc appendString:[self isoDateFormatForDate:_date]];
+ [desc appendString:[self performSelector:self->auxFormatAction
+ withObject:_date]];
[desc appendString:@" "];
[desc appendFormat:@"%02d:%02d ", [_date hourOfDay], [_date minuteOfHour]];
[desc appendString:[[_date timeZone] abbreviation]];
# $Id$
-SUBMINOR_VERSION:=22
+SUBMINOR_VERSION:=23
# v0.9.18 requires NGExtensions v4.5.136
-2004-01-07 Marcus Mueller <znek@mulle-kybernetik.com>
+2005-01-26 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * UIxDatePicker.m: corrected dateFormats for French locale. The
+ selection mechanism is pretty hackish and should be more generic.
+ This fixes SOGo Bug #1136. (v0.9.111)
+
+2005-01-07 Marcus Mueller <znek@mulle-kybernetik.com>
* {English/French}.lproj/default.strings: changed encoding from
ISO-Latin-1 to UTF-8, which is now the default (v0.9.110)
- (NSString *)dateID;
- (NSString *)dateFormat;
-
+- (NSString *)jsDateFormat;
+- (BOOL)useISOFormats;
@end
#include "common.h"
return self->label;
}
+
+/* formats */
+
+- (BOOL)useISOFormats {
+ WOContext *ctx;
+ NSNumber *useISOFormats;
+
+ ctx = [self context];
+ useISOFormats = [ctx valueForKey:@"useISOFormats"];
+ if (!useISOFormats) {
+ NSArray *languages = [ctx resourceLookupLanguages];
+ if (languages && [languages count] > 0) {
+ if ([[languages objectAtIndex:0] isEqualToString:@"French"]) {
+ useISOFormats = [NSNumber numberWithBool:NO];
+ }
+ }
+ if (!useISOFormats)
+ useISOFormats = [NSNumber numberWithBool:YES];
+ [ctx takeValue:useISOFormats forKey:@"useISOFormats"];
+ }
+ return [useISOFormats boolValue];
+}
- (NSString *)formattedDateString {
+ if ([self useISOFormats]) {
return [NSString stringWithFormat:@"%d-%02d-%02d",
- [[self year] intValue],
- [[self month] intValue],
- [[self day] intValue]];
+ [[self year] intValue],
+ [[self month] intValue],
+ [[self day] intValue]];
+ }
+ else {
+ return [NSString stringWithFormat:@"%02d/%02d/%04d",
+ [[self day] intValue],
+ [[self month] intValue],
+ [[self year] intValue]];
+ }
}
- (NSString *)dateFormat {
- return @"yyyy-mm-dd";
+ if ([self useISOFormats]) {
+ return @"%Y-%m-%d";
+ }
+ else {
+ return @"%d/%m/%Y";
+ }
+}
+
+- (NSString *)jsDateFormat {
+ if ([self useISOFormats]) {
+ return @"yyyy-mm-dd";
+ }
+ else {
+ return @"dd/mm/yyyy";
+ }
}
+
+/* URLs */
+
- (NSString *)calendarPageURL {
WOResourceManager *rm;
WOContext *ctx;
if (rm == nil)
[self warnWithFormat:@"missing resource manager!"];
- /* lookup languages */
-
- ctx = [self context];
+ ctx = [self context];
#if 0
- languages = [ctx hasSession]
- ? [[ctx session] languages]
- : [[ctx request] browserLanguages];
+ languages = [ctx resourceLookupLanguages];
#else
#warning !! FIX SoProduct to enable localizable resource, then disable this!
languages = nil;
#endif
return [rm urlForResourceNamed:@"skycalendar.html"
- inFramework:nil
- languages:languages
- request:[ctx request]];
+ inFramework:nil
+ languages:languages
+ request:[ctx request]];
}
/* JavaScript */
self->dateID,
[self calendarPageURL],
self->dateID,
- [self dateFormat]];
+ [self jsDateFormat]];
}
/* action */
return;
}
- d = [NSCalendarDate dateWithString:dateString calendarFormat:@"%Y-%m-%d"];
+ d = [NSCalendarDate dateWithString:dateString
+ calendarFormat:[self dateFormat]];
if (d == nil)
[self warnWithFormat:@"Could not parse dateString: '%@'",
dateString];
# $Id$
-SUBMINOR_VERSION:=110
+SUBMINOR_VERSION:=111
# v0.9.107 requires WOExtensions v4.5.21
# v0.9.105 requires NGObjWeb v4.5.102