Re: [Gtk-osx-users] How to handle the standard menuitem 'quit'?



On Sep 22, 2010, at 12:45 PM, Zbigniew Diaczyszyn wrote:

> 
> 
> Am 20.09.2010 17:07, schrieb John Ralls:
> 
>>> How can I change the *labeltext* 'quit', e.g. to a 'quit my_app' or a
>>> translation?
>> 
>> a: Quit is handled directly by OSX, so you have to do it their way. The signals that gtkosxapplication provides make the OSX notification and response available to Gtk+ code. If you'd rather, you can write your own cocoa application delegate and register it -- but you'd better know what you're doing.
>> 
>> b: The "Quit" menu label is at present hard-coded. The easy way to change it is to just edit that string in ige-mac-integration/src/gtkosxapplication_quartz.c at line 208 and the corresponding translations in the message files in ige-mac-integration/strings. It would be better, I suppose, to get the application name from the bundle and insert it, as OSX does with the built-in menu. Perhaps I'll add that at some point when time permits.
> 
> What about replacing the NSString by a NSLocalizedString in the 
> following line? Then the application could look into the language 
> folder, e.g. /de.lproj, in /Resources for a translation resource like 
> 'Localized.strings'?
> 
> menuitem = [[NSMenuItem alloc] initWithTitle:@"Quit"
> 	action:@selector(terminate:) keyEquivalent:@"q"];
> 
> ->
> 
> menuitem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Quit", nil)
> 	action:@selector(terminate:) keyEquivalent:@"q"];
> 
> and so for the other menuitems ...

No need. InitWithTitle: is declared to take an NSLocalizedString, so the constant argument is coerced into one at runtime. The translations for every language that Google Translation supports are provided as part of ige-mac-integration. As the docs say, it's not compatible with gettext, so the translations have to go in the Resources/ll.proj directories (where ll is the iso code for the language) in the bundle.

My suggestion above was about changing @"Quit" to @"Quit YourApp".

Regards,
John Ralls


The part that 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]