From 67f33463b14108d7663a1a28a4d4f561168e7d1b Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 18 Oct 2007 14:44:58 +0000 Subject: [PATCH] Monotone-Parent: f8b29d68c36441f92d7ffe8056a95fd25a2fd409 Monotone-Revision: 60b451d63d7516a7e662359127f629d2c70e3f25 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-18T14:44:58 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 +++++ UI/Common/UIxPageFrame.h | 5 +-- UI/Common/UIxPageFrame.m | 48 ++++++++++++++++++++++------- UI/Templates/UIxPageFrame.wox | 8 ++--- UI/WebServerResources/ContactsUI.js | 4 +-- UI/WebServerResources/generic.js | 21 +++---------- 6 files changed, 57 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7c3982eb..bf2628c5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-10-18 Wolfgang Sourdeau + + * UI/Common/UIxPageFrame.m ([UIxPageFrame + -productLocalizableStrings]): new method that returns the + product-specific translation dictionary as a JSON hash. + ([UIxPageFrame -commonLocalizableStrings]): same as above but for + the "Common" framework. + 2007-10-17 Wolfgang Sourdeau * UI/MailerUI/UIxMailActions.m ([UIxMailActions -copyAction]): diff --git a/UI/Common/UIxPageFrame.h b/UI/Common/UIxPageFrame.h index 1faf08cbb..04c9b4de1 100644 --- a/UI/Common/UIxPageFrame.h +++ b/UI/Common/UIxPageFrame.h @@ -39,6 +39,9 @@ BOOL isPopup; } +- (NSString *) commonLocalizableStrings; +- (NSString *) productLocalizableStrings; + - (NSString *) pageJavaScriptURL; - (NSString *) productJavaScriptURL; - (BOOL) hasPageSpecificJavaScript; @@ -49,8 +52,6 @@ - (BOOL) hasPageSpecificCSS; - (BOOL) hasProductSpecificCSS; -- (NSString *) productFrameworkName; - - (void) setPopup: (BOOL) popup; - (BOOL) isPopup; diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index 9ae46a5d9..97754c853 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -23,8 +23,10 @@ #import #import +#import +#import + #import -#import #import
@@ -166,6 +168,40 @@ /* page based JavaScript */ +- (NSString *) _stringsForFramework: (NSString *) framework +{ + NSDictionary *table; + NSString *language, *frameworkName; + + frameworkName = [NSString stringWithFormat: @"%@.SOGo", + (framework ? framework : [self frameworkName])]; + language = [[context activeUser] language]; + table + = [[self resourceManager] stringTableWithName: @"Localizable" + inFramework: frameworkName + languages: [NSArray arrayWithObject: language]]; + /* table is not really an NSDict44ionary but a hackish variation thereof */ + table = [NSDictionary dictionaryWithDictionary: table]; + + return [table jsonRepresentation]; +} + +- (NSString *) commonLocalizableStrings +{ + return [NSString stringWithFormat: @"var clabels = %@;", + [self _stringsForFramework: nil]]; +} + +- (NSString *) productLocalizableStrings +{ + NSString *frameworkName; + + frameworkName = [[context page] frameworkName]; + + return [NSString stringWithFormat: @"var labels = %@;", + [self _stringsForFramework: frameworkName]]; +} + - (NSString *) pageJavaScriptURL { WOComponent *page; @@ -190,15 +226,6 @@ return [self urlForResourceFilename: fwJSFilename]; } -- (NSString *) productFrameworkName -{ - WOComponent *page; - - page = [context page]; - - return [NSString stringWithFormat: @"%@.SOGo", [page frameworkName]]; -} - - (BOOL) hasPageSpecificJavaScript { return ([[self pageJavaScriptURL] length] > 0); @@ -300,5 +327,4 @@ return [cc isMacBrowser]; } - @end /* UIxPageFrame */ diff --git a/UI/Templates/UIxPageFrame.wox b/UI/Templates/UIxPageFrame.wox index 3074d44ed..8d73985d5 100644 --- a/UI/Templates/UIxPageFrame.wox +++ b/UI/Templates/UIxPageFrame.wox @@ -42,6 +42,8 @@ const:negate="YES" >var UserFolderURL = ''; var UserLogin = ''; + + @@ -55,15 +57,11 @@ + - -