Revision: 28887
http://sourceforge.net/p/bibdesk/svn/28887
Author: hofman
Date: 2024-05-05 16:07:27 +0000 (Sun, 05 May 2024)
Log Message:
-----------
template names are localized, so replace initial values for default preview
templates by the localized name
Modified Paths:
--------------
trunk/bibdesk/BDSKPreferenceRecord.m
Modified: trunk/bibdesk/BDSKPreferenceRecord.m
===================================================================
--- trunk/bibdesk/BDSKPreferenceRecord.m 2024-05-05 15:41:42 UTC (rev
28886)
+++ trunk/bibdesk/BDSKPreferenceRecord.m 2024-05-05 16:07:27 UTC (rev
28887)
@@ -37,6 +37,7 @@
*/
#import "BDSKPreferenceRecord.h"
+#import "BDSKStringConstants.h"
#define IDENTIFIER_KEY @"identifier"
#define CLASS_KEY @"class"
@@ -55,6 +56,20 @@
@synthesize icon, helpURL, dictionary;
@dynamic identifier, paneClass, nibName, title, label, toolTip, helpAnchor,
initialValues, searchTerms;
+static NSDictionary *localizedDictionary(NSDictionary *aDictionary) {
+ if ([[aDictionary objectForKey:IDENTIFIER_KEY]
isEqualToString:@"edu.ucsd.cs.mmccrack.bibdesk.prefpane.display"])
+ return aDictionary;
+ NSString *templateName = NSLocalizedString(@"Default RTF template", @"");
+ if ([[[aDictionary objectForKey:INITIAL_VALUES_KEY]
objectForKey:BDSKBottomPreviewDisplayTemplateKey] isEqualToString:templateName])
+ return aDictionary;
+ NSMutableDictionary *dict = [aDictionary mutableCopy];
+ NSMutableDictionary *initialValues = [[aDictionary
objectForKey:INITIAL_VALUES_KEY] mutableCopy];
+ [initialValues setObject:templateName
forKey:BDSKBottomPreviewDisplayTemplateKey];
+ [initialValues setObject:templateName
forKey:BDSKSidePreviewDisplayTemplateKey];
+ [dict setObject:initialValues forKey:INITIAL_VALUES_KEY];
+ return dict;
+}
+
- (instancetype)initWithDictionary:(NSDictionary *)aDictionary {
self = [super init];
if (self) {
@@ -61,7 +76,7 @@
BDSKPRECONDITION(aDictionary != nil);
icon = [aDictionary valueForKey:ICON_KEY] ? [NSImage
imageNamed:[aDictionary valueForKey:ICON_KEY]] : nil;
helpURL = [aDictionary valueForKey:HELP_URL_KEY] ? [[NSURL alloc]
initWithString:[aDictionary valueForKey:HELP_URL_KEY]] : nil;
- dictionary = [aDictionary copy];
+ dictionary = localizedDictionary(aDictionary);
BDSKPOSTCONDITION([self identifier] != nil);
BDSKPOSTCONDITION([self paneClass] != Nil);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit