Programatically Change NSMenu Title
Programatically Change NSMenu Title
- Subject: Programatically Change NSMenu Title
- From: "Chunk 1978" <email@hidden>
- Date: Tue, 4 Nov 2008 15:02:37 -0500
for localization purposes, i'd like to programatically change all of
my app's menu item titles.
#import <Cocoa/Cocoa.h>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@interface AppController : NSObject
{
//Main Menu Outlets
IBOutlet id MenuItem1;
IBOutlet id MenuItem2;
}
@end
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#import "AppController.h"
static NSString * CONSTMenuItem1;
static NSString * CONSTMenuItem2;
@implementation AppController
- (void)awakeFromNib
{
CONSTMenuItem1 = NSLocalizedString (@"ENGLISH MENU", nil);
[MenuItem1 setTitle:CONSTMenuItem1];
CONSTMenuItem2 = NSLocalizedString (@"English Item...", nil);
[MenuItem2 setTitle:CONSTMenuItem2];
}
@end
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
the above code works fine for everything except the menu bar titles
(like "File", "Edit", "Window", etc.)... when i click on these objects
in IB i've noticed it's displaying
the title of the "NSMenu" instead of the title for "NSMenuItem" in IB,
but i can't seem to hook it up to NSMenu, so i'm not sure if this is
possible.
thoughts?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden