From a8d2d3661db5abac51da47d35852083967b62c57 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 16 Feb 2011 03:06:34 +0000 Subject: [PATCH] Sort grammar breakers --- openlp/core/lib/plugin.py | 2 +- openlp/core/lib/ui.py | 5 +- openlp/core/ui/mainwindow.py | 30 +++++----- openlp/core/ui/themeform.py | 2 +- openlp/core/ui/thememanager.py | 6 +- openlp/core/ui/wizard.py | 10 +--- openlp/plugins/alerts/forms/alertform.py | 3 +- .../plugins/bibles/forms/bibleimportform.py | 15 +++-- openlp/plugins/images/lib/mediaitem.py | 5 +- openlp/plugins/media/lib/mediaitem.py | 5 +- openlp/plugins/songs/forms/authorsdialog.py | 3 +- openlp/plugins/songs/forms/editsongform.py | 24 ++++---- openlp/plugins/songs/forms/songbookdialog.py | 3 +- openlp/plugins/songs/forms/songexportform.py | 5 +- openlp/plugins/songs/forms/songimportform.py | 36 +++++++----- .../songs/forms/songmaintenancedialog.py | 7 +-- .../songs/forms/songmaintenanceform.py | 55 ++++++++++++------- openlp/plugins/songs/forms/topicsdialog.py | 3 +- openlp/plugins/songs/lib/mediaitem.py | 4 +- 19 files changed, 122 insertions(+), 101 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 4f65a924e..39f13c37e 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -144,6 +144,7 @@ class Plugin(QtCore.QObject): self.name = name self.textStrings = {} self.setPluginTextStrings() + self.nameStrings = self.textStrings[StringContent.Name] if version: self.version = version self.settingsSection = self.name.lower() @@ -339,7 +340,6 @@ class Plugin(QtCore.QObject): """ Called to define all translatable texts of the plugin """ - self.nameStrings = self.textStrings[StringContent.Name] ## Load Action ## self.__setNameTextString(StringContent.Load, UiStrings.Load, tooltips[u'load']) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 59c6cd4d2..1e11133f4 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -177,7 +177,7 @@ def media_item_combo_box(parent, name): combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) return combo -def create_delete_push_button(parent, item_name, icon=None): +def create_delete_push_button(parent, icon=None): """ Creates a standard push button with a delete label and optional icon. The button is connected to the parent's ``onDeleteButtonClicked()`` method to @@ -195,7 +195,8 @@ def create_delete_push_button(parent, item_name, icon=None): delete_icon = icon if icon else u':/general/general_delete.png' delete_button.setIcon(build_icon(delete_icon)) delete_button.setText(UiStrings.Delete) - delete_button.setToolTip(UiStrings.DeleteSelect % item_name) + delete_button.setToolTip( + translate('OpenLP.Ui', 'Delete the selected item.')) QtCore.QObject.connect(delete_button, QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked) return delete_button diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index fc78fa54c..2ef1f834f 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -364,41 +364,41 @@ class Ui_MainWindow(object): self.ViewMediaManagerItem.setText( translate('OpenLP.MainWindow', '&Media Manager')) self.ViewMediaManagerItem.setToolTip( - UiStrings.ToggleType % UiStrings.MediaManager) - self.ViewMediaManagerItem.setStatusTip( - UiStrings.ToggleVisibility % UiStrings.MediaManager.toLower()) + translate('OpenLP.MainWindow', 'Toggle Media Manager')) + self.ViewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow', + 'Toggle the visibility of the media manager.')) self.ViewMediaManagerItem.setShortcut( translate('OpenLP.MainWindow', 'F8')) self.ViewThemeManagerItem.setText( translate('OpenLP.MainWindow', '&Theme Manager')) self.ViewThemeManagerItem.setToolTip( - UiStrings.ToggleType % UiStrings.ThemeManager) - self.ViewThemeManagerItem.setStatusTip( - UiStrings.ToggleVisibility % UiStrings.ThemeManager.toLower()) + translate('OpenLP.MainWindow', 'Toggle Theme Manager')) + self.ViewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow', + 'Toggle the visibility of the theme manager.')) self.ViewThemeManagerItem.setShortcut( translate('OpenLP.MainWindow', 'F10')) self.ViewServiceManagerItem.setText( translate('OpenLP.MainWindow', '&Service Manager')) self.ViewServiceManagerItem.setToolTip( - UiStrings.ToggleType % UiStrings.ServiceManager) - self.ViewServiceManagerItem.setStatusTip( - UiStrings.ToggleVisibility % UiStrings.ServiceManager.toLower()) + translate('OpenLP.MainWindow', 'Toggle Service Manager')) + self.ViewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow', + 'Toggle the visibility of the service manager.')) self.ViewServiceManagerItem.setShortcut( translate('OpenLP.MainWindow', 'F9')) self.ViewPreviewPanel.setText( translate('OpenLP.MainWindow', '&Preview Panel')) self.ViewPreviewPanel.setToolTip( - UiStrings.ToggleType % UiStrings.PreviewPanel) - self.ViewPreviewPanel.setStatusTip( - UiStrings.ToggleVisibility % UiStrings.PreviewPanel.toLower()) + translate('OpenLP.MainWindow', 'Toggle Preview Panel')) + self.ViewPreviewPanel.setStatusTip(translate('OpenLP.MainWindow', + 'Toggle the visibility of the preview panel.')) self.ViewPreviewPanel.setShortcut( translate('OpenLP.MainWindow', 'F11')) self.ViewLivePanel.setText( translate('OpenLP.MainWindow', '&Live Panel')) self.ViewLivePanel.setToolTip( - UiStrings.ToggleType % UiStrings.LivePanel) - self.ViewLivePanel.setStatusTip( - UiStrings.ToggleVisibility % UiStrings.LivePanel.toLower()) + translate('OpenLP.MainWindow', 'Toggle Live Panel')) + self.ViewLivePanel.setStatusTip(translate('OpenLP.MainWindow', + 'Toggle the visibility of the live panel.')) self.ViewLivePanel.setShortcut( translate('OpenLP.MainWindow', 'F12')) self.settingsPluginListItem.setText(translate('OpenLP.MainWindow', diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 06be52dbe..f34e2b8d2 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -301,7 +301,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): 'Edit Theme - %s')) % self.theme.theme_name) self.next() else: - self.setWindowTitle(UiStrings.NewType % UiStrings.Theme) + self.setWindowTitle(translate('OpenLP.ThemeWizard', 'New Theme')) return QtGui.QWizard.exec_(self) def initializePage(self, id): diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index eddc1c3cf..739de7182 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -105,7 +105,7 @@ class ThemeManager(QtGui.QWidget): # build the context menu self.menu = QtGui.QMenu() self.editAction = self.menu.addAction( - UiStrings.EditType % UiStrings.Theme) + translate('OpenLP.ThemeManager', '&Edit Theme')) self.editAction.setIcon(build_icon(u':/themes/theme_edit.png')) self.copyAction = self.menu.addAction( translate('OpenLP.ThemeManager', '&Copy Theme')) @@ -114,14 +114,14 @@ class ThemeManager(QtGui.QWidget): translate('OpenLP.ThemeManager', '&Rename Theme')) self.renameAction.setIcon(build_icon(u':/themes/theme_edit.png')) self.deleteAction = self.menu.addAction( - UiStrings.AmpDeleteType % UiStrings.Theme) + translate('OpenLP.ThemeManager', '&Delete Theme')) self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) self.separator = self.menu.addSeparator() self.globalAction = self.menu.addAction( translate('OpenLP.ThemeManager', 'Set As &Global Default')) self.globalAction.setIcon(build_icon(u':/general/general_export.png')) self.exportAction = self.menu.addAction( - UiStrings.ExportType % UiStrings.Theme) + translate('OpenLP.ThemeManager', '&Export Theme')) self.exportAction.setIcon(build_icon(u':/general/general_export.png')) # Signals QtCore.QObject.connect(self.themeListWidget, diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index b3b4f9233..7e9511c33 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -56,6 +56,7 @@ class WizardStrings(object): WoW = u'Words of Worship' # These strings should need a good reason to be retranslated elsewhere. FormatLabel = translate('OpenLP.Ui', 'Format:') + Header = u'%s' Importing = translate('OpenLP.Ui', 'Importing') ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...')) ImportSelect = translate('OpenLP.Ui', 'Select Import Source') @@ -63,7 +64,7 @@ class WizardStrings(object): 'Select the import format and the location to import from.')) NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been ' 'disabled due to a missing Python module. If you want to use this ' - 'importer, you will need to install the "python-sqlite" ' + 'importer, you will need to install the "python-sqlite" ' 'module.') OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File')) Ready = translate('OpenLP.Ui', 'Ready.') @@ -108,13 +109,6 @@ class OpenLPWizard(QtGui.QWizard): self.retranslateUi() QtCore.QMetaObject.connectSlotsByName(self) - def retranslateUi(self): - """ - Provides generic wizard localisation - """ - self.titleLabel.setText(WizardStrings.Welcome % - (self.plugin.nameStrings[u'singular'], self.direction)) - def registerFields(self): """ Hook method for wizards to register any fields they need. diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index f2594d44a..0639f2bb1 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -27,7 +27,6 @@ from PyQt4 import QtGui, QtCore from openlp.core.lib import translate -from openlp.core.lib.ui import UiStrings from openlp.plugins.alerts.lib.db import AlertItem from alertdialog import Ui_AlertDialog @@ -97,7 +96,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): def onNewClick(self): if len(self.alertTextEdit.text()) == 0: QtGui.QMessageBox.information(self, - UiStrings.NewType % self.plugin.nameStrings[u'singular'], + translate('AlertsPlugin.AlertForm', 'New Alert'), translate('AlertsPlugin.AlertForm', 'You haven\'t specified ' 'any text for your alert. Please type in some text before ' 'clicking New.')) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index b27d12a44..b3b7aeb7e 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -361,12 +361,15 @@ class BibleImportForm(OpenLPWizard): """ Allow for localisation of the bible import wizard. """ - OpenLPWizard.retranslateUi(self) self.setWindowTitle( translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard')) - self.informationLabel.setText(WizardStrings.Description % ( - self.direction.toLower(), self.plugin.nameStrings[u'plural'], - self.direction.toLower())) + self.titleLabel.setText(WizardStrings.Header % + translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard')) + self.informationLabel.setText( + translate('BiblesPlugin.ImportWizardForm', + 'This wizard will help you to import Bibles from a variety of ' + 'formats. Click the next button below to start the process by ' + 'selecting a format to import from.')) self.selectPage.setTitle(WizardStrings.ImportSelect) self.selectPage.setSubTitle(WizardStrings.ImportSelectLong) self.formatLabel.setText(WizardStrings.FormatLabel) @@ -765,8 +768,8 @@ class BibleImportForm(OpenLPWizard): 'bible. Please note, that verses will be downloaded on\n' 'demand and thus an internet connection is required.')) else: - self.progressLabel.setText( - WizardStrings.FinishedType % UiStrings.Import.toLower()) + self.progressLabel.setText(translate( + 'BiblesPlugin.ImportWizardForm', 'Finished import.')) else: self.progressLabel.setText(translate( 'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.')) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 556fff22b..137485eb5 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -198,5 +198,6 @@ class ImageMediaItem(MediaManagerItem): self.resetAction.setVisible(True) else: critical_error_message_box(UiStrings.LiveBGError, - UiStrings.ProbReplaceBG % ( - self.plugin.nameStrings[u'singular'].toLower(), filename)) + unicode(translate('ImagePlugin.MediaItem', + 'There was a problem replacing your background, ' + 'the image file "%s" no longer exists.')) % filename) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 93c201c14..89db9d993 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -113,8 +113,9 @@ class MediaMediaItem(MediaManagerItem): self.resetAction.setVisible(True) else: critical_error_message_box(UiStrings.LiveBGError, - UiStrings.ProbReplaceBG % ( - self.plugin.nameStrings[u'singular'].toLower(), filename)) + unicode(translate('MediaPlugin.MediaItem', + 'There was a problem replacing your background, ' + 'the media file "%s" no longer exists.')) % filename) def generateSlideData(self, service_item, item=None, xmlVersion=False): if item is None: diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index 6cfe83e67..09c723364 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate from openlp.core.lib.ui import create_accept_reject_button_box -from openlp.plugins.songs.lib.ui import SongStrings class Ui_AuthorsDialog(object): def setupUi(self, authorsDialog): @@ -65,7 +64,7 @@ class Ui_AuthorsDialog(object): def retranslateUi(self, authorsDialog): authorsDialog.setWindowTitle( - SongStrings.TypeMaintenance % SongStrings.Author) + translate('SongsPlugin.AuthorsForm', 'Author Maintenance')) self.displayLabel.setText( translate('SongsPlugin.AuthorsForm', 'Display name:')) self.firstNameLabel.setText( diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 2f0475828..9874b7952 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -35,7 +35,6 @@ from openlp.core.lib.ui import UiStrings, add_widget_completer, \ from openlp.plugins.songs.forms import EditVerseForm from openlp.plugins.songs.lib import SongXML, VerseType from openlp.plugins.songs.lib.db import Book, Song, Author, Topic -from openlp.plugins.songs.lib.ui import SongStrings from editsongdialog import Ui_EditSongDialog log = logging.getLogger(__name__) @@ -310,8 +309,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.authorsComboBox.currentText()) if item == 0 and text: if QtGui.QMessageBox.question(self, - UiStrings.AddType % SongStrings.Author, - SongStrings.TypeNotExistAdd % SongStrings.Author.toLower(), + translate('SongsPlugin.EditSongForm', 'Add Author'), + translate('SongsPlugin.EditSongForm', 'This author does not ' + 'exist, do you want to add them?'), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: if text.find(u' ') == -1: @@ -332,8 +332,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if self.authorsListView.findItems(unicode(author.display_name), QtCore.Qt.MatchExactly): critical_error_message_box( - message=SongStrings.TypeInList % - SongStrings.Author.toLower()) + message=translate('SongsPlugin.EditSongForm', + 'This author is already in the list.')) else: self.__addAuthorToList(author) self.authorsComboBox.setCurrentIndex(0) @@ -367,8 +367,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.topicsComboBox.currentText()) if item == 0 and text: if QtGui.QMessageBox.question(self, - UiStrings.AddType % SongStrings.Topic, - SongStrings.TypeNotExistAdd % SongStrings.Topic.toLower(), + translate('SongsPlugin.EditSongForm', 'Add Topic'), + translate('SongsPlugin.EditSongForm', 'This topic does not ' + 'exist, do you want to add it?'), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: topic = Topic.populate(name=text) @@ -387,8 +388,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if self.topicsListView.findItems(unicode(topic.name), QtCore.Qt.MatchExactly): critical_error_message_box( - message=SongStrings.TypeInList % - SongStrings.Topic.toLower()) + message=translate('SongsPlugin.EditSongForm', + 'This topic is already in the list.')) else: topic_item = QtGui.QListWidgetItem(unicode(topic.name)) topic_item.setData(QtCore.Qt.UserRole, @@ -583,8 +584,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.songBookComboBox.currentText()) if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0: if QtGui.QMessageBox.question(self, - UiStrings.AddType % SongStrings.SongBook, - SongStrings.TypeNotExistAdd % SongStrings.SongBook.toLower(), + translate('SongsPlugin.EditSongForm', 'Add Book'), + translate('SongsPlugin.EditSongForm', 'This song book does ' + 'not exist, do you want to add it?'), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: book = Book.populate(name=text, publisher=u'') diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index d185a9e1e..f6dd3930c 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate from openlp.core.lib.ui import create_accept_reject_button_box -from openlp.plugins.songs.lib.ui import SongStrings class Ui_SongBookDialog(object): def setupUi(self, songBookDialog): @@ -59,7 +58,7 @@ class Ui_SongBookDialog(object): def retranslateUi(self, songBookDialog): songBookDialog.setWindowTitle( - SongStrings.TypeMaintenance % SongStrings.SongBook) + translate('SongsPlugin.SongBookForm', 'Song Book Maintenance')) self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:')) self.publisherLabel.setText( translate('SongsPlugin.SongBookForm', '&Publisher:')) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 66003532b..231e9ff19 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -162,9 +162,10 @@ class SongExportForm(OpenLPWizard): """ Song wizard localisation. """ - OpenLPWizard.retranslateUi(self) self.setWindowTitle( translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard')) + self.titleLabel.setText(WizardStrings.Header % + translate('OpenLP.Ui', 'Welcome to the Song Export Wizard')) self.informationLabel.setText( translate('SongsPlugin.ExportWizardForm', 'This wizard will help to' ' export your songs to the open and free OpenLyrics worship song ' @@ -281,7 +282,7 @@ class SongExportForm(OpenLPWizard): self, songs, unicode(self.directoryLineEdit.text())) if exporter.do_export(): self.progressLabel.setText( - WizardStrings.FinishedType % UiStrings.Export.toLower()) + translate('SongsPlugin.SongExportForm', 'Finished export.')) else: self.progressLabel.setText( translate('SongsPlugin.SongExportForm', diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 9f85762f2..aa65501b3 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -205,12 +205,15 @@ class SongImportForm(OpenLPWizard): """ Song wizard localisation. """ - OpenLPWizard.retranslateUi(self) self.setWindowTitle( translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) - self.informationLabel.setText(WizardStrings.Description % ( - self.direction.toLower(), self.plugin.nameStrings[u'plural'], - self.direction.toLower())) + self.titleLabel.setText(WizardStrings.Header % + translate('OpenLP.Ui', 'Welcome to the Song Import Wizard')) + self.informationLabel.setText( + translate('SongsPlugin.ImportWizardForm', + 'This wizard will help you to import songs from a variety of ' + 'formats. Click the next button below to start the process by ' + 'selecting a format to import from.')) self.sourcePage.setTitle(WizardStrings.ImportSelect) self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong) self.formatLabel.setText(WizardStrings.FormatLabel) @@ -224,7 +227,9 @@ class SongImportForm(OpenLPWizard): self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI) self.formatComboBox.setItemText( SongFormat.SongsOfFellowship, WizardStrings.SoF) - self.formatComboBox.setItemText(SongFormat.Generic, WizardStrings.GDP) + self.formatComboBox.setItemText(SongFormat.Generic, + translate('SongsPlugin.ImportWizardForm', + 'Generic Document/Presentation')) self.formatComboBox.setItemText( SongFormat.EasiSlides, WizardStrings.ES) self.formatComboBox.setItemText( @@ -361,8 +366,9 @@ class SongImportForm(OpenLPWizard): elif source_format == SongFormat.Generic: if self.genericFileListWidget.count() == 0: critical_error_message_box(UiStrings.NFSp, - WizardStrings.YouSpecifyFile % - WizardStrings.GDP.toLower()) + translate('SongsPlugin.ImportWizardForm', + 'You need to add at least one document or ' + 'presentation file to import from.')) self.genericAddButton.setFocus() return False elif source_format == SongFormat.EasiSlides: @@ -417,8 +423,7 @@ class SongImportForm(OpenLPWizard): filters) if filenames: listbox.addItems(filenames) - SettingsManager.set_last_dir( - self.plugin.settingsSection, + SettingsManager.set_last_dir(self.plugin.settingsSection, os.path.split(unicode(filenames[0]))[0], 1) def getListOfFiles(self, listbox): @@ -533,8 +538,11 @@ class SongImportForm(OpenLPWizard): """ Get song database files """ - self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.GDP, - self.genericFileListWidget) + self.getFileName( + translate('SongsPlugin.ImportWizardForm', + 'Select Document/Presentation Files'), + self.genericFileListWidget + ) def onGenericRemoveButtonClicked(self): """ @@ -572,7 +580,7 @@ class SongImportForm(OpenLPWizard): """ Get SongShow Plus song database files """ - self.getFiles(WizardStrings.OpenFileType % WizardStrings.SSP, + self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SSP, self.songShowPlusFileListWidget, u'%s (*.sbsong)' % translate('SongsPlugin.ImportWizardForm', 'SongShow Plus Song Files') @@ -660,7 +668,7 @@ class SongImportForm(OpenLPWizard): self.songsOfFellowshipFileListWidget) ) elif source_format == SongFormat.Generic: - # Import a generic document or presentatoin + # Import a generic document or presentation importer = self.plugin.importSongs(SongFormat.Generic, filenames=self.getListOfFiles(self.genericFileListWidget) ) @@ -686,7 +694,7 @@ class SongImportForm(OpenLPWizard): ) if importer.do_import(): self.progressLabel.setText( - WizardStrings.FinishedType % UiStrings.Import.toLower()) + translate('SongsPlugin.SongImportForm', 'Finished import.')) else: self.progressLabel.setText( translate('SongsPlugin.SongImportForm', diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index 14ad1132d..d17442b4c 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, StringContent +from openlp.core.lib import build_icon, translate from openlp.core.lib.ui import UiStrings from openlp.plugins.songs.lib.ui import SongStrings @@ -145,9 +145,8 @@ class Ui_SongMaintenanceDialog(object): QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog) def retranslateUi(self, songMaintenanceDialog): - songMaintenanceDialog.setWindowTitle(SongStrings.TypeMaintenance % - songMaintenanceDialog.parent().plugin.getString( - StringContent.Name)[u'singular']) + songMaintenanceDialog.setWindowTitle( + translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance')) self.listItemAuthors.setText(SongStrings.Authors) self.listItemTopics.setText(SongStrings.Topics) self.listItemBooks.setText(SongStrings.SongBooks) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index ffea2ffa6..7f9b8bec5 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -32,7 +32,6 @@ from openlp.core.lib import Receiver, translate from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm from openlp.plugins.songs.lib.db import Author, Book, Topic, Song -from openlp.plugins.songs.lib.ui import SongStrings from songmaintenancedialog import Ui_SongMaintenanceDialog log = logging.getLogger(__name__) @@ -103,20 +102,18 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): else: return -1 - def _deleteItem(self, item_class, list_widget, reset_func, del_type): - dlg_title = UiStrings.DeleteType % del_type + def _deleteItem(self, item_class, list_widget, reset_func, dlg_title, + del_text, err_text): item_id = self._getCurrentItemId(list_widget) if item_id != -1: item = self.manager.get_object(item_class, item_id) if item and len(item.songs) == 0: - if critical_error_message_box(dlg_title, - SongStrings.SureDeleteType % del_type, - self, True) == QtGui.QMessageBox.Yes: + if critical_error_message_box(dlg_title, del_text, self, + True) == QtGui.QMessageBox.Yes: self.manager.delete_object(item_class, item.id) reset_func() else: - critical_error_message_box(dlg_title, - SongStrings.NoDeleteAssigned % del_type) + critical_error_message_box(dlg_title, err_text) else: critical_error_message_box(dlg_title, UiStrings.NISs) @@ -217,11 +214,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.manager.save_object(author): self.resetAuthors() else: - critical_error_message_box(SongStrings.CouldNotAdd % - SongStrings.Author.toLower()) + critical_error_message_box( + message=translate('SongsPlugin.SongMaintenanceForm', + 'Could not add your author.')) else: critical_error_message_box( - SongStrings.ThisTypeExists % SongStrings.Author.toLower()) + message=translate('SongsPlugin.SongMaintenanceForm', + 'This author already exists.')) def onTopicAddButtonClick(self): if self.topicform.exec_(): @@ -230,11 +229,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.manager.save_object(topic): self.resetTopics() else: - critical_error_message_box(SongStrings.CouldNotAdd % - SongStrings.Topic.toLower()) + critical_error_message_box( + message=translate('SongsPlugin.SongMaintenanceForm', + 'Could not add your topic.')) else: critical_error_message_box( - SongStrings.ThisTypeExists % SongStrings.Topic.toLower()) + message=translate('SongsPlugin.SongMaintenanceForm', + 'This topic already exists.')) def onBookAddButtonClick(self): if self.bookform.exec_(): @@ -244,11 +245,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.manager.save_object(book): self.resetBooks() else: - critical_error_message_box(SongStrings.CouldNotAdd % - SongStrings.SongBook.toLower()) + critical_error_message_box( + message=translate('SongsPlugin.SongMaintenanceForm', + 'Could not add your book.')) else: critical_error_message_box( - SongStrings.ThisTypeExists % SongStrings.SongBook.toLower()) + message=translate('SongsPlugin.SongMaintenanceForm', + 'This book already exists.')) def onAuthorEditButtonClick(self): author_id = self._getCurrentItemId(self.authorsListWidget) @@ -442,21 +445,33 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): Delete the author if the author is not attached to any songs. """ self._deleteItem(Author, self.authorsListWidget, self.resetAuthors, - SongStrings.Author) + translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'), + translate('SongsPlugin.SongMaintenanceForm', + 'Are you sure you want to delete the selected author?'), + translate('SongsPlugin.SongMaintenanceForm', 'This author cannot ' + 'be deleted, they are currently assigned to at least one song.')) def onTopicDeleteButtonClick(self): """ Delete the Book if the Book is not attached to any songs. """ self._deleteItem(Topic, self.topicsListWidget, self.resetTopics, - SongStrings.Topic) + translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'), + translate('SongsPlugin.SongMaintenanceForm', + 'Are you sure you want to delete the selected topic?'), + translate('SongsPlugin.SongMaintenanceForm', 'This topic cannot ' + 'be deleted, it is currently assigned to at least one song.')) def onBookDeleteButtonClick(self): """ Delete the Book if the Book is not attached to any songs. """ self._deleteItem(Book, self.booksListWidget, self.resetBooks, - SongStrings.SongBook) + translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'), + translate('SongsPlugin.SongMaintenanceForm', + 'Are you sure you want to delete the selected book?'), + translate('SongsPlugin.SongMaintenanceForm', 'This book cannot be ' + 'deleted, it is currently assigned to at least one song.')) def onAuthorsListRowChanged(self, row): """ diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index 4e2349019..1e7bdb6a0 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate from openlp.core.lib.ui import create_accept_reject_button_box -from openlp.plugins.songs.lib.ui import SongStrings class Ui_TopicsDialog(object): def setupUi(self, topicsDialog): @@ -53,6 +52,6 @@ class Ui_TopicsDialog(object): def retranslateUi(self, topicsDialog): topicsDialog.setWindowTitle( - SongStrings.TypeMaintenance % SongStrings.Topic) + translate('SongsPlugin.TopicsForm', 'Topic Maintenance')) self.nameLabel.setText( translate('SongsPlugin.TopicsForm', 'Topic name:')) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 30b1060bf..6e0c9537d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -137,8 +137,8 @@ class SongMediaItem(MediaManagerItem): def retranslateUi(self): self.searchTextLabel.setText(u'%s:' % UiStrings.Search) self.searchTextButton.setText(UiStrings.Search) - self.maintenanceAction.setText(SongStrings.TypeMaintenance % - self.plugin.nameStrings[u'singular']) + self.maintenanceAction.setText( + translate('SongsPlugin.MediaItem', 'Song Maintenance')) self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem', 'Maintain the lists of authors, topics and books'))