• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: toggleToolbarShown: How do I localize the menu item strings for non-supported languages?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >toggleToolbarShown: How do I localize the menu item strings for non-supported languages? (From: Ulf Dunkel <email@hidden>)

  • Prev by Date: Re: PerlObjCBridge and SFAuthorization
  • Next by Date: Re: NSToolbarItems - can I define the sorting in the customization palette
  • Previous by thread: toggleToolbarShown: How do I localize the menu item strings for non-supported languages?
  • Next by thread: FSEvent- FSEventStreamEventFlags
  • Index(es):
    • Date
    • Thread