]> err.no Git - scalable-opengroupware.org/commitdiff
changes for proper localization
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 20 Jul 2004 20:19:47 +0000 (20:19 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 20 Jul 2004 20:19:47 +0000 (20:19 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@151 d1b88da0-ebda-0310-925b-ed51d893ca5b

12 files changed:
SOGo/SOGo.xcode/project.pbxproj
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/GNUmakefile
SOGo/UI/Scheduler/UIxCalMonthOverview.m
SOGo/UI/Scheduler/UIxCalMonthOverview.wox
SOGo/UI/Scheduler/UIxCalSelectTab.m
SOGo/UI/Scheduler/UIxCalWeekOverview.wox
SOGo/UI/Scheduler/Version

index 3d62590a2a0937b4f50ea8c85c3033e1459d2434..79685e583e9bedd9ccd164279486cf3ac419c79e 100644 (file)
                        refType = 4;
                        sourceTree = "<group>";
                };
+               ADCDE53106ADA8AC00BFCE2B = {
+                       fileEncoding = 4;
+                       isa = PBXFileReference;
+                       lastKnownFileType = text.plist.strings;
+                       name = English;
+                       path = English.lproj/default.strings;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               ADCDE53206ADA8C800BFCE2B = {
+                       children = (
+                               ADCDE53106ADA8AC00BFCE2B,
+                               ADCDE53306ADA8CF00BFCE2B,
+                       );
+                       isa = PBXVariantGroup;
+                       name = default.strings;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               ADCDE53306ADA8CF00BFCE2B = {
+                       isa = PBXFileReference;
+                       lastKnownFileType = text.plist.strings;
+                       name = French;
+                       path = French.lproj/default.strings;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
 //AD0
 //AD1
 //AD2
                };
                E87207EA0692E3D20099CBBD = {
                        children = (
-                               E872088E0692E3D30099CBBD,
                                E872088F0692E3D30099CBBD,
                                E87208910692E3D30099CBBD,
                                E87208920692E3D30099CBBD,
                                E872090C0692E3D30099CBBD,
                                E87208D30692E3D30099CBBD,
+                               E872088E0692E3D30099CBBD,
                                E87208E20692E3D30099CBBD,
+                               ADCDE53206ADA8C800BFCE2B,
                                E8720A0C0692E4940099CBBD,
                                E87208960692E3D30099CBBD,
                                E8720A3B0692E4C20099CBBD,
                        sourceTree = "<group>";
                };
                E87208930692E3D30099CBBD = {
+                       explicitFileType = sourcecode.make;
                        fileEncoding = 4;
                        isa = PBXFileReference;
-                       lastKnownFileType = text;
                        path = GNUmakefile;
                        refType = 4;
                        sourceTree = "<group>";
+                       tabWidth = 4;
                };
                E87208940692E3D30099CBBD = {
+                       explicitFileType = sourcecode.make;
                        fileEncoding = 4;
                        isa = PBXFileReference;
-                       lastKnownFileType = text;
                        path = GNUmakefile.postamble;
                        refType = 4;
                        sourceTree = "<group>";
+                       tabWidth = 4;
                };
                E87208950692E3D30099CBBD = {
+                       explicitFileType = sourcecode.make;
                        fileEncoding = 4;
                        isa = PBXFileReference;
-                       lastKnownFileType = text;
                        path = GNUmakefile.preamble;
                        refType = 4;
                        sourceTree = "<group>";
+                       tabWidth = 4;
                };
                E87208960692E3D30099CBBD = {
                        children = (
index e7f21c576680f440be5a525c31a3256853872420..46426be05032ea44b4e276440ec016e09fb93b78 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-20  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxComponent.[hm]: new method -labelForKey: implemented very similar to
+         new WOLabelAssociation in SOPE. Also implemented -locale. (v0.9.2)
+
 2004-07-19  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * UIxComponent.m: new method -backendTimeZone.
index b97ec2cdc58158f6c7777d9e648f9c602afc7ff4..f6cbfa6965692c0e480f58fa38e8baad6728fa2e 100644 (file)
 - (NSString *)dateStringForDate:(NSCalendarDate *)_date;
 - (NSCalendarDate *)dateForDateString:(NSString *)_dateString;
 
+/* labels */
+- (NSString *)labelForKey:(NSString *)_key;
+
+/* locale */
+- (NSDictionary *)locale;
+
 @end
 
 #endif /* __UIxComponent_H_ */
index 5bda9cd0c66bb4f2686720052ef4746cf239821f..e0d633b979262028478812929495207448515318 100644 (file)
@@ -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 */
index f5832bdd7962c1faee10b5efa2e123599e098cca..434e1ad20963e1bff1cb54495e63a10726ebeeef 100644 (file)
@@ -1,5 +1,5 @@
 # $Id$
 
-SUBMINOR_VERSION:=1
+SUBMINOR_VERSION:=2
 
 # 1.1.0 requires NGObjWeb 4.2.202
index 288dc8ccc3d41f08a4e4b8fb88425e3e9123239a..31915fa8895da76faec9d4656d576828c27946b8 100644 (file)
@@ -1,3 +1,16 @@
+2004-07-20  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * 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  <znek@mulle-kybernetik.com>
 
        * UIxAppointmentEditor.m: Use -backendTimeZone from UIxComponent.
index 09d45692108e9ec2a6e0ea99ff94f2e00b1792bd..3df9e56b112fa263102697461588d6814b83d29b 100644 (file)
@@ -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../../..
 
index 17526f66b10e8bfb28c4641b5f28a20219462ccd..4f78481800c1905e456222ee7e44dd1603357557 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];
     [super dealloc];
 }
 
 - (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 {
index dd690808445be6eb134d777224504b8dcead6364..6010cb110c29b6d8a90fcf06c32e6cd8ab55c2bf 100644 (file)
@@ -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"
 >
 
   <table id="skywintable" class="wintable" cellspacing="0" cellpadding="5" width="100%">
@@ -32,7 +33,7 @@
                                prevQueryParameters="prevMonthQueryParameters"
                                currentQueryParameters="todayQueryParameters"
                                nextQueryParameters="nextMonthQueryParameters"
-                               const:label="this month"
+                               label:label="this month"
                 />
             </td>
         </tr>
   </tr>
   <tr bgcolor="#F5F5E9">
   <td align="left" width="10"><var:entity const:name="nbsp"/></td>
-  <td align="right"><img border="0" alt="" src="/sogod.woa/so/ControlPanel/Products/CommonUI/Resources/corner_right.gif"/></td>
+  <td align="right"><img border="0" alt="" src="/sogod.woa/so/ControlPanel/Products/CommonUI/Resources/corner_right.gif" /></td>
   </tr>
   <tr>
   <td colspan="2" bgcolor="#F5F5E9">
index cc693f8ff69ad9183c463eda373168a0dec8d725..759fb23051971e44a2f5d0daa7c34e3d598034cd 100644 (file)
 }
 
 - (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 {
index eea16c9e1b757f37c2de9c60ed02368c0face0e5..4a238f5fae974c187902d771f9d539c0668dea62 100644 (file)
@@ -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"
     />
     </td>
     </tr>
index d64ce5ad6612a2d6d7102ee381ead2f0f3fb343a..434e1ad20963e1bff1cb54495e63a10726ebeeef 100644 (file)
@@ -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