Fixed some wrong translate context and some indentation errors

This commit is contained in:
Frode Woldsund 2010-06-07 23:36:22 +02:00
commit 2df6bf5ef5
15 changed files with 163 additions and 116 deletions

View File

@ -120,7 +120,7 @@ class OpenLPToolbar(QtGui.QToolBar):
try: try:
if self.icons[title]: if self.icons[title]:
return self.icons[title] return self.icons[title]
except NameError: except KeyError:
log.exception(u'getIconFromTitle - no icon for %s' % title) log.exception(u'getIconFromTitle - no icon for %s' % title)
return QtGui.QIcon() return QtGui.QIcon()

View File

@ -64,9 +64,9 @@ class alertsPlugin(Plugin):
self.toolsAlertItem.setIcon(AlertIcon) self.toolsAlertItem.setIcon(AlertIcon)
self.toolsAlertItem.setObjectName(u'toolsAlertItem') self.toolsAlertItem.setObjectName(u'toolsAlertItem')
self.toolsAlertItem.setText( self.toolsAlertItem.setText(
translate('AlertsPlugin.AlertsPlugin', u'&Alert')) translate(u'AlertsPlugin.AlertsPlugin', u'&Alert'))
self.toolsAlertItem.setStatusTip( self.toolsAlertItem.setStatusTip(
translate('AlertsPlugin.AlertsPlugin', u'Show an alert message')) translate(u'AlertsPlugin.AlertsPlugin', u'Show an alert message'))
self.toolsAlertItem.setShortcut(u'F7') self.toolsAlertItem.setShortcut(u'F7')
self.service_manager.parent.ToolsMenu.addAction(self.toolsAlertItem) self.service_manager.parent.ToolsMenu.addAction(self.toolsAlertItem)
QtCore.QObject.connect(self.toolsAlertItem, QtCore.QObject.connect(self.toolsAlertItem,
@ -94,7 +94,7 @@ class alertsPlugin(Plugin):
self.alertForm.exec_() self.alertForm.exec_()
def about(self): def about(self):
about_text = translate('AlertsPlugin.AlertsPlugin', about_text = translate(u'AlertsPlugin.AlertsPlugin',
u'<b>Alerts Plugin</b><br>This plugin ' u'<b>Alerts Plugin</b><br>This plugin '
'controls the displaying of alerts on the presentations screen') u'controls the displaying of alerts on the presentations screen')
return about_text return about_text

View File

@ -123,26 +123,32 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS: if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if self.field(u'osis_location').toString() == u'': if self.field(u'osis_location').toString() == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Invalid Bible Location'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'You need to specify a file to import your ' u'Invalid Bible Location'),
'Bible from.'), translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a file to import your '
u'Bible from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OSISLocationEdit.setFocus() self.OSISLocationEdit.setFocus()
return False return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV: elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if self.field(u'csv_booksfile').toString() == u'': if self.field(u'csv_booksfile').toString() == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Invalid Books File'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'You need to specify a file with books of ' u'Invalid Books File'),
'the Bible to use in the import.'), translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a file with books of '
u'the Bible to use in the import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.BooksLocationEdit.setFocus() self.BooksLocationEdit.setFocus()
return False return False
elif self.field(u'csv_versefile').toString() == u'': elif self.field(u'csv_versefile').toString() == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Invalid Verse File'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'You need to specify a file of Bible ' u'Invalid Verse File'),
'verses to import.'), translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a file of Bible '
u'verses to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CsvVerseLocationEdit.setFocus() self.CsvVerseLocationEdit.setFocus()
return False return False
@ -150,9 +156,11 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
BibleFormat.OpenSong: BibleFormat.OpenSong:
if self.field(u'opensong_file').toString() == u'': if self.field(u'opensong_file').toString() == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Invalid OpenSong Bible'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'You need to specify an OpenSong Bible ' u'Invalid OpenSong Bible'),
'file to import.'), translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify an OpenSong Bible '
u'file to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongFileEdit.setFocus() self.OpenSongFileEdit.setFocus()
return False return False
@ -164,26 +172,32 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.field(u'license_copyright')) self.field(u'license_copyright'))
if license_version == u'': if license_version == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Empty Version Name'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'You need to specify a version name for your ' u'Empty Version Name'),
'Bible.'), translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a version name for your '
u'Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
elif license_copyright == u'': elif license_copyright == u'':
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Empty Copyright'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'You need to set a copyright for your Bible! ' u'Empty Copyright'),
'Bibles in the Public Domain need to be marked as ' translate(u'BiblesPlugin.ImportWizardForm',
'such.'), u'You need to set a copyright for your Bible! '
u'Bibles in the Public Domain need to be marked as '
u'such.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CopyrightEdit.setFocus() self.CopyrightEdit.setFocus()
return False return False
elif self.manager.exists(license_version): elif self.manager.exists(license_version):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm', u'Bible Exists'), translate(u'BiblesPlugin.ImportWizardForm',
translate(u'BiblesPlugin.ImportWizardForm', u'This Bible already exists! Please import ' u'Bible Exists'),
'a different Bible or first delete the existing one.'), translate(u'BiblesPlugin.ImportWizardForm',
u'This Bible already exists! Please import '
u'a different Bible or first delete the existing one.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False

View File

@ -71,7 +71,7 @@ class BibleMediaItem(MediaManagerItem):
return unicode(obj) return unicode(obj)
def initPluginNameVisible(self): def initPluginNameVisible(self):
self.PluginNameVisible = translate(u'BiblesPlugin,MediaItem', u'Bible') self.PluginNameVisible = translate(u'BiblesPlugin.MediaItem', u'Bible')
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)
@ -147,7 +147,8 @@ class BibleMediaItem(MediaManagerItem):
self.QuickMessage = QtGui.QLabel(self.QuickTab) self.QuickMessage = QtGui.QLabel(self.QuickTab)
self.QuickMessage.setObjectName(u'QuickMessage') self.QuickMessage.setObjectName(u'QuickMessage')
self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3) self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3)
self.SearchTabWidget.addTab(self.QuickTab, translate(u'BiblesPlugin,MediaItem', u'Quick')) self.SearchTabWidget.addTab(self.QuickTab,
translate(u'BiblesPlugin.MediaItem', u'Quick'))
QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum, QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1) self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1)
@ -231,7 +232,8 @@ class BibleMediaItem(MediaManagerItem):
self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab) self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab)
self.AdvancedMessage.setObjectName(u'AdvancedMessage') self.AdvancedMessage.setObjectName(u'AdvancedMessage')
self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3) self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3)
self.SearchTabWidget.addTab(self.AdvancedTab, translate(u'BiblesPlugin,MediaItem', u'Advanced')) self.SearchTabWidget.addTab(self.AdvancedTab,
translate(u'BiblesPlugin.MediaItem', u'Advanced'))
# Add the search tab widget to the page layout # Add the search tab widget to the page layout
self.PageLayout.addWidget(self.SearchTabWidget) self.PageLayout.addWidget(self.SearchTabWidget)
# Combo Boxes # Combo Boxes
@ -289,27 +291,48 @@ class BibleMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
log.debug(u'retranslateUi') log.debug(u'retranslateUi')
self.QuickVersionLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Version:')) self.QuickVersionLabel.setText(
self.QuickSecondVersionLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Dual:')) translate(u'BiblesPlugin.MediaItem', u'Version:'))
self.QuickSearchLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Search Type:')) self.QuickSecondVersionLabel.setText(
self.QuickSearchLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Find:')) translate(u'BiblesPlugin.MediaItem', u'Dual:'))
self.QuickSearchButton.setText(translate(u'BiblesPlugin,MediaItem', u'Search')) self.QuickSearchLabel.setText(
self.QuickClearLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Results:')) translate(u'BiblesPlugin.MediaItem', u'Search Type:'))
self.AdvancedVersionLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Version:')) self.QuickSearchLabel.setText(
self.AdvancedSecondBibleLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Dual:')) translate(u'BiblesPlugin.MediaItem', u'Find:'))
self.AdvancedBookLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Book:')) self.QuickSearchButton.setText(
self.AdvancedChapterLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Chapter:')) translate(u'BiblesPlugin.MediaItem', u'Search'))
self.AdvancedVerseLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Verse:')) self.QuickClearLabel.setText(
self.AdvancedFromLabel.setText(translate(u'BiblesPlugin,MediaItem', u'From:')) translate(u'BiblesPlugin.MediaItem', u'Results:'))
self.AdvancedToLabel.setText(translate(u'BiblesPlugin,MediaItem', u'To:')) self.AdvancedVersionLabel.setText(
self.AdvancedClearLabel.setText(translate(u'BiblesPlugin,MediaItem', u'Results:')) translate(u'BiblesPlugin.MediaItem', u'Version:'))
self.AdvancedSearchButton.setText(translate(u'BiblesPlugin,MediaItem', u'Search')) self.AdvancedSecondBibleLabel.setText(
self.QuickSearchComboBox.addItem(translate(u'BiblesPlugin,MediaItem', u'Verse Search')) translate(u'BiblesPlugin.MediaItem', u'Dual:'))
self.QuickSearchComboBox.addItem(translate(u'BiblesPlugin,MediaItem', u'Text Search')) self.AdvancedBookLabel.setText(
self.ClearQuickSearchComboBox.addItem(translate(u'BiblesPlugin,MediaItem', u'Clear')) translate(u'BiblesPlugin.MediaItem', u'Book:'))
self.ClearQuickSearchComboBox.addItem(translate(u'BiblesPlugin,MediaItem', u'Keep')) self.AdvancedChapterLabel.setText(
self.ClearAdvancedSearchComboBox.addItem(translate(u'BiblesPlugin,MediaItem', u'Clear')) translate(u'BiblesPlugin.MediaItem', u'Chapter:'))
self.ClearAdvancedSearchComboBox.addItem(translate(u'BiblesPlugin,MediaItem', u'Keep')) self.AdvancedVerseLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Verse:'))
self.AdvancedFromLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'From:'))
self.AdvancedToLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'To:'))
self.AdvancedClearLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Results:'))
self.AdvancedSearchButton.setText(
translate(u'BiblesPlugin.MediaItem', u'Search'))
self.QuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Verse Search'))
self.QuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Text Search'))
self.ClearQuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Clear'))
self.ClearQuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Keep'))
self.ClearAdvancedSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Clear'))
self.ClearAdvancedSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Keep'))
def initialise(self): def initialise(self):
log.debug(u'bible manager initialise') log.debug(u'bible manager initialise')
@ -363,8 +386,9 @@ class BibleMediaItem(MediaManagerItem):
def onNoBookFound(self): def onNoBookFound(self):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin,MediaItem', u'No Book Found'), translate(u'BiblesPlugin.MediaItem', u'No Book Found'),
translate(u'BiblesPlugin,MediaItem', u'No matching book could be found in this Bible.'), translate(u'BiblesPlugin.MediaItem',
u'No matching book could be found in this Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok QtGui.QMessageBox.Ok
) )
@ -532,9 +556,11 @@ class BibleMediaItem(MediaManagerItem):
bible_text = u'' bible_text = u''
if not service_item.title: if not service_item.title:
service_item.title = u'%s %s' % (book, verse_text) service_item.title = u'%s %s' % (book, verse_text)
elif service_item.title.find(translate('MediaItem',u'etc')) == -1: elif service_item.title.find(
translate(u'BiblesPlugin.MediaItem', u'etc')) == -1:
service_item.title = u'%s, %s' \ service_item.title = u'%s, %s' \
% (service_item.title, translate('MediaItem',u'etc')) % (service_item.title,
translate(u'BiblesPlugin.MediaItem', u'etc'))
if len(self.parent.settings_tab.bible_theme) == 0: if len(self.parent.settings_tab.bible_theme) == 0:
service_item.theme = None service_item.theme = None
else: else:
@ -583,7 +609,8 @@ class BibleMediaItem(MediaManagerItem):
self.verses = self.parent.manager.get_verse_count(bible, book, 1) self.verses = self.parent.manager.get_verse_count(bible, book, 1)
if self.verses == 0: if self.verses == 0:
self.AdvancedSearchButton.setEnabled(False) self.AdvancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText(translate(u'BiblesPlugin,MediaItem', u'Bible not fully loaded')) self.AdvancedMessage.setText(
translate(u'BiblesPlugin.MediaItem', u'Bible not fully loaded'))
else: else:
self.AdvancedSearchButton.setEnabled(True) self.AdvancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'') self.AdvancedMessage.setText(u'')

View File

@ -61,8 +61,12 @@ class ImageMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = translate(u'ImagePlugin.MediaItem', self.OnNewPrompt = translate(u'ImagePlugin.MediaItem',
u'Select Image(s)') u'Select Image(s)')
self.OnNewFileMasks = translate(u'ImagePlugin.MediaItem', file_formats = u''
u'Images (*.jpg *.jpeg *.gif *.png *.bmp);; All files (*)') for file_format in QtGui.QImageReader.supportedImageFormats():
file_formats += u'*.%s ' % file_format
self.OnNewFileMasks = unicode(
translate(u'ImagePlugin.MediaItem',
u'Images (%s);; All files (*)')) % file_formats
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)

View File

@ -471,7 +471,7 @@ class Ui_EditSongDialog(object):
self.CopyrightGroupBox.setTitle( self.CopyrightGroupBox.setTitle(
translate(u'SongsPlugin.EditSongForm', u'Copyright Information')) translate(u'SongsPlugin.EditSongForm', u'Copyright Information'))
self.CopyrightInsertButton.setText( self.CopyrightInsertButton.setText(
translate('EditSongForm', u'\xa9')) translate(u'SongsPlugin.EditSongForm', u'\xa9'))
self.CCLILabel.setText( self.CCLILabel.setText(
translate(u'SongsPlugin.EditSongForm', u'CCLI Number:')) translate(u'SongsPlugin.EditSongForm', u'CCLI Number:'))
self.CommentsGroupBox.setTitle( self.CommentsGroupBox.setTitle(

View File

@ -103,7 +103,9 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if match: if match:
verse_type = match.group(1) verse_type = match.group(1)
verse_number = int(match.group(2)) verse_number = int(match.group(2))
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type)) verse_type_index = VerseType.from_string(verse_type)
if verse_type_index:
self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
self.VerseNumberBox.setValue(verse_number) self.VerseNumberBox.setValue(verse_number)
def setVerse(self, text, single=False, def setVerse(self, text, single=False,

View File

@ -208,8 +208,8 @@ class SongMediaItem(MediaManagerItem):
for author in searchresults: for author in searchresults:
for song in author.songs: for song in author.songs:
song_detail = unicode( song_detail = unicode(
translate(u'SongsPlugin.MediaItem', u'%s (%s)') % translate(u'SongsPlugin.MediaItem', u'%s (%s)')) % \
(author.display_name, song.title)) (author.display_name, song.title)
song_name = QtGui.QListWidgetItem(song_detail) song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name) self.ListView.addItem(song_name)