diff --git a/ChangeLog b/ChangeLog index 4fb6ba151..74c5ea409 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-30 Francis Lachapelle + + * UI/MailerUI/UIxMailEditor.m (-localeCode): new method that + returns the language two-letter code. Used to set the language in + the CKEditor instance in JavaScript. + + * UI/PreferencesUI/UIxPreferences.m (-localeCode): idem. + 2010-06-30 Ludovic Marcotte * When displaying cards, we now make sure that diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index 5bb60bfaa..87420f393 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -1,6 +1,6 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG - Copyright (C) 2008-2009 Inverse inc. + Copyright (C) 2008-2010 Inverse inc. This file is part of SOGo. @@ -32,6 +32,7 @@ form data */ #import #undef COMPILING_NGOBJWEB +#import #import #import #import @@ -44,6 +45,7 @@ #import #import +#import #import #import #import @@ -53,6 +55,8 @@ #import #import +#import "../../Main/SOGo.h" + /* UIxMailEditor @@ -171,6 +175,19 @@ static NSArray *infoKeys = nil; return ([to count] > 0 ? @"true" : @"false"); } +- (NSString *) localeCode +{ + SOGoUserDefaults *ud; + NSDictionary *locale; + + ud = [[context activeUser] userDefaults]; + locale = [[WOApplication application] + localeForLanguageNamed: [ud language]]; + + // WARNING : NSLocaleCode is not defined in + return [locale objectForKey: @"NSLocaleCode"]; +} + - (void) setFrom: (NSString *) newFrom { ASSIGN (from, newFrom); diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 3caba899a..e63ac7514 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1,6 +1,6 @@ /* UIxPreferences.m - this file is part of SOGo * - * Copyright (C) 2007-2009 Inverse inc. + * Copyright (C) 2007-2010 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -993,6 +993,12 @@ userCanChangePassword]; } +- (NSString *) localeCode +{ + // WARNING : NSLocaleCode is not defined in + return [locale objectForKey: @"NSLocaleCode"]; +} + - (NSArray *) languageCategories { NSArray *categoryLabels; diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index f7ad250af..a74617252 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -15,6 +15,7 @@ var mailIsReply = ; var sourceUID = ; var sourceFolder = ''; + var localeCode = '';
diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 6f88366ed..bbcd0ee03 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -12,6 +12,9 @@ const:popup="YES" const:jsFiles="PasswordPolicy.js,ckeditor/ckeditor.js" > +
    diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 69f47fd8f..b2a160638 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -369,7 +369,9 @@ function initMailEditor() { 'JustifyLeft','JustifyCenter','JustifyRight', 'JustifyBlock','Font','FontSize','-','TextColor', 'BGColor'] - ] + ], + language : localeCode, + scayt_sLang : localeCode } ); if (focusField == textarea) diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index e8b713140..77fed756f 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -557,14 +557,15 @@ function onComposeMessagesTypeChange(event) { if (!CKEDITOR.instances["signature"]) { CKEDITOR.replace('signature', { - height: "290px", - toolbar : - [['Bold', 'Italic', '-', 'Link', - 'Font','FontSize','-','TextColor', - 'BGColor'] - ] - } - ); + height: "290px", + toolbar : [['Bold', 'Italic', '-', 'Link', + 'Font','FontSize','-','TextColor', + 'BGColor'] + ], + language : localeCode, + scayt_sLang : localeCode + } + ); } } }