Fixed translate() function in PresentationPlugin

This commit is contained in:
Frode Woldsund 2010-06-06 15:42:24 +02:00
parent 4571e808ba
commit 3c096b4d0a
3 changed files with 26 additions and 14 deletions

View File

@ -61,11 +61,14 @@ class PresentationMediaItem(MediaManagerItem):
self.message_listener = MessageListener(self) self.message_listener = MessageListener(self)
def initPluginNameVisible(self): def initPluginNameVisible(self):
self.PluginNameVisible = translate('MediaItem','Presentation') self.PluginNameVisible = translate(u'PresentationPlugin.MediaItem',
u'Presentation')
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = translate('MediaItem','Select Presentation(s)') self.OnNewPrompt = translate(u'PresentationPlugin.MediaItem',
self.Automatic = translate('MediaItem','Automatic') u'Select Presentation(s)')
self.Automatic = translate(u'PresentationPlugin.MediaItem',
u'Automatic')
fileType = u'' fileType = u''
for controller in self.controllers: for controller in self.controllers:
if self.controllers[controller].enabled: if self.controllers[controller].enabled:
@ -75,7 +78,8 @@ class PresentationMediaItem(MediaManagerItem):
if fileType.find(type) == -1: if fileType.find(type) == -1:
fileType += u'*%s ' % type fileType += u'*%s ' % type
self.parent.service_manager.supportedSuffixes(type) self.parent.service_manager.supportedSuffixes(type)
self.OnNewFileMasks = translate('MediaItem','Presentations (%s)' % fileType) self.OnNewFileMasks = translate(u'PresentationPlugin.MediaItem',
u'Presentations (%s)' % fileType)
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)
@ -101,7 +105,8 @@ class PresentationMediaItem(MediaManagerItem):
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget) self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel') self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1) self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
self.DisplayTypeLabel.setText(translate('MediaItem','Present using:')) self.DisplayTypeLabel.setText(
translate(u'PresentationPlugin.MediaItem', u'Present using:'))
# Add the Presentation widget to the page layout # Add the Presentation widget to the page layout
self.PageLayout.addWidget(self.PresentationWidget) self.PageLayout.addWidget(self.PresentationWidget)
@ -134,8 +139,10 @@ class PresentationMediaItem(MediaManagerItem):
(path, filename) = os.path.split(unicode(file)) (path, filename) = os.path.split(unicode(file))
if titles.count(filename) > 0: if titles.count(filename) > 0:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('MediaItem','File exists'), translate('MediaItem', self, translate(u'PresentationPlugin.MediaItem',
'A presentation with that filename already exists.'), u'File exists'),
translate(u'PresentationPlugin.MediaItem',
u'A presentation with that filename already exists.'),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
else: else:
icon = None icon = None

View File

@ -37,7 +37,8 @@ class PresentationTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'PresentationTab') self.setObjectName(u'PresentationTab')
self.tabTitleVisible = translate('PresentationTab','Presentations') self.tabTitleVisible = translate(u'PresentationPlugin.PresentationTab',
u'Presentations')
self.PresentationLayout = QtGui.QHBoxLayout(self) self.PresentationLayout = QtGui.QHBoxLayout(self)
self.PresentationLayout.setSpacing(8) self.PresentationLayout.setSpacing(8)
self.PresentationLayout.setMargin(8) self.PresentationLayout.setMargin(8)
@ -88,12 +89,15 @@ class PresentationTab(SettingsTab):
self.PresentationLayout.addWidget(self.PresentationRightWidget) self.PresentationLayout.addWidget(self.PresentationRightWidget)
def retranslateUi(self): def retranslateUi(self):
self.VerseDisplayGroupBox.setTitle(translate('PresentationTab','Available Controllers')) self.VerseDisplayGroupBox.setTitle(
translate(u'PresentationPlugin.PresentationTab',
u'Available Controllers'))
for key in self.controllers: for key in self.controllers:
controller = self.controllers[key] controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name] checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setText( checkbox.setText(
u'%s %s' % (controller.name, translate('PresentationTab','available'))) u'%s %s' % (controller.name,
translate(u'PresentationPlugin.PresentationTab', u'available')))
def load(self): def load(self):
for key in self.controllers: for key in self.controllers:

View File

@ -108,9 +108,10 @@ class PresentationPlugin(Plugin):
return False return False
def about(self): def about(self):
about_text = translate('PresentationPlugin','<b>Presentation Plugin</b> <br> Delivers ' about_text = translate(u'PresentationPlugin.PresentationPlugin',
'the ability to show presentations using a number of different ' u'<b>Presentation Plugin</b> <br> Delivers '
'programs. The choice of available presentation programs is ' u'the ability to show presentations using a number of different '
'available to the user in a drop down box.') u'programs. The choice of available presentation programs is '
u'available to the user in a drop down box.')
return about_text return about_text