[PyQt] Mac QMenuBar localization issues
Hans-Peter Jansen
hpj at urpla.net
Sun Jun 28 17:51:07 BST 2009
Dear Mac-attending audience,
after learning, how to get my application name into the Mac menu bar, I'm
stuck again: did anybody of you succeed in localization of the special Mac
menu actions, that (should) get magically moved into the Mac Application
menu? (E.g. About App, About Qt, Preferences, Quit)
In the fine docs, I found the note, that those menu items have to be
translated in QMenuBar context. Hmm, since we usually add QActions to menu
bars, I didn't grasp, how this translates to proper PyQt code.
In my QAction invocation, I did something like:
QtGui.QMenuBar.tr(self.cfg.mac and QtGui.QMenuBar() or
self.menuBar(), "About %1").arg(self.cfg.app)
but that simply fails to translate that menu item.
BTW: the condition above is due to the other note about using a parentless
QMenuBar on the Mac, while this leads to crashes on my (KDE3-based) Linux
systems...
Experiments with
QtGui.QApplication.translate("QMenuBar", ..)
didn't succeed as well.
Consequently, the magic movement of menu entries failed, too, but I was able
to workaround _this_ issue with setting explicite menu roles for those
items. Now I would like to have them translated as well.
If some kind soul, who solved this issue already, can give some hints, I
would be truly grateful.
Pete
More information about the PyQt
mailing list