diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 99b266e6e..6ce04af75 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -40,12 +40,14 @@ class UiStrings(object): """ # These strings should need a good reason to be retranslated elsewhere. # Should some/more/less of these have an & attached? + About = translate('OpenLP.Ui', 'About') Add = translate('OpenLP.Ui', '&Add') AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.')) AddSelectService = unicode(translate('OpenLP.Ui', 'Add the selected %s to the service.')) Advanced = translate('OpenLP.Ui', 'Advanced') AllFiles = translate('OpenLP.Ui', 'All Files') + Browse = translate('OpenLP.Ui', 'Browse...') CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.')) Delete = translate('OpenLP.Ui', '&Delete') DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.')) @@ -57,6 +59,7 @@ class UiStrings(object): Error = translate('OpenLP.Ui', 'Error') Export = translate('OpenLP.Ui', 'Export') ExportType = unicode(translate('OpenLP.Ui', 'Export %s')) + Image = translate('OpenLP.Ui', 'Image') Import = translate('OpenLP.Ui', 'Import') ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) Live = translate('OpenLP.Ui', 'Live') @@ -80,6 +83,7 @@ class UiStrings(object): ResetBG = translate('OpenLP.Ui', 'Reset Background') ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background') SaveType = unicode(translate('OpenLP.Ui', 'Save %s')) + Search = translate('OpenLP.Ui', 'Search') SendSelectLive = unicode(translate('OpenLP.Ui', 'Send the selected %s live.')) Service = translate('OpenLP.Ui', 'Service') @@ -90,6 +94,7 @@ class UiStrings(object): ToggleType = unicode(translate('OpenLP.Ui', 'Toggle %s')) ToggleVisibility = unicode(translate('OpenLP.Ui', 'Toggle the visibility of the %s.')) + Version = translate('OpenLP.Ui', 'Version') def add_welcome_page(parent, image): diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index bb09ab91f..19a61b3f8 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate +from openlp.core.lib.ui import UiStrings class Ui_AboutDialog(object): def setupUi(self, aboutDialog): @@ -86,8 +87,7 @@ class Ui_AboutDialog(object): QtCore.QMetaObject.connectSlotsByName(aboutDialog) def retranslateUi(self, aboutDialog): - aboutDialog.setWindowTitle(translate('OpenLP.AboutForm', - 'About OpenLP')) + aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings.About) self.aboutTextEdit.setPlainText(translate('OpenLP.AboutForm', 'OpenLP - Open Source Lyrics ' 'Projection\n' @@ -105,8 +105,7 @@ class Ui_AboutDialog(object): 'consider contributing by using the button below.' )) self.aboutNotebook.setTabText( - self.aboutNotebook.indexOf(self.aboutTab), - translate('OpenLP.AboutForm', 'About')) + self.aboutNotebook.indexOf(self.aboutTab), UiStrings.About) self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm', 'Project Lead\n' ' Raoul "superfly" Snyman\n' diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 918335b2e..39fec1f9d 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -135,7 +135,7 @@ class AdvancedTab(SettingsTab): # self.sharedCheckBox.setText( # translate('AdvancedTab', 'Enable a shared data location')) # self.sharedLabel.setText(translate('AdvancedTab', 'Store location:')) -# self.sharedPushButton.setText(translate('AdvancedTab', 'Browse...')) +# self.sharedPushButton.setText(UiStrings.Browse) # self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases')) def load(self): diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index 74b2d36c0..84f897a65 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -25,7 +25,9 @@ ############################################################################### from PyQt4 import QtCore, QtGui + from openlp.core.lib import translate +from openlp.core.lib.ui import UiStrings class Ui_PluginViewDialog(object): def setupUi(self, pluginViewDialog): @@ -76,10 +78,8 @@ class Ui_PluginViewDialog(object): translate('OpenLP.PluginForm', 'Plugin List')) self.pluginInfoGroupBox.setTitle( translate('OpenLP.PluginForm', 'Plugin Details')) - self.versionLabel.setText( - translate('OpenLP.PluginForm', 'Version:')) - self.aboutLabel.setText( - translate('OpenLP.PluginForm', 'About:')) + self.versionLabel.setText(u'%s:' % UiStrings.Version) + self.aboutLabel.setText(u'%s:' % UiStrings.About) self.statusLabel.setText( translate('OpenLP.PluginForm', 'Status:')) self.statusComboBox.setItemText(0, diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 744da7b46..9041b47a7 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -110,8 +110,7 @@ class ServiceManager(QtGui.QWidget): translate('OpenLP.ServiceManager', 'Save this service'), self.saveFile) self.toolbar.addSeparator() - self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager', - 'Theme:'), self) + self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings.Theme, self) self.themeLabel.setMargin(3) self.themeLabel.setObjectName(u'themeLabel') self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel) diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 38dd9f1dc..281e216d3 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, build_icon -from openlp.core.lib.ui import add_welcome_page, create_valign_combo +from openlp.core.lib.ui import UiStrings, add_welcome_page, create_valign_combo class Ui_ThemeWizard(object): def setupUi(self, themeWizard): @@ -421,8 +421,7 @@ class Ui_ThemeWizard(object): translate('OpenLP.ThemeWizard', 'Solid Color')) self.backgroundComboBox.setItemText(1, translate('OpenLP.ThemeWizard', 'Gradient')) - self.backgroundComboBox.setItemText(2, - translate('OpenLP.ThemeWizard', 'Image')) + self.backgroundComboBox.setItemText(2, UiStrings.Image) self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:')) self.gradientStartLabel.setText( translate(u'OpenLP.ThemeWizard', 'Starting color:')) @@ -440,7 +439,7 @@ class Ui_ThemeWizard(object): translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right')) self.gradientComboBox.setItemText(4, translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right')) - self.imageLabel.setText(translate('OpenLP.ThemeWizard', 'Image:')) + self.imageLabel.setText(u'%s:' % UiStrings.Image) self.mainAreaPage.setTitle( translate('OpenLP.ThemeWizard', 'Main Area Font Details')) self.mainAreaPage.setSubTitle( diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index fff1e2552..1599b4738 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -31,7 +31,8 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, Receiver, SettingsManager, translate +from openlp.core.lib import build_icon, Receiver, SettingsManager, translate, \ + StringContent from openlp.core.lib.ui import UiStrings, add_welcome_page log = logging.getLogger(__name__) @@ -60,10 +61,12 @@ class OpenLPWizard(QtGui.QWizard): Generic OpenLP wizard to provide generic functionality and a unified look and feel. """ - def __init__(self, parent, plugin, name, image): + def __init__(self, parent, plugin, name, image, direction): QtGui.QWizard.__init__(self, parent) self.plugin = plugin self.setObjectName(name) + self.itemType = self.plugin.getString(StringContent.Name) + self.direction = direction self.openIcon = build_icon(u':/general/general_open.png') self.deleteIcon = build_icon(u':/general/general_delete.png') self.finishButton = self.button(QtGui.QWizard.FinishButton) @@ -90,6 +93,13 @@ class OpenLPWizard(QtGui.QWizard): self.retranslateUi() QtCore.QMetaObject.connectSlotsByName(self) + def retranslateUi(self): + """ + Provides generic wizard localisation + """ + self.titleLabel.setText(WizardStrings.Welcome % + (self.itemType[u'singular'], self.direction)) + def registerFields(self): """ Hook method for wizards to register any fields they need. diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index d97299a42..115d30bfe 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -88,7 +88,7 @@ class BibleImportForm(OpenLPWizard): self.manager = manager self.web_bible_list = {} OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleImportWizard', - u':/wizards/wizard_importbible.bmp') + u':/wizards/wizard_importbible.bmp', UiStrings.Import) def setupUi(self, image): """ @@ -361,15 +361,12 @@ class BibleImportForm(OpenLPWizard): """ Allow for localisation of the bible import wizard. """ + OpenLPWizard.retranslateUi(self) self.setWindowTitle( translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard')) - self.titleLabel.setText(WizardStrings.Welcome % ( - self.plugin.getString(StringContent.Name)[u'singular'], - UiStrings.Import)) self.informationLabel.setText(WizardStrings.Description % ( - UiStrings.Import.toLower(), - self.plugin.getString(StringContent.Name)[u'plural'], - UiStrings.Import.toLower())) + self.direction.toLower(), self.itemType[u'plural'], + self.direction.toLower())) self.selectPage.setTitle(WizardStrings.ImportSelect) self.selectPage.setSubTitle(WizardStrings.ImportSelectLong) self.formatLabel.setText(WizardStrings.FormatLabel) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 58dc11a6a..a0fdc801a 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -227,20 +227,17 @@ class BibleMediaItem(MediaManagerItem): def retranslateUi(self): log.debug(u'retranslateUi') - self.quickVersionLabel.setText( - translate('BiblesPlugin.MediaItem', 'Version:')) + self.quickVersionLabel.setText(u'%s:' % UiStrings.Version) self.quickSecondLabel.setText( translate('BiblesPlugin.MediaItem', 'Second:')) self.quickSearchTypeLabel.setText( translate('BiblesPlugin.MediaItem', 'Search type:')) self.quickSearchLabel.setText( translate('BiblesPlugin.MediaItem', 'Find:')) - self.quickSearchButton.setText( - translate('BiblesPlugin.MediaItem', 'Search')) + self.quickSearchButton.setText(UiStrings.Search) self.quickClearLabel.setText( translate('BiblesPlugin.MediaItem', 'Results:')) - self.advancedVersionLabel.setText( - translate('BiblesPlugin.MediaItem', 'Version:')) + self.advancedVersionLabel.setText(u'%s:' % UiStrings.Version) self.advancedSecondLabel.setText( translate('BiblesPlugin.MediaItem', 'Second:')) self.advancedBookLabel.setText( @@ -255,8 +252,7 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'To:')) self.advancedClearLabel.setText( translate('BiblesPlugin.MediaItem', 'Results:')) - self.advancedSearchButton.setText( - translate('BiblesPlugin.MediaItem', 'Search')) + self.advancedSearchButton.setText(UiStrings.Search) self.quickSearchComboBox.addItem( translate('BiblesPlugin.MediaItem', 'Verse Search')) self.quickSearchComboBox.addItem( diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 5f95a239c..2a66038ef 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -126,7 +126,7 @@ class ImageMediaItem(MediaManagerItem): items = self.listView.selectedIndexes() if items: service_item.title = unicode( - translate('ImagePlugin.MediaItem', 'Images')) + self.plugin.getString(StringContent.Name)[u'plural']) service_item.add_capability(ItemCapabilities.AllowsMaintain) service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsLoop) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 9e528a969..86b4e448c 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -56,9 +56,8 @@ class SongExportForm(OpenLPWizard): ``plugin`` The songs plugin. """ - self.plugin = plugin OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard', - u':/wizards/wizard_exportsong.bmp') + u':/wizards/wizard_exportsong.bmp', UiStrings.Export) self.stop_export_flag = False QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_export) @@ -163,12 +162,9 @@ class SongExportForm(OpenLPWizard): """ Song wizard localisation. """ + OpenLPWizard.retranslateUi(self) self.setWindowTitle( translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard')) - self.titleLabel.setText( - u'%s' % - translate('SongsPlugin.ExportWizardForm', - '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 ' @@ -177,15 +173,14 @@ class SongExportForm(OpenLPWizard): translate('SongsPlugin.ExportWizardForm', 'Select Songs')) self.availableSongsPage.setSubTitle( translate('SongsPlugin.ExportWizardForm', - 'Check the songs, you want to export.')) - self.searchLabel.setText( - translate('SongsPlugin.ExportWizardForm', 'Search:')) + 'Check the songs you want to export.')) + self.searchLabel.setText(u'%s:' % UiStrings.Search) self.uncheckButton.setText( translate('SongsPlugin.ExportWizardForm', 'Uncheck All')) self.checkButton.setText( translate('SongsPlugin.ExportWizardForm', 'Check All')) self.exportSongPage.setTitle( - translate('SongsPlugin.ExportWizardForm', 'Select Directory')) + translate('SongsPlugin.ExportWizardForm', 'Select Directory')) self.exportSongPage.setSubTitle( translate('SongsPlugin.ExportWizardForm', 'Select the directory you want the songs to be saved.')) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index b8dd2975a..99ff63b3d 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -56,7 +56,7 @@ class SongImportForm(OpenLPWizard): The songs plugin. """ OpenLPWizard.__init__(self, parent, plugin, u'songImportWizard', - u':/wizards/wizard_importsong.bmp') + u':/wizards/wizard_importsong.bmp', UiStrings.Import) def setupUi(self, image): """ @@ -197,15 +197,12 @@ class SongImportForm(OpenLPWizard): """ Song wizard localisation. """ + OpenLPWizard.retranslateUi(self) self.setWindowTitle( translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) - self.titleLabel.setText(WizardStrings.Welcome % ( - self.plugin.getString(StringContent.Name)[u'singular'], - UiStrings.Import)) self.informationLabel.setText(WizardStrings.Description % ( - UiStrings.Import.toLower(), - self.plugin.getString(StringContent.Name)[u'plural'], - UiStrings.Import.toLower())) + self.direction.toLower(), self.itemType[u'plural'], + self.direction.toLower())) self.sourcePage.setTitle(WizardStrings.ImportSelect) self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong) self.formatLabel.setText(WizardStrings.FormatLabel) @@ -235,12 +232,10 @@ class SongImportForm(OpenLPWizard): # translate('SongsPlugin.ImportWizardForm', 'CSV')) self.openLP2FilenameLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Filename:')) - self.openLP2BrowseButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.openLP2BrowseButton.setText(UiStrings.Browse) self.openLP1FilenameLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Filename:')) - self.openLP1BrowseButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.openLP1BrowseButton.setText(UiStrings.Browse) self.openLP1DisabledLabel.setText( translate('SongsPlugin.ImportWizardForm', 'The openlp.org 1.x ' 'importer has been disabled due to a missing Python module. If ' @@ -285,20 +280,17 @@ class SongImportForm(OpenLPWizard): 'find OpenOffice.org on your computer.')) self.easiSlidesFilenameLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Filename:')) - self.easiSlidesBrowseButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.easiSlidesBrowseButton.setText(UiStrings.Browse) self.ewFilenameLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Filename:')) - self.ewBrowseButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.ewBrowseButton.setText(UiStrings.Browse) self.songBeamerAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.songBeamerRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) # self.csvFilenameLabel.setText( # translate('SongsPlugin.ImportWizardForm', 'Filename:')) -# self.csvBrowseButton.setText( -# translate('SongsPlugin.ImportWizardForm', 'Browse...')) +# self.csvBrowseButton.setText(UiStrings.Browse) self.progressPage.setTitle( translate('SongsPlugin.ImportWizardForm', 'Importing')) self.progressPage.setSubTitle( diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 99a827a4e..b95a28c74 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -125,10 +125,8 @@ class SongMediaItem(MediaManagerItem): QtCore.QVariant(u'True')).toBool() def retranslateUi(self): - self.searchTextLabel.setText( - translate('SongsPlugin.MediaItem', 'Search:')) - self.searchTextButton.setText( - translate('SongsPlugin.MediaItem', 'Search')) + self.searchTextLabel.setText(u'%s:' % UiStrings.Search) + self.searchTextButton.setText(UiStrings.Search) self.maintenanceAction.setText(SongStrings.TypeMaintenance % self.plugin.getString(StringContent.Name)[u'singular']) self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',