Sort grammar breakers

This commit is contained in:
Jon Tibble 2011-02-16 03:06:34 +00:00
parent 5c7bd57833
commit a8d2d3661d
19 changed files with 122 additions and 101 deletions

View File

@ -144,6 +144,7 @@ class Plugin(QtCore.QObject):
self.name = name self.name = name
self.textStrings = {} self.textStrings = {}
self.setPluginTextStrings() self.setPluginTextStrings()
self.nameStrings = self.textStrings[StringContent.Name]
if version: if version:
self.version = version self.version = version
self.settingsSection = self.name.lower() self.settingsSection = self.name.lower()
@ -339,7 +340,6 @@ class Plugin(QtCore.QObject):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.nameStrings = self.textStrings[StringContent.Name]
## Load Action ## ## Load Action ##
self.__setNameTextString(StringContent.Load, self.__setNameTextString(StringContent.Load,
UiStrings.Load, tooltips[u'load']) UiStrings.Load, tooltips[u'load'])

View File

@ -177,7 +177,7 @@ def media_item_combo_box(parent, name):
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
return combo 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 Creates a standard push button with a delete label and optional icon. The
button is connected to the parent's ``onDeleteButtonClicked()`` method to 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_icon = icon if icon else u':/general/general_delete.png'
delete_button.setIcon(build_icon(delete_icon)) delete_button.setIcon(build_icon(delete_icon))
delete_button.setText(UiStrings.Delete) 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.QObject.connect(delete_button,
QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked) QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked)
return delete_button return delete_button

View File

@ -364,41 +364,41 @@ class Ui_MainWindow(object):
self.ViewMediaManagerItem.setText( self.ViewMediaManagerItem.setText(
translate('OpenLP.MainWindow', '&Media Manager')) translate('OpenLP.MainWindow', '&Media Manager'))
self.ViewMediaManagerItem.setToolTip( self.ViewMediaManagerItem.setToolTip(
UiStrings.ToggleType % UiStrings.MediaManager) translate('OpenLP.MainWindow', 'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip( self.ViewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow',
UiStrings.ToggleVisibility % UiStrings.MediaManager.toLower()) 'Toggle the visibility of the media manager.'))
self.ViewMediaManagerItem.setShortcut( self.ViewMediaManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F8')) translate('OpenLP.MainWindow', 'F8'))
self.ViewThemeManagerItem.setText( self.ViewThemeManagerItem.setText(
translate('OpenLP.MainWindow', '&Theme Manager')) translate('OpenLP.MainWindow', '&Theme Manager'))
self.ViewThemeManagerItem.setToolTip( self.ViewThemeManagerItem.setToolTip(
UiStrings.ToggleType % UiStrings.ThemeManager) translate('OpenLP.MainWindow', 'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip( self.ViewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow',
UiStrings.ToggleVisibility % UiStrings.ThemeManager.toLower()) 'Toggle the visibility of the theme manager.'))
self.ViewThemeManagerItem.setShortcut( self.ViewThemeManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F10')) translate('OpenLP.MainWindow', 'F10'))
self.ViewServiceManagerItem.setText( self.ViewServiceManagerItem.setText(
translate('OpenLP.MainWindow', '&Service Manager')) translate('OpenLP.MainWindow', '&Service Manager'))
self.ViewServiceManagerItem.setToolTip( self.ViewServiceManagerItem.setToolTip(
UiStrings.ToggleType % UiStrings.ServiceManager) translate('OpenLP.MainWindow', 'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip( self.ViewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow',
UiStrings.ToggleVisibility % UiStrings.ServiceManager.toLower()) 'Toggle the visibility of the service manager.'))
self.ViewServiceManagerItem.setShortcut( self.ViewServiceManagerItem.setShortcut(
translate('OpenLP.MainWindow', 'F9')) translate('OpenLP.MainWindow', 'F9'))
self.ViewPreviewPanel.setText( self.ViewPreviewPanel.setText(
translate('OpenLP.MainWindow', '&Preview Panel')) translate('OpenLP.MainWindow', '&Preview Panel'))
self.ViewPreviewPanel.setToolTip( self.ViewPreviewPanel.setToolTip(
UiStrings.ToggleType % UiStrings.PreviewPanel) translate('OpenLP.MainWindow', 'Toggle Preview Panel'))
self.ViewPreviewPanel.setStatusTip( self.ViewPreviewPanel.setStatusTip(translate('OpenLP.MainWindow',
UiStrings.ToggleVisibility % UiStrings.PreviewPanel.toLower()) 'Toggle the visibility of the preview panel.'))
self.ViewPreviewPanel.setShortcut( self.ViewPreviewPanel.setShortcut(
translate('OpenLP.MainWindow', 'F11')) translate('OpenLP.MainWindow', 'F11'))
self.ViewLivePanel.setText( self.ViewLivePanel.setText(
translate('OpenLP.MainWindow', '&Live Panel')) translate('OpenLP.MainWindow', '&Live Panel'))
self.ViewLivePanel.setToolTip( self.ViewLivePanel.setToolTip(
UiStrings.ToggleType % UiStrings.LivePanel) translate('OpenLP.MainWindow', 'Toggle Live Panel'))
self.ViewLivePanel.setStatusTip( self.ViewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
UiStrings.ToggleVisibility % UiStrings.LivePanel.toLower()) 'Toggle the visibility of the live panel.'))
self.ViewLivePanel.setShortcut( self.ViewLivePanel.setShortcut(
translate('OpenLP.MainWindow', 'F12')) translate('OpenLP.MainWindow', 'F12'))
self.settingsPluginListItem.setText(translate('OpenLP.MainWindow', self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',

View File

@ -301,7 +301,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
'Edit Theme - %s')) % self.theme.theme_name) 'Edit Theme - %s')) % self.theme.theme_name)
self.next() self.next()
else: else:
self.setWindowTitle(UiStrings.NewType % UiStrings.Theme) self.setWindowTitle(translate('OpenLP.ThemeWizard', 'New Theme'))
return QtGui.QWizard.exec_(self) return QtGui.QWizard.exec_(self)
def initializePage(self, id): def initializePage(self, id):

View File

@ -105,7 +105,7 @@ class ThemeManager(QtGui.QWidget):
# build the context menu # build the context menu
self.menu = QtGui.QMenu() self.menu = QtGui.QMenu()
self.editAction = self.menu.addAction( 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.editAction.setIcon(build_icon(u':/themes/theme_edit.png'))
self.copyAction = self.menu.addAction( self.copyAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Copy Theme')) translate('OpenLP.ThemeManager', '&Copy Theme'))
@ -114,14 +114,14 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', '&Rename Theme')) translate('OpenLP.ThemeManager', '&Rename Theme'))
self.renameAction.setIcon(build_icon(u':/themes/theme_edit.png')) self.renameAction.setIcon(build_icon(u':/themes/theme_edit.png'))
self.deleteAction = self.menu.addAction( 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.deleteAction.setIcon(build_icon(u':/general/general_delete.png'))
self.separator = self.menu.addSeparator() self.separator = self.menu.addSeparator()
self.globalAction = self.menu.addAction( self.globalAction = self.menu.addAction(
translate('OpenLP.ThemeManager', 'Set As &Global Default')) translate('OpenLP.ThemeManager', 'Set As &Global Default'))
self.globalAction.setIcon(build_icon(u':/general/general_export.png')) self.globalAction.setIcon(build_icon(u':/general/general_export.png'))
self.exportAction = self.menu.addAction( self.exportAction = self.menu.addAction(
UiStrings.ExportType % UiStrings.Theme) translate('OpenLP.ThemeManager', '&Export Theme'))
self.exportAction.setIcon(build_icon(u':/general/general_export.png')) self.exportAction.setIcon(build_icon(u':/general/general_export.png'))
# Signals # Signals
QtCore.QObject.connect(self.themeListWidget, QtCore.QObject.connect(self.themeListWidget,

View File

@ -56,6 +56,7 @@ class WizardStrings(object):
WoW = u'Words of Worship' WoW = u'Words of Worship'
# These strings should need a good reason to be retranslated elsewhere. # These strings should need a good reason to be retranslated elsewhere.
FormatLabel = translate('OpenLP.Ui', 'Format:') FormatLabel = translate('OpenLP.Ui', 'Format:')
Header = u'<span style="font-size:14pt; font-weight:600;">%s</span>'
Importing = translate('OpenLP.Ui', 'Importing') Importing = translate('OpenLP.Ui', 'Importing')
ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...')) ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...'))
ImportSelect = translate('OpenLP.Ui', 'Select Import Source') ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
@ -63,7 +64,7 @@ class WizardStrings(object):
'Select the import format and the location to import from.')) 'Select the import format and the location to import from.'))
NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been ' 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 ' 'disabled due to a missing Python module. If you want to use this '
'importer, you will need to install the &quot;python-sqlite&quot; ' 'importer, you will need to install the "python-sqlite" '
'module.') 'module.')
OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File')) OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File'))
Ready = translate('OpenLP.Ui', 'Ready.') Ready = translate('OpenLP.Ui', 'Ready.')
@ -108,13 +109,6 @@ class OpenLPWizard(QtGui.QWizard):
self.retranslateUi() self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self) 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): def registerFields(self):
""" """
Hook method for wizards to register any fields they need. Hook method for wizards to register any fields they need.

View File

@ -27,7 +27,6 @@
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import UiStrings
from openlp.plugins.alerts.lib.db import AlertItem from openlp.plugins.alerts.lib.db import AlertItem
from alertdialog import Ui_AlertDialog from alertdialog import Ui_AlertDialog
@ -97,7 +96,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
def onNewClick(self): def onNewClick(self):
if len(self.alertTextEdit.text()) == 0: if len(self.alertTextEdit.text()) == 0:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
UiStrings.NewType % self.plugin.nameStrings[u'singular'], translate('AlertsPlugin.AlertForm', 'New Alert'),
translate('AlertsPlugin.AlertForm', 'You haven\'t specified ' translate('AlertsPlugin.AlertForm', 'You haven\'t specified '
'any text for your alert. Please type in some text before ' 'any text for your alert. Please type in some text before '
'clicking New.')) 'clicking New.'))

View File

@ -361,12 +361,15 @@ class BibleImportForm(OpenLPWizard):
""" """
Allow for localisation of the bible import wizard. Allow for localisation of the bible import wizard.
""" """
OpenLPWizard.retranslateUi(self)
self.setWindowTitle( self.setWindowTitle(
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard')) translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
self.informationLabel.setText(WizardStrings.Description % ( self.titleLabel.setText(WizardStrings.Header %
self.direction.toLower(), self.plugin.nameStrings[u'plural'], translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
self.direction.toLower())) 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.setTitle(WizardStrings.ImportSelect)
self.selectPage.setSubTitle(WizardStrings.ImportSelectLong) self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel) self.formatLabel.setText(WizardStrings.FormatLabel)
@ -765,8 +768,8 @@ class BibleImportForm(OpenLPWizard):
'bible. Please note, that verses will be downloaded on\n' 'bible. Please note, that verses will be downloaded on\n'
'demand and thus an internet connection is required.')) 'demand and thus an internet connection is required.'))
else: else:
self.progressLabel.setText( self.progressLabel.setText(translate(
WizardStrings.FinishedType % UiStrings.Import.toLower()) 'BiblesPlugin.ImportWizardForm', 'Finished import.'))
else: else:
self.progressLabel.setText(translate( self.progressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.')) 'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))

View File

@ -198,5 +198,6 @@ class ImageMediaItem(MediaManagerItem):
self.resetAction.setVisible(True) self.resetAction.setVisible(True)
else: else:
critical_error_message_box(UiStrings.LiveBGError, critical_error_message_box(UiStrings.LiveBGError,
UiStrings.ProbReplaceBG % ( unicode(translate('ImagePlugin.MediaItem',
self.plugin.nameStrings[u'singular'].toLower(), filename)) 'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename)

View File

@ -113,8 +113,9 @@ class MediaMediaItem(MediaManagerItem):
self.resetAction.setVisible(True) self.resetAction.setVisible(True)
else: else:
critical_error_message_box(UiStrings.LiveBGError, critical_error_message_box(UiStrings.LiveBGError,
UiStrings.ProbReplaceBG % ( unicode(translate('MediaPlugin.MediaItem',
self.plugin.nameStrings[u'singular'].toLower(), filename)) 'There was a problem replacing your background, '
'the media file "%s" no longer exists.')) % filename)
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
if item is None: if item is None:

View File

@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_AuthorsDialog(object): class Ui_AuthorsDialog(object):
def setupUi(self, authorsDialog): def setupUi(self, authorsDialog):
@ -65,7 +64,7 @@ class Ui_AuthorsDialog(object):
def retranslateUi(self, authorsDialog): def retranslateUi(self, authorsDialog):
authorsDialog.setWindowTitle( authorsDialog.setWindowTitle(
SongStrings.TypeMaintenance % SongStrings.Author) translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
self.displayLabel.setText( self.displayLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Display name:')) translate('SongsPlugin.AuthorsForm', 'Display name:'))
self.firstNameLabel.setText( self.firstNameLabel.setText(

View File

@ -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.forms import EditVerseForm
from openlp.plugins.songs.lib import SongXML, VerseType from openlp.plugins.songs.lib import SongXML, VerseType
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
from openlp.plugins.songs.lib.ui import SongStrings
from editsongdialog import Ui_EditSongDialog from editsongdialog import Ui_EditSongDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -310,8 +309,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
text = unicode(self.authorsComboBox.currentText()) text = unicode(self.authorsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
UiStrings.AddType % SongStrings.Author, translate('SongsPlugin.EditSongForm', 'Add Author'),
SongStrings.TypeNotExistAdd % SongStrings.Author.toLower(), 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.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
if text.find(u' ') == -1: if text.find(u' ') == -1:
@ -332,8 +332,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.authorsListView.findItems(unicode(author.display_name), if self.authorsListView.findItems(unicode(author.display_name),
QtCore.Qt.MatchExactly): QtCore.Qt.MatchExactly):
critical_error_message_box( critical_error_message_box(
message=SongStrings.TypeInList % message=translate('SongsPlugin.EditSongForm',
SongStrings.Author.toLower()) 'This author is already in the list.'))
else: else:
self.__addAuthorToList(author) self.__addAuthorToList(author)
self.authorsComboBox.setCurrentIndex(0) self.authorsComboBox.setCurrentIndex(0)
@ -367,8 +367,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
text = unicode(self.topicsComboBox.currentText()) text = unicode(self.topicsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
UiStrings.AddType % SongStrings.Topic, translate('SongsPlugin.EditSongForm', 'Add Topic'),
SongStrings.TypeNotExistAdd % SongStrings.Topic.toLower(), 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.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
topic = Topic.populate(name=text) topic = Topic.populate(name=text)
@ -387,8 +388,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.topicsListView.findItems(unicode(topic.name), if self.topicsListView.findItems(unicode(topic.name),
QtCore.Qt.MatchExactly): QtCore.Qt.MatchExactly):
critical_error_message_box( critical_error_message_box(
message=SongStrings.TypeInList % message=translate('SongsPlugin.EditSongForm',
SongStrings.Topic.toLower()) 'This topic is already in the list.'))
else: else:
topic_item = QtGui.QListWidgetItem(unicode(topic.name)) topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole, topic_item.setData(QtCore.Qt.UserRole,
@ -583,8 +584,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
text = unicode(self.songBookComboBox.currentText()) text = unicode(self.songBookComboBox.currentText())
if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0: if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
UiStrings.AddType % SongStrings.SongBook, translate('SongsPlugin.EditSongForm', 'Add Book'),
SongStrings.TypeNotExistAdd % SongStrings.SongBook.toLower(), 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.No,
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes) == QtGui.QMessageBox.Yes:
book = Book.populate(name=text, publisher=u'') book = Book.populate(name=text, publisher=u'')

View File

@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, songBookDialog): def setupUi(self, songBookDialog):
@ -59,7 +58,7 @@ class Ui_SongBookDialog(object):
def retranslateUi(self, songBookDialog): def retranslateUi(self, songBookDialog):
songBookDialog.setWindowTitle( songBookDialog.setWindowTitle(
SongStrings.TypeMaintenance % SongStrings.SongBook) translate('SongsPlugin.SongBookForm', 'Song Book Maintenance'))
self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:')) self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.publisherLabel.setText( self.publisherLabel.setText(
translate('SongsPlugin.SongBookForm', '&Publisher:')) translate('SongsPlugin.SongBookForm', '&Publisher:'))

View File

@ -162,9 +162,10 @@ class SongExportForm(OpenLPWizard):
""" """
Song wizard localisation. Song wizard localisation.
""" """
OpenLPWizard.retranslateUi(self)
self.setWindowTitle( self.setWindowTitle(
translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard')) translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
self.titleLabel.setText(WizardStrings.Header %
translate('OpenLP.Ui', 'Welcome to the Song Export Wizard'))
self.informationLabel.setText( self.informationLabel.setText(
translate('SongsPlugin.ExportWizardForm', 'This wizard will help to' translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
' export your songs to the open and free OpenLyrics worship song ' ' export your songs to the open and free OpenLyrics worship song '
@ -281,7 +282,7 @@ class SongExportForm(OpenLPWizard):
self, songs, unicode(self.directoryLineEdit.text())) self, songs, unicode(self.directoryLineEdit.text()))
if exporter.do_export(): if exporter.do_export():
self.progressLabel.setText( self.progressLabel.setText(
WizardStrings.FinishedType % UiStrings.Export.toLower()) translate('SongsPlugin.SongExportForm', 'Finished export.'))
else: else:
self.progressLabel.setText( self.progressLabel.setText(
translate('SongsPlugin.SongExportForm', translate('SongsPlugin.SongExportForm',

View File

@ -205,12 +205,15 @@ class SongImportForm(OpenLPWizard):
""" """
Song wizard localisation. Song wizard localisation.
""" """
OpenLPWizard.retranslateUi(self)
self.setWindowTitle( self.setWindowTitle(
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
self.informationLabel.setText(WizardStrings.Description % ( self.titleLabel.setText(WizardStrings.Header %
self.direction.toLower(), self.plugin.nameStrings[u'plural'], translate('OpenLP.Ui', 'Welcome to the Song Import Wizard'))
self.direction.toLower())) 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.setTitle(WizardStrings.ImportSelect)
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong) self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel) self.formatLabel.setText(WizardStrings.FormatLabel)
@ -224,7 +227,9 @@ class SongImportForm(OpenLPWizard):
self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI) self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(
SongFormat.SongsOfFellowship, WizardStrings.SoF) 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( self.formatComboBox.setItemText(
SongFormat.EasiSlides, WizardStrings.ES) SongFormat.EasiSlides, WizardStrings.ES)
self.formatComboBox.setItemText( self.formatComboBox.setItemText(
@ -361,8 +366,9 @@ class SongImportForm(OpenLPWizard):
elif source_format == SongFormat.Generic: elif source_format == SongFormat.Generic:
if self.genericFileListWidget.count() == 0: if self.genericFileListWidget.count() == 0:
critical_error_message_box(UiStrings.NFSp, critical_error_message_box(UiStrings.NFSp,
WizardStrings.YouSpecifyFile % translate('SongsPlugin.ImportWizardForm',
WizardStrings.GDP.toLower()) 'You need to add at least one document or '
'presentation file to import from.'))
self.genericAddButton.setFocus() self.genericAddButton.setFocus()
return False return False
elif source_format == SongFormat.EasiSlides: elif source_format == SongFormat.EasiSlides:
@ -417,8 +423,7 @@ class SongImportForm(OpenLPWizard):
filters) filters)
if filenames: if filenames:
listbox.addItems(filenames) listbox.addItems(filenames)
SettingsManager.set_last_dir( SettingsManager.set_last_dir(self.plugin.settingsSection,
self.plugin.settingsSection,
os.path.split(unicode(filenames[0]))[0], 1) os.path.split(unicode(filenames[0]))[0], 1)
def getListOfFiles(self, listbox): def getListOfFiles(self, listbox):
@ -533,8 +538,11 @@ class SongImportForm(OpenLPWizard):
""" """
Get song database files Get song database files
""" """
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.GDP, self.getFileName(
self.genericFileListWidget) translate('SongsPlugin.ImportWizardForm',
'Select Document/Presentation Files'),
self.genericFileListWidget
)
def onGenericRemoveButtonClicked(self): def onGenericRemoveButtonClicked(self):
""" """
@ -572,7 +580,7 @@ class SongImportForm(OpenLPWizard):
""" """
Get SongShow Plus song database files Get SongShow Plus song database files
""" """
self.getFiles(WizardStrings.OpenFileType % WizardStrings.SSP, self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SSP,
self.songShowPlusFileListWidget, u'%s (*.sbsong)' self.songShowPlusFileListWidget, u'%s (*.sbsong)'
% translate('SongsPlugin.ImportWizardForm', % translate('SongsPlugin.ImportWizardForm',
'SongShow Plus Song Files') 'SongShow Plus Song Files')
@ -660,7 +668,7 @@ class SongImportForm(OpenLPWizard):
self.songsOfFellowshipFileListWidget) self.songsOfFellowshipFileListWidget)
) )
elif source_format == SongFormat.Generic: elif source_format == SongFormat.Generic:
# Import a generic document or presentatoin # Import a generic document or presentation
importer = self.plugin.importSongs(SongFormat.Generic, importer = self.plugin.importSongs(SongFormat.Generic,
filenames=self.getListOfFiles(self.genericFileListWidget) filenames=self.getListOfFiles(self.genericFileListWidget)
) )
@ -686,7 +694,7 @@ class SongImportForm(OpenLPWizard):
) )
if importer.do_import(): if importer.do_import():
self.progressLabel.setText( self.progressLabel.setText(
WizardStrings.FinishedType % UiStrings.Import.toLower()) translate('SongsPlugin.SongImportForm', 'Finished import.'))
else: else:
self.progressLabel.setText( self.progressLabel.setText(
translate('SongsPlugin.SongImportForm', translate('SongsPlugin.SongImportForm',

View File

@ -26,7 +26,7 @@
from PyQt4 import QtCore, QtGui 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.core.lib.ui import UiStrings
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
@ -145,9 +145,8 @@ class Ui_SongMaintenanceDialog(object):
QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog) QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
def retranslateUi(self, songMaintenanceDialog): def retranslateUi(self, songMaintenanceDialog):
songMaintenanceDialog.setWindowTitle(SongStrings.TypeMaintenance % songMaintenanceDialog.setWindowTitle(
songMaintenanceDialog.parent().plugin.getString( translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance'))
StringContent.Name)[u'singular'])
self.listItemAuthors.setText(SongStrings.Authors) self.listItemAuthors.setText(SongStrings.Authors)
self.listItemTopics.setText(SongStrings.Topics) self.listItemTopics.setText(SongStrings.Topics)
self.listItemBooks.setText(SongStrings.SongBooks) self.listItemBooks.setText(SongStrings.SongBooks)

View File

@ -32,7 +32,6 @@ from openlp.core.lib import Receiver, translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm 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.db import Author, Book, Topic, Song
from openlp.plugins.songs.lib.ui import SongStrings
from songmaintenancedialog import Ui_SongMaintenanceDialog from songmaintenancedialog import Ui_SongMaintenanceDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -103,20 +102,18 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
else: else:
return -1 return -1
def _deleteItem(self, item_class, list_widget, reset_func, del_type): def _deleteItem(self, item_class, list_widget, reset_func, dlg_title,
dlg_title = UiStrings.DeleteType % del_type del_text, err_text):
item_id = self._getCurrentItemId(list_widget) item_id = self._getCurrentItemId(list_widget)
if item_id != -1: if item_id != -1:
item = self.manager.get_object(item_class, item_id) item = self.manager.get_object(item_class, item_id)
if item and len(item.songs) == 0: if item and len(item.songs) == 0:
if critical_error_message_box(dlg_title, if critical_error_message_box(dlg_title, del_text, self,
SongStrings.SureDeleteType % del_type, True) == QtGui.QMessageBox.Yes:
self, True) == QtGui.QMessageBox.Yes:
self.manager.delete_object(item_class, item.id) self.manager.delete_object(item_class, item.id)
reset_func() reset_func()
else: else:
critical_error_message_box(dlg_title, critical_error_message_box(dlg_title, err_text)
SongStrings.NoDeleteAssigned % del_type)
else: else:
critical_error_message_box(dlg_title, UiStrings.NISs) critical_error_message_box(dlg_title, UiStrings.NISs)
@ -217,11 +214,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
else: else:
critical_error_message_box(SongStrings.CouldNotAdd % critical_error_message_box(
SongStrings.Author.toLower()) message=translate('SongsPlugin.SongMaintenanceForm',
'Could not add your author.'))
else: else:
critical_error_message_box( critical_error_message_box(
SongStrings.ThisTypeExists % SongStrings.Author.toLower()) message=translate('SongsPlugin.SongMaintenanceForm',
'This author already exists.'))
def onTopicAddButtonClick(self): def onTopicAddButtonClick(self):
if self.topicform.exec_(): if self.topicform.exec_():
@ -230,11 +229,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
else: else:
critical_error_message_box(SongStrings.CouldNotAdd % critical_error_message_box(
SongStrings.Topic.toLower()) message=translate('SongsPlugin.SongMaintenanceForm',
'Could not add your topic.'))
else: else:
critical_error_message_box( critical_error_message_box(
SongStrings.ThisTypeExists % SongStrings.Topic.toLower()) message=translate('SongsPlugin.SongMaintenanceForm',
'This topic already exists.'))
def onBookAddButtonClick(self): def onBookAddButtonClick(self):
if self.bookform.exec_(): if self.bookform.exec_():
@ -244,11 +245,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
else: else:
critical_error_message_box(SongStrings.CouldNotAdd % critical_error_message_box(
SongStrings.SongBook.toLower()) message=translate('SongsPlugin.SongMaintenanceForm',
'Could not add your book.'))
else: else:
critical_error_message_box( critical_error_message_box(
SongStrings.ThisTypeExists % SongStrings.SongBook.toLower()) message=translate('SongsPlugin.SongMaintenanceForm',
'This book already exists.'))
def onAuthorEditButtonClick(self): def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.authorsListWidget) 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. Delete the author if the author is not attached to any songs.
""" """
self._deleteItem(Author, self.authorsListWidget, self.resetAuthors, 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): def onTopicDeleteButtonClick(self):
""" """
Delete the Book if the Book is not attached to any songs. Delete the Book if the Book is not attached to any songs.
""" """
self._deleteItem(Topic, self.topicsListWidget, self.resetTopics, 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): def onBookDeleteButtonClick(self):
""" """
Delete the Book if the Book is not attached to any songs. Delete the Book if the Book is not attached to any songs.
""" """
self._deleteItem(Book, self.booksListWidget, self.resetBooks, 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): def onAuthorsListRowChanged(self, row):
""" """

View File

@ -28,7 +28,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
class Ui_TopicsDialog(object): class Ui_TopicsDialog(object):
def setupUi(self, topicsDialog): def setupUi(self, topicsDialog):
@ -53,6 +52,6 @@ class Ui_TopicsDialog(object):
def retranslateUi(self, topicsDialog): def retranslateUi(self, topicsDialog):
topicsDialog.setWindowTitle( topicsDialog.setWindowTitle(
SongStrings.TypeMaintenance % SongStrings.Topic) translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
self.nameLabel.setText( self.nameLabel.setText(
translate('SongsPlugin.TopicsForm', 'Topic name:')) translate('SongsPlugin.TopicsForm', 'Topic name:'))

View File

@ -137,8 +137,8 @@ class SongMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
self.searchTextLabel.setText(u'%s:' % UiStrings.Search) self.searchTextLabel.setText(u'%s:' % UiStrings.Search)
self.searchTextButton.setText(UiStrings.Search) self.searchTextButton.setText(UiStrings.Search)
self.maintenanceAction.setText(SongStrings.TypeMaintenance % self.maintenanceAction.setText(
self.plugin.nameStrings[u'singular']) translate('SongsPlugin.MediaItem', 'Song Maintenance'))
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem', self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books')) 'Maintain the lists of authors, topics and books'))