More string refactoring

This commit is contained in:
Jon Tibble 2011-02-12 04:09:03 +00:00
parent 8d18a51f09
commit a8f16262fc
13 changed files with 54 additions and 64 deletions

View File

@ -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):

View File

@ -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 <version><revision> - 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'

View File

@ -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):

View File

@ -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,

View File

@ -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)

View File

@ -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(

View File

@ -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.

View File

@ -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)

View File

@ -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(

View File

@ -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)

View File

@ -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'<span style="font-size:14pt; font-weight:600;">%s</span>' %
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.'))

View File

@ -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(

View File

@ -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',