]> err.no Git - scalable-opengroupware.org/commitdiff
Ongoing localization
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 21 Jul 2004 13:49:24 +0000 (13:49 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 21 Jul 2004 13:49:24 +0000 (13:49 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@152 d1b88da0-ebda-0310-925b-ed51d893ca5b

13 files changed:
SOGo/UI/SOGoUI/ChangeLog
SOGo/UI/SOGoUI/UIxComponent.h
SOGo/UI/SOGoUI/UIxComponent.m
SOGo/UI/SOGoUI/Version
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/English.lproj/default.strings [new file with mode: 0644]
SOGo/UI/Scheduler/French.lproj/default.strings [new file with mode: 0644]
SOGo/UI/Scheduler/UIxCalDateLabel.m
SOGo/UI/Scheduler/UIxCalMonthOverview.m
SOGo/UI/Scheduler/UIxCalMonthOverview.wox
SOGo/UI/Scheduler/UIxCalSelectTab.m
SOGo/UI/Scheduler/UIxCalView.m
SOGo/UI/Scheduler/UIxCalWeekOverview.wox

index 46426be05032ea44b4e276440ec016e09fb93b78..da9d49fe6056bec2d2468d21d1eb3846502894bf 100644 (file)
@@ -1,3 +1,8 @@
+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
index f6cbfa6965692c0e480f58fa38e8baad6728fa2e..937a183791d5e194826dba6de8b77e7f6d3c6d3c 100644 (file)
 /* labels */
 - (NSString *)labelForKey:(NSString *)_key;
 
+- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek;
+- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek;
+- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear;
+- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear;
+    
 /* locale */
 - (NSDictionary *)locale;
 
index e0d633b979262028478812929495207448515318..2d03589277d669f140c1c75832dcd9953a620f79 100644 (file)
 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"];
 }
 
index 434e1ad20963e1bff1cb54495e63a10726ebeeef..6300d3ac63330dd0ccd003e66c9235abcc2e52ff 100644 (file)
@@ -1,5 +1,5 @@
 # $Id$
 
-SUBMINOR_VERSION:=2
+SUBMINOR_VERSION:=3
 
 # 1.1.0 requires NGObjWeb 4.2.202
index 31915fa8895da76faec9d4656d576828c27946b8..3fb9b3b0fa34bac47379d4c796ebe77b5d9537a2 100644 (file)
@@ -1,3 +1,19 @@
+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
diff --git a/SOGo/UI/Scheduler/English.lproj/default.strings b/SOGo/UI/Scheduler/English.lproj/default.strings
new file mode 100644 (file)
index 0000000..e73e41c
--- /dev/null
@@ -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 (file)
index 0000000..8fa8dea
--- /dev/null
@@ -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";
index 5e7fa4896a4fce7e42c7f894f6c3ab9f4b44ef05..3b538afcdba8c4775b53e5c25055caedb7671953 100644 (file)
 // $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
index 4f78481800c1905e456222ee7e44dd1603357557..756f85a1a4819d30f9e6e1d03341151b085eed77 100644 (file)
 
 @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 {
index 6010cb110c29b6d8a90fcf06c32e6cd8ab55c2bf..cccb20e474646d91320e50f217aa7186ac0ccad9 100644 (file)
                 <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>
@@ -95,7 +95,7 @@
                        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>
 
index 759fb23051971e44a2f5d0daa7c34e3d598034cd..fcd77366f881531f570b29432399fd80ec507daa 100644 (file)
@@ -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 {
 }
 
 - (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]];
 }
 
 
index 507464742add6c7418450a32226de3be266feaa1..69fa83ae0080c9e5674bf24ce287ea23b6b92926 100644 (file)
@@ -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 {
index 4a238f5fae974c187902d771f9d539c0668dea62..8628b480568fbf34e82efff550a77c3f49a3f5cc 100644 (file)
               <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>