Re: [gtk-osx-users] GTK and localization

John Ralls <jralls ceridwen us> writes:

>> I'm currently looking into localization of Subsurface [1], a dive log program created by Linus Torvalds.
>> We're using gtk2, gtk-mac-integration and gettext, but somehow some of the Mac specific menu items doesn't get localized.  I have a Norwegian setup, so I tried adding a basic /Applications/ with content like:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "";>
>> <plist version="1.0">
>> <dict>
>>  <key>Preferences</key>
>>  <string>Valg</string>
>> </dict>
>> It doesn't seem to work, though.
> No, why would it? ICU strings files aren't XML. See the examples provided with GtkosxApplication or "String Resources" [1] in the Apple Developer Documentation. But that's not the only problem: In order for the ICU localization to work, the string constant must be added to the menu with one of the NSLocalizedString [2] functions. I doubt that you did that for your Preferences menu item.
>> So:
>> 1) Is it possible to skip the *.lproj altoghether and use gettext for all localization?
> Only by rewriting the Apple menu code in gtkosxapplication_quartz.c. Patches welcome.
>> 2) Some items in the Apple menu are localized when running ./subsurface directly, while others are translated when running  Is there a way to get around this?
> The Apple menu items localized with NSLocalizedStringFromTable() don't translate when your program is launched from the command line because launch services isn't involved so the bundle links, which the Apple localization functions use to find the strings files, aren't created. I suspect that the menu items that are translated in that case are ones that you've added (like your preferences example) with gtkosx_application_insert_app_menu_item(). If those aren't getting localized when you launch with launch services (clicking in Finder or using open(1)) then you've messed something up. You'll have to debug that in more detail to figure out what.

So if I understand you correctly, if we simply don't use any of the
default menu item names (like "New" for GTK_STOCK_NEW) but instead make
them explicit when building the menu from hand, this shouldn't affect us
at all, correct?

Henrik, can you test what I pushed a few minutes ago and see if that
works on your Mac with the Norwegian translations (you obviously need to
edit your .po file, first)



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