Fixed translate() function in MediaPlugin

This commit is contained in:
Frode Woldsund 2010-06-06 15:30:57 +02:00
parent febb743acd
commit 4571e808ba
2 changed files with 18 additions and 12 deletions

View File

@ -58,13 +58,14 @@ class MediaMediaItem(MediaManagerItem):
self.ServiceItemIconName = u':/media/media_video.png'
def initPluginNameVisible(self):
self.PluginNameVisible = translate('MediaItem','Media')
self.PluginNameVisible = translate(u'MediaPlugin.MediaItem', u'Media')
def retranslateUi(self):
self.OnNewPrompt = translate('MediaItem','Select Media')
self.OnNewFileMasks = translate('MediaItem','Videos (%s);;'
'Audio (%s);;'
'All files (*)' % (self.parent.video_list, self.parent.audio_list))
self.OnNewPrompt = translate(u'MediaPlugin.MediaItem', u'Select Media')
self.OnNewFileMasks = translate(u'MediaPlugin.MediaItem',
u'Videos (%s);;'
u'Audio (%s);;'
u'All files (*)' % (self.parent.video_list, self.parent.audio_list))
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -78,7 +79,7 @@ class MediaMediaItem(MediaManagerItem):
self.ListView.addAction(
contextMenuAction(
self.ListView, u':/slides/slide_blank.png',
translate('MediaItem','Replace Live Background'),
translate(u'MediaPlugin.MediaItem', u'Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self):
@ -93,7 +94,8 @@ class MediaMediaItem(MediaManagerItem):
self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.Toolbar.addToolbarButton(
u'Replace Background', u':/slides/slide_blank.png',
translate('MediaItem','Replace Live Background'), self.onReplaceClick, False)
translate(u'MediaPlugin.MediaItem', u'Replace Live Background'),
self.onReplaceClick, False)
# Add the song widget to the page layout
self.PageLayout.addWidget(self.ImageWidget)
@ -105,8 +107,10 @@ class MediaMediaItem(MediaManagerItem):
self.background = True
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
translate('MediaItem','No item selected'),
translate('MediaItem','You must select one item'))
translate(u'MediaPlugin.MediaItem',
u'No item selected'),
translate(u'MediaPlugin.MediaItem',
u'You must select one item'))
items = self.ListView.selectedIndexes()
for item in items:
bitem = self.ListView.item(item.row())
@ -119,7 +123,8 @@ class MediaMediaItem(MediaManagerItem):
if item is None:
return False
filename = unicode((item.data(QtCore.Qt.UserRole)).toString())
service_item.title = unicode(translate('MediaItem','Media'))
service_item.title = unicode(
translate(u'MediaPlugin.MediaItem', u'Media'))
service_item.add_capability(ItemCapabilities.RequiresMedia)
frame = u':/media/image_clapperboard.png'
(path, name) = os.path.split(filename)

View File

@ -76,6 +76,7 @@ class MediaPlugin(Plugin):
return MediaMediaItem(self, self.icon, self.name)
def about(self):
about_text = translate('MediaPlugin','<b>Media Plugin</b><br>This plugin '
'allows the playing of audio and video media')
about_text = translate(u'MediaPlugin.MediaPlugin',
u'<b>Media Plugin</b><br>This plugin '
u'allows the playing of audio and video media')
return about_text