Re: [gtk-osx-users] Using localization with "Application" menu with the gtk mac integration library.




On Oct 2, 2014, at 9:25 AM, Joshua Pettus <jshpettus gmail com> wrote:

Thanks,

That worked, however now with the strings that come with the library cause Xboard to crash with a segfault. 
 I believe this has to do with the new library code putting the application name after quit and hide.

For testing I set my system to German and I changed those strings to 
/* Hide menu item title */
"Hide %@" = "%@ ausblenden";
/* Quit menu item title */
"Quit %@" = "%@ beenden”;

As was done in GIMP, but these strings weren’t translated

Also we used the gtkmacintegration library to move “About Xboard” over to the application menu over from 
the help menu.  This wasn’t translated by gettext and I believe is now handled by the gtkosxintegration 
library as well.  Am I correct?  But I don’t see a string for it.


Please copy the list on all replies; use “reply all” (the double-arrow).

Please either open a bug with the stack trace of the crash or post it here; if you use the crash log you 
please cut it off after the stack trace, as the hundred lines of dylib information just adds clutter. If you 
can, please use a debug build of gtk-mac-integration and of your application so that the line numbers are 
present in the stack trace.

Menu items moved from other menus need to be translated in the application using whatever localization scheme 
you use for the rest of the program; that’s normally gettext for Gtk applications.

You can’t just change the keys in the strings. You also have to change the keys in the table lookup. For 
example, the “Hide” lookup is at line 246 in gtkosxapplication_quartz.c:

  menuitem = [[NSMenuItem alloc] initWithTitle: [[NSLocalizedStringFromTable (@"Hide",  @"GtkosxApplication", 
@"Hide menu item title") autorelease] stringByAppendingFormat: @" %@", appname]
              action: @selector (hide: ) keyEquivalent: @"h”];

That’s not really the right way to do that, since it forces the app name to the end of the string. It also 
won’t find the key “Hide % “ in your revised strings file. It needs to be something like (because I haven’t 
tested it)

  menuitem = [[NSMenuItem alloc] initWithTitle: [stringWithFormat: [NSLocalizedStringFromTable (@“Hide %@",  
@"GtkosxApplication", @"Hide menu item title") autorelease], appname]
              action: @selector (hide: ) keyEquivalent: @"h”];


Regards,
John Ralls



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