replace strings with text_strings

This commit is contained in:
rimach 2010-09-27 20:15:55 +02:00
parent 23099261bd
commit f265c552ea
37 changed files with 9659 additions and 13099 deletions

View File

@ -304,7 +304,7 @@ def expand_tags(text):
from spelltextedit import SpellTextEdit
from eventreceiver import Receiver
from settingsmanager import SettingsManager
from plugin import PluginStatus, Plugin
from plugin import PluginStatus, StringContent, Plugin
from pluginmanager import PluginManager
from settingstab import SettingsTab
from serviceitem import ServiceItem

View File

@ -530,4 +530,4 @@ class MediaManagerItem(QtGui.QWidget):
if self.generateSlideData(service_item, item):
return service_item
else:
return None
return None

View File

@ -129,8 +129,8 @@ class Plugin(QtCore.QObject):
"""
QtCore.QObject.__init__(self)
self.name = name
self.strings = {}
self.setPluginStrings()
self.text_strings = {}
self.setPluginTextStrings()
if version:
self.version = version
self.settingsSection = self.name.lower()
@ -305,13 +305,13 @@ class Plugin(QtCore.QObject):
pass
def getString(self, name):
if name in self.strings:
return self.strings[name]
if name in self.text_strings:
return self.text_strings[name]
else:
# do something here?
return None
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
"""

View File

@ -219,4 +219,4 @@ class PluginManager(object):
for plugin in self.plugins:
if plugin.isActive():
plugin.finalise()
log.info(u'Finalisation Complete for %s ' % plugin.name)
log.info(u'Finalisation Complete for %s ' % plugin.name)

View File

@ -175,19 +175,13 @@ class Ui_MainWindow(object):
QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
# Create the menu items
self.FileNewItem = QtGui.QAction(MainWindow)
self.FileNewItem.setIcon(
self.ServiceManagerContents.toolbar.getIconFromTitle(
translate('OpenLP.MainWindow', 'New Service')))
self.FileNewItem.setIcon(build_icon(u':/general/general_new.png'))
self.FileNewItem.setObjectName(u'FileNewItem')
self.FileOpenItem = QtGui.QAction(MainWindow)
self.FileOpenItem.setIcon(
self.ServiceManagerContents.toolbar.getIconFromTitle(
translate('OpenLP.MainWindow', 'Open Service')))
self.FileOpenItem.setIcon(build_icon(u':/general/general_open.png'))
self.FileOpenItem.setObjectName(u'FileOpenItem')
self.FileSaveItem = QtGui.QAction(MainWindow)
self.FileSaveItem.setIcon(
self.ServiceManagerContents.toolbar.getIconFromTitle(
translate('OpenLP.MainWindow', 'Save Service')))
self.FileSaveItem.setIcon(build_icon(u':/general/general_save.png'))
self.FileSaveItem.setObjectName(u'FileSaveItem')
self.FileSaveAsItem = QtGui.QAction(MainWindow)
self.FileSaveAsItem.setObjectName(u'FileSaveAsItem')

View File

@ -85,4 +85,4 @@ class MediaDockManager(object):
if self.media_dock.widget(dock_index).settingsSection == \
media_item.plugin.name.lower():
self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index)
self.media_dock.removeItem(dock_index)

View File

@ -141,4 +141,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
translate('OpenLP.PluginForm', '%s (Disabled)'))
name_string = self.activePlugin.getString(StringContent.Name)
self.pluginListWidget.currentItem().setText(
status_text % name_string[u'plural'])
status_text % name_string[u'plural'])

View File

@ -82,7 +82,8 @@ class LanguageManager(object):
"""
translator = QtCore.QTranslator()
translator.load(qm_file)
return translator.translate('OpenLP.MainWindow', 'English')
return translator.translate('OpenLP.MainWindow', 'English',
'Please add the name of your language here')
@staticmethod
def get_language():
@ -107,12 +108,13 @@ class LanguageManager(object):
``action``
The language menu option
"""
action_name = u'%s' % action.objectName()
qm_list = LanguageManager.get_qm_list()
if LanguageManager.auto_language:
language = u'[%s]' % qm_list[action_name]
else:
language = u'en'
if action:
action_name = u'%s' % action.objectName()
qm_list = LanguageManager.get_qm_list()
language = u'%s' % qm_list[action_name]
if LanguageManager.auto_language:
language = u'[%s]' % language
QtCore.QSettings().setValue(
u'general/language', QtCore.QVariant(language))
log.info(u'Language file: \'%s\' written to conf file' % language)
@ -129,9 +131,11 @@ class LanguageManager(object):
LanguageManager.__qm_list__ = {}
qm_files = LanguageManager.find_qm_files()
for counter, qmf in enumerate(qm_files):
name = unicode(qmf).split(u'.')[0]
LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1,
LanguageManager.language_name(qmf))] = name
reg_ex = QtCore.QRegExp("^.*i18n/(.*).qm")
if reg_ex.exactMatch(qmf):
name = u'%s' % reg_ex.cap(1)
LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1,
LanguageManager.language_name(qmf))] = name
@staticmethod
def get_qm_list():

View File

@ -102,16 +102,16 @@ class AlertsPlugin(Plugin):
'on the display screen')
return about_text
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('AlertsPlugin', 'Alert'),
u'plural': translate('AlertsPlugin', 'Alerts')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('AlertsPlugin', 'Alerts')
}

View File

@ -155,4 +155,4 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
text = text.replace(u'<>', unicode(self.ParameterEdit.text()))
self.parent.alertsmanager.displayAlert(text)
return True
return False
return False

View File

@ -118,52 +118,52 @@ class BiblePlugin(Plugin):
"""
self.settings_tab.bible_theme = newTheme
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('BiblesPlugin', 'Bible'),
u'plural': translate('BiblesPlugin', 'Bibles')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('BiblesPlugin', 'Bibles')
}
# Middle Header Bar
## Import Button ##
self.strings[StringContent.Import] = {
self.text_strings[StringContent.Import] = {
u'title': translate('BiblesPlugin', 'Import'),
u'tooltip': translate('BiblesPlugin', 'Import a Bible')
}
## New Button ##
self.strings[StringContent.New] = {
self.text_strings[StringContent.New] = {
u'title': translate('BiblesPlugin', 'Add'),
u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
}
## Edit Button ##
self.strings[StringContent.Edit] = {
self.text_strings[StringContent.Edit] = {
u'title': translate('BiblesPlugin', 'Edit'),
u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
}
## Delete Button ##
self.strings[StringContent.Delete] = {
self.text_strings[StringContent.Delete] = {
u'title': translate('BiblesPlugin', 'Delete'),
u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
}
## Preview ##
self.strings[StringContent.Preview] = {
self.text_strings[StringContent.Preview] = {
u'title': translate('BiblesPlugin', 'Preview'),
u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
}
## Live Button ##
self.strings[StringContent.Live] = {
self.text_strings[StringContent.Live] = {
u'title': translate('BiblesPlugin', 'Live'),
u'tooltip': translate('BiblesPlugin', 'Send the selected Bible live')
}
## Add to service Button ##
self.strings[StringContent.Service] = {
self.text_strings[StringContent.Service] = {
u'title': translate('BiblesPlugin', 'Service'),
u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service')
}

View File

@ -98,57 +98,57 @@ class CustomPlugin(Plugin):
custom.theme_name = newTheme
self.custommanager.save_object(custom)
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('CustomsPlugin', 'Custom'),
u'plural': translate('CustomsPlugin', 'Customs')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('CustomsPlugin', 'Customs')
}
# Middle Header Bar
## Import Button ##
self.strings[StringContent.Import] = {
self.text_strings[StringContent.Import] = {
u'title': translate('CustomsPlugin', 'Import'),
u'tooltip': translate('CustomsPlugin', 'Import a Custom')
}
## Load Button ##
self.strings[StringContent.Load] = {
self.text_strings[StringContent.Load] = {
u'title': translate('CustomsPlugin', 'Load'),
u'tooltip': translate('CustomsPlugin', 'Load a new Custom')
}
## New Button ##
self.strings[StringContent.New] = {
self.text_strings[StringContent.New] = {
u'title': translate('CustomsPlugin', 'Add'),
u'tooltip': translate('CustomsPlugin', 'Add a new Custom')
}
## Edit Button ##
self.strings[StringContent.Edit] = {
self.text_strings[StringContent.Edit] = {
u'title': translate('CustomsPlugin', 'Edit'),
u'tooltip': translate('CustomsPlugin', 'Edit the selected Custom')
}
## Delete Button ##
self.strings[StringContent.Delete] = {
self.text_strings[StringContent.Delete] = {
u'title': translate('CustomsPlugin', 'Delete'),
u'tooltip': translate('CustomsPlugin', 'Delete the selected Custom')
}
## Preview ##
self.strings[StringContent.Preview] = {
self.text_strings[StringContent.Preview] = {
u'title': translate('CustomsPlugin', 'Preview'),
u'tooltip': translate('CustomsPlugin', 'Preview the selected Custom')
}
## Live Button ##
self.strings[StringContent.Live] = {
self.text_strings[StringContent.Live] = {
u'title': translate('CustomsPlugin', 'Live'),
u'tooltip': translate('CustomsPlugin', 'Send the selected Custom live')
}
## Add to service Button ##
self.strings[StringContent.Service] = {
self.text_strings[StringContent.Service] = {
u'title': translate('CustomsPlugin', 'Service'),
u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service')
}

View File

@ -181,4 +181,4 @@ class CustomMediaItem(MediaManagerItem):
else:
raw_footer.append(u'')
service_item.raw_footer = raw_footer
return True
return True

View File

@ -58,52 +58,52 @@ class ImagePlugin(Plugin):
'provided by the theme.')
return about_text
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('ImagePlugin', 'Image'),
u'plural': translate('ImagePlugin', 'Images')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('ImagePlugin', 'Images')
}
# Middle Header Bar
## Load Button ##
self.strings[StringContent.Load] = {
self.text_strings[StringContent.Load] = {
u'title': translate('ImagePlugin', 'Load'),
u'tooltip': translate('ImagePlugin', 'Load a new Image')
}
## New Button ##
self.strings[StringContent.New] = {
self.text_strings[StringContent.New] = {
u'title': translate('ImagePlugin', 'Add'),
u'tooltip': translate('ImagePlugin', 'Add a new Image')
}
## Edit Button ##
self.strings[StringContent.Edit] = {
self.text_strings[StringContent.Edit] = {
u'title': translate('ImagePlugin', 'Edit'),
u'tooltip': translate('ImagePlugin', 'Edit the selected Image')
}
## Delete Button ##
self.strings[StringContent.Delete] = {
self.text_strings[StringContent.Delete] = {
u'title': translate('ImagePlugin', 'Delete'),
u'tooltip': translate('ImagePlugin', 'Delete the selected Image')
}
## Preview ##
self.strings[StringContent.Preview] = {
self.text_strings[StringContent.Preview] = {
u'title': translate('ImagePlugin', 'Preview'),
u'tooltip': translate('ImagePlugin', 'Preview the selected Image')
}
## Live Button ##
self.strings[StringContent.Live] = {
self.text_strings[StringContent.Live] = {
u'title': translate('ImagePlugin', 'Live'),
u'tooltip': translate('ImagePlugin', 'Send the selected Image live')
}
## Add to service Button ##
self.strings[StringContent.Service] = {
self.text_strings[StringContent.Service] = {
u'title': translate('ImagePlugin', 'Service'),
u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service')
}

View File

@ -190,4 +190,4 @@ class ImageMediaItem(MediaManagerItem):
self.resetButton.setVisible(True)
def onPreviewClick(self):
MediaManagerItem.onPreviewClick(self)
MediaManagerItem.onPreviewClick(self)

View File

@ -157,4 +157,4 @@ class MediaMediaItem(MediaManagerItem):
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
item_name.setIcon(build_icon(img))
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.listView.addItem(item_name)
self.listView.addItem(item_name)

View File

@ -77,52 +77,52 @@ class MediaPlugin(Plugin):
'<br />The media plugin provides playback of audio and video.')
return about_text
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('MediaPlugin', 'Media'),
u'plural': translate('MediaPlugin', 'Media')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('MediaPlugin', 'Media')
}
# Middle Header Bar
## Load Button ##
self.strings[StringContent.Load] = {
self.text_strings[StringContent.Load] = {
u'title': translate('MediaPlugin', 'Load'),
u'tooltip': translate('MediaPlugin', 'Load a new Media')
}
## New Button ##
self.strings[StringContent.New] = {
self.text_strings[StringContent.New] = {
u'title': translate('MediaPlugin', 'Add'),
u'tooltip': translate('MediaPlugin', 'Add a new Media')
}
## Edit Button ##
self.strings[StringContent.Edit] = {
self.text_strings[StringContent.Edit] = {
u'title': translate('MediaPlugin', 'Edit'),
u'tooltip': translate('MediaPlugin', 'Edit the selected Media')
}
## Delete Button ##
self.strings[StringContent.Delete] = {
self.text_strings[StringContent.Delete] = {
u'title': translate('MediaPlugin', 'Delete'),
u'tooltip': translate('MediaPlugin', 'Delete the selected Media')
}
## Preview ##
self.strings[StringContent.Preview] = {
self.text_strings[StringContent.Preview] = {
u'title': translate('MediaPlugin', 'Preview'),
u'tooltip': translate('MediaPlugin', 'Preview the selected Media')
}
## Live Button ##
self.strings[StringContent.Live] = {
self.text_strings[StringContent.Live] = {
u'title': translate('MediaPlugin', 'Live'),
u'tooltip': translate('MediaPlugin', 'Send the selected Media live')
}
## Add to service Button ##
self.strings[StringContent.Service] = {
self.text_strings[StringContent.Service] = {
u'title': translate('MediaPlugin', 'Service'),
u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service')
}

View File

@ -293,4 +293,4 @@ class PresentationMediaItem(MediaManagerItem):
if self.controllers[controller].enabled():
if filetype in self.controllers[controller].alsosupports:
return controller
return None
return None

View File

@ -145,42 +145,42 @@ class PresentationPlugin(Plugin):
'available to the user in a drop down box.')
return about_text
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('PresentationPlugin', 'Presentation'),
u'plural': translate('PresentationPlugin', 'Presentations')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('PresentationPlugin', 'Presentations')
}
# Middle Header Bar
## Load Button ##
self.strings[StringContent.Load] = {
self.text_strings[StringContent.Load] = {
u'title': translate('PresentationPlugin', 'Load'),
u'tooltip': translate('PresentationPlugin', 'Load a new Presentation')
}
## Delete Button ##
self.strings[StringContent.Delete] = {
self.text_strings[StringContent.Delete] = {
u'title': translate('PresentationPlugin', 'Delete'),
u'tooltip': translate('PresentationPlugin', 'Delete the selected Presentation')
}
## Preview ##
self.strings[StringContent.Preview] = {
self.text_strings[StringContent.Preview] = {
u'title': translate('PresentationPlugin', 'Preview'),
u'tooltip': translate('PresentationPlugin', 'Preview the selected Presentation')
}
## Live Button ##
self.strings[StringContent.Live] = {
self.text_strings[StringContent.Live] = {
u'title': translate('PresentationPlugin', 'Live'),
u'tooltip': translate('PresentationPlugin', 'Send the selected Presentation live')
}
## Add to service Button ##
self.strings[StringContent.Service] = {
self.text_strings[StringContent.Service] = {
u'title': translate('PresentationPlugin', 'Service'),
u'tooltip': translate('PresentationPlugin', 'Add the selected Presentation to the service')
}

View File

@ -78,16 +78,16 @@ class RemotesPlugin(Plugin):
'browser or through the remote API.')
return about_text
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('RemotePlugin', 'Remote'),
u'plural': translate('RemotePlugin', 'Remotes')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('RemotePlugin', 'Remotes')
}

View File

@ -368,4 +368,4 @@ class SongMediaItem(MediaManagerItem):
service_item.audit = [
song.title, author_audit, song.copyright, unicode(song.ccli_number)
]
return True
return True

0
openlp/plugins/songs/lib/test/test3.opensong Executable file → Normal file
View File

View File

@ -149,47 +149,47 @@ class SongsPlugin(Plugin):
importer.register(self.mediaItem.import_wizard)
return importer
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('SongsPlugin', 'Song'),
u'plural': translate('SongsPlugin', 'Songs')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('SongsPlugin', 'Songs')
}
# Middle Header Bar
## New Button ##
self.strings[StringContent.New] = {
self.text_strings[StringContent.New] = {
u'title': translate('SongsPlugin', 'Add'),
u'tooltip': translate('SongsPlugin', 'Add a new Song')
}
## Edit Button ##
self.strings[StringContent.Edit] = {
self.text_strings[StringContent.Edit] = {
u'title': translate('SongsPlugin', 'Edit'),
u'tooltip': translate('SongsPlugin', 'Edit the selected Song')
}
## Delete Button ##
self.strings[StringContent.Delete] = {
self.text_strings[StringContent.Delete] = {
u'title': translate('SongsPlugin', 'Delete'),
u'tooltip': translate('SongsPlugin', 'Delete the selected Song')
}
## Preview ##
self.strings[StringContent.Preview] = {
self.text_strings[StringContent.Preview] = {
u'title': translate('SongsPlugin', 'Preview'),
u'tooltip': translate('SongsPlugin', 'Preview the selected Song')
}
## Live Button ##
self.strings[StringContent.Live] = {
self.text_strings[StringContent.Live] = {
u'title': translate('SongsPlugin', 'Live'),
u'tooltip': translate('SongsPlugin', 'Send the selected Song live')
}
## Add to service Button ##
self.strings[StringContent.Service] = {
self.text_strings[StringContent.Service] = {
u'title': translate('SongsPlugin', 'Service'),
u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service')
}

View File

@ -163,16 +163,16 @@ class SongUsagePlugin(Plugin):
'services.')
return about_text
def setPluginStrings(self):
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.strings[StringContent.Name] = {
self.text_strings[StringContent.Name] = {
u'singular': translate('SongUsagePlugin', 'SongUsage'),
u'plural': translate('SongUsagePlugin', 'SongUsage')
}
## Name for MediaDockManager, SettingsManager ##
self.strings[StringContent.VisibleName] = {
self.text_strings[StringContent.VisibleName] = {
u'title': translate('SongUsagePlugin', 'SongUsage')
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Categories=AudioVideo;
Comment[de]=