← Back to team overview

openlp-core team mailing list archive

[Bug 995427] Re: Different menus on Mac when locale changed

 

Did some research on this issue and think i have the solution.

( will be working on setting up a branch which includes this so i can
learn how to submit things )

The problem appears to be that QT uses the visible text of the item, to
guess what it's actually supposed to be, in the preferences action, it's
only named "preferences" when you are using english, and it's looking
for preference or options, neither of which is actually being used. (
Configure OpenLP is the original term ).

My first solution was

if sys.platform == u'darwin':
    self.settingsConfigureItem.setText( translate('OpenLP.MainWindow', '&Preferences...'))
else:
    self.settingsConfigureItem.setText( translate('OpenLP.MainWindow', '&Configure OpenLP...'))

This seemed to fix it.  Further research led me to understand that QT
uses the label of the menu item to know how to handle it. If it's
Options or Preferences, then it knows it's a preferences item. Basically
it gets the translated item and gets confused.

There is another method referred to here named setmenurole
http://doc.qt.nokia.com/4.6/qaction.html

This allows you to control what QT thinks this menu item is.

Further usage of this implies this needs to be used for the about,
preferences and quit items. ( QtGui.QAction.PreferencesRole is a class
constant, its same as QAction::PreferencesRole in the reference )

self.fileExitItem.setMenuRole( QtGui.QAction.QuitRole )
self.settingsConfigureItem.setMenuRole( QtGui.QAction.PreferencesRole )
self.aboutItem.setMenuRole( QtGui.QAction.AboutRole )

Adding these seems to result in a better behaving compiled app which
seems to resolve his issue ( using the create dmg routine to test with
the languages downloaded. )

Language #5 ( russian perhaps, uses special cyrillic characters in name
) does not translate the Quit, Preferences, about into that language.
Others i tested seem to all work.

Some Languages are blanks still.

( please give me a few days to figure out proper bzr submission methods
for this )

** Patch added: "bug-995427.patch"
   https://bugs.launchpad.net/openlp/+bug/995427/+attachment/3246427/+files/bug-995427.patch

-- 
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/995427

Title:
  Different menus on Mac when locale changed

Status in OpenLP - Worship Presentation Software:
  Confirmed

Bug description:
  Mac OS X 10.7, OpenLP 1.9.9-r1961

  Menu items
  OpenLP -> About OpenLP
  OpenLP -> Preferences

  are not found in the 'OpenLP' menu when locale is changed to Czech.

  The menu items should be kept in the same menu no matter what locale
  is set.

  How to reproduce:
  - set locale to English
  - look at 'OpenLP' menu
  - switch locale to Czech
  - look at 'OpenLP' menu

To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/995427/+subscriptions


References