Re: toggleToolbarShown: How do I localize the menu item strings for non-supported languages?
Re: toggleToolbarShown: How do I localize the menu item strings for non-supported languages?
- Subject: Re: toggleToolbarShown: How do I localize the menu item strings for non-supported languages?
- From: Peter Ammon <email@hidden>
- Date: Fri, 13 Jun 2008 15:07:40 -0700
Hi Ulf,
There's no simple way to inform AppKit of your translations of these
strings. The simplest way to insert your own titles is to do it in
validateUserInterfaceItem like this:
@implementation MyWindow
- (BOOL)validateUserInterfaceItem:(id
<NSValidatedUserInterfaceItem>)item {
BOOL result = [super validateUserInterfaceItem:item];
if ([item action] == @selector(toggleToolbarShown:) && [item
respondsToSelector:@selector(setTitle:)]) {
if ([[self toolbar] isVisible]) [item setTitle:@"Localized Hide
Toolbar"];
else [item setTitle:@"Localized Show Toolbar"];
}
}
@end
Note that the behavior of overwriting a custom menu item title was
fixed in Leopard. In Tiger, AppKit would always modify the title of a
toggleToolbarItemShown: menu item, overwriting any custom title. In
Leopard, AppKit will only swap (localized versions of) "Show Toolbar"
and "Hide Toolbar." If you give your menu item a custom title, AppKit
should not overwrite it.
Hope that answers your question,
-Peter
On Jun 12, 2008, at 12:13 AM, Ulf Dunkel wrote:
When I add the recommended menu items
" Hide Toolbar "
" Customize Toolbar... "
to my app's View menu, I can give them any text I like, but the
"Hide Toolbar" string will be replaced by the system when the app is
launched and a document window has been opened. The Action
toggleToolbarShown: in NSWindow does all this automatically.
This works fine for all Languages which are currently supported by
Mac OS X (and installed on my Mac).
But is there any simple way to provide both strings "Hide Toolbar"
and "Show Toolbar" for languages which are not supported already,
like Czech or Latvian?
Thank you - Ul
_______________________________________________
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