[PyQt] Mac QMenuBar localization issues

Hans-Peter Jansen hpj at urpla.net
Tue Jun 30 00:43:52 BST 2009

Am Montag, 29. Juni 2009 schrieb Hans-Peter Jansen:
> Am Sonntag, 28. Juni 2009 schrieb Hans-Peter Jansen:
> > 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.
> Okay, that one was easy, it translates simply to:
> 	QtGui.QApplication.translate("QMenuBar", "...")
> The reason, why this didn't worked before was pure sillyness on my side.
> :-(
> > 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.
> Funny enough, I got it working _partly_ now: "About App" and "About Qt"
> are fine, but neither the "Preferences..." nor the "Quit App" appear
> translated. The "Preferences..." menu item is especially strange, since
> it got moved, and it is operational (calls my settings widget).

Okay, found the crucial note here:
Oh well. Please don't tell anybody about the mess under the Mac's hood...

If only I could get PyInstaller to behave in creating an proper bundle 
now :-(.


More information about the PyQt mailing list