Moved i18n to resources (better place for it).

Fixed up openlp-get-strings.py to use the new TS file location.
Started fixing up the trUtf8() strings.
This commit is contained in:
Raoul Snyman 2009-11-24 21:51:41 +02:00
parent c7b5ddf082
commit 4d715a3d5d
7 changed files with 69 additions and 69 deletions

View File

@ -83,14 +83,14 @@ def write_file(filename):
file.close() file.close()
def main(): def main():
start_dir = u'.' start_dir = os.path.abspath(u'.')
for root, dirs, files in os.walk(start_dir): for root, dirs, files in os.walk(start_dir):
for file in files: for file in files:
if file.endswith(u'.py'): if file.endswith(u'.py'):
print u'Parsing "%s"' % file print u'Parsing "%s"' % file
parse_file(os.path.join(root, file)) parse_file(os.path.join(root, file))
print u'Generating TS file...', print u'Generating TS file...',
write_file(os.path.join(start_dir, u'i18n', u'openlp_en.ts')) write_file(os.path.join(start_dir, u'..', u'resources', u'i18n', u'openlp_en.ts'))
print u'done.' print u'done.'
if __name__ == u'__main__': if __name__ == u'__main__':

View File

@ -211,21 +211,21 @@ class MediaManagerItem(QtGui.QWidget):
if self.hasFileIcon: if self.hasFileIcon:
self.addToolbarButton( self.addToolbarButton(
u'Load %s' % self.PluginNameShort, u'Load %s' % self.PluginNameShort,
u'%s %s' % (self.trUtf8(u'Load a new'), self.PluginNameVisible), u'%s %s' % (self.trUtf8('Load a new'), self.PluginNameVisible),
u':%s_load.png' % self.IconPath, self.onFileClick, u':%s_load.png' % self.IconPath, self.onFileClick,
u'%sFileItem' % self.PluginNameShort) u'%sFileItem' % self.PluginNameShort)
## New Button ## ## New Button ##
if self.hasNewIcon: if self.hasNewIcon:
self.addToolbarButton( self.addToolbarButton(
u'New %s' % self.PluginNameShort, u'New %s' % self.PluginNameShort,
u'%s %s' % (self.trUtf8(u'Add a new'), self.PluginNameVisible), u'%s %s' % (self.trUtf8('Add a new'), self.PluginNameVisible),
u':%s_new.png' % self.IconPath, self.onNewClick, u':%s_new.png' % self.IconPath, self.onNewClick,
u'%sNewItem' % self.PluginNameShort) u'%sNewItem' % self.PluginNameShort)
## Edit Button ## ## Edit Button ##
if self.hasEditIcon: if self.hasEditIcon:
self.addToolbarButton( self.addToolbarButton(
u'Edit %s' % self.PluginNameShort, u'Edit %s' % self.PluginNameShort,
u'%s %s' % (self.trUtf8(u'Edit the selected'), u'%s %s' % (self.trUtf8('Edit the selected'),
self.PluginNameVisible), self.PluginNameVisible),
u':%s_edit.png' % self.IconPath, self.onEditClick, u':%s_edit.png' % self.IconPath, self.onEditClick,
u'%sEditItem' % self.PluginNameShort) u'%sEditItem' % self.PluginNameShort)
@ -233,7 +233,7 @@ class MediaManagerItem(QtGui.QWidget):
if self.hasDeleteIcon: if self.hasDeleteIcon:
self.addToolbarButton( self.addToolbarButton(
u'Delete %s' % self.PluginNameShort, u'Delete %s' % self.PluginNameShort,
self.trUtf8(u'Delete the selected item'), self.trUtf8('Delete the selected item'),
u':%s_delete.png' % self.IconPath, self.onDeleteClick, u':%s_delete.png' % self.IconPath, self.onDeleteClick,
u'%sDeleteItem' % self.PluginNameShort) u'%sDeleteItem' % self.PluginNameShort)
## Separator Line ## ## Separator Line ##
@ -241,19 +241,19 @@ class MediaManagerItem(QtGui.QWidget):
## Preview ## ## Preview ##
self.addToolbarButton( self.addToolbarButton(
u'Preview %s' % self.PluginNameShort, u'Preview %s' % self.PluginNameShort,
self.trUtf8(u'Preview the selected item'), self.trUtf8('Preview the selected item'),
u':/system/system_preview.png', self.onPreviewClick, u':/system/system_preview.png', self.onPreviewClick,
u'PreviewItem') u'PreviewItem')
## Live Button ## ## Live Button ##
self.addToolbarButton( self.addToolbarButton(
u'Go Live', u'Go Live',
self.trUtf8(u'Send the selected item live'), self.trUtf8('Send the selected item live'),
u':/system/system_live.png', self.onLiveClick, u':/system/system_live.png', self.onLiveClick,
u'LiveItem') u'LiveItem')
## Add to service Button ## ## Add to service Button ##
self.addToolbarButton( self.addToolbarButton(
u'%s %s %s' % (u'Add', self.PluginNameShort, u'to Service'), u'Add %s to Service' % self.PluginNameShort,
self.trUtf8(u'Add the selected item(s) to the service'), self.trUtf8('Add the selected item(s) to the service'),
u':/system/system_add.png', self.onAddClick, u':/system/system_add.png', self.onAddClick,
u'%sAddServiceItem' % self.PluginNameShort) u'%sAddServiceItem' % self.PluginNameShort)
@ -276,22 +276,22 @@ class MediaManagerItem(QtGui.QWidget):
self.ListView.addAction( self.ListView.addAction(
contextMenuAction( contextMenuAction(
self.ListView, u':%s_new.png' % self.IconPath, self.ListView, u':%s_new.png' % self.IconPath,
u'%s %s' % (self.trUtf8(u'&Edit'), self.PluginNameVisible), u'%s %s' % (self.trUtf8('&Edit'), self.PluginNameVisible),
self.onEditClick)) self.onEditClick))
self.ListView.addAction(contextMenuSeparator(self.ListView)) self.ListView.addAction(contextMenuSeparator(self.ListView))
self.ListView.addAction( self.ListView.addAction(
contextMenuAction( contextMenuAction(
self.ListView, u':/system/system_preview.png', self.ListView, u':/system/system_preview.png',
u'%s %s' % (self.trUtf8(u'&Preview'), self.PluginNameVisible), u'%s %s' % (self.trUtf8('&Preview'), self.PluginNameVisible),
self.onPreviewClick)) self.onPreviewClick))
self.ListView.addAction( self.ListView.addAction(
contextMenuAction( contextMenuAction(
self.ListView, u':/system/system_live.png', self.ListView, u':/system/system_live.png',
self.trUtf8(u'&Show Live'), self.onLiveClick)) self.trUtf8('&Show Live'), self.onLiveClick))
self.ListView.addAction( self.ListView.addAction(
contextMenuAction( contextMenuAction(
self.ListView, u':/system/system_add.png', self.ListView, u':/system/system_add.png',
self.trUtf8(u'&Add to Service'), self.onAddClick)) self.trUtf8('&Add to Service'), self.onAddClick))
QtCore.QObject.connect( QtCore.QObject.connect(
self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onPreviewClick) self.onPreviewClick)
@ -360,8 +360,8 @@ class MediaManagerItem(QtGui.QWidget):
def onPreviewClick(self): def onPreviewClick(self):
if not self.ListView.selectedIndexes() and not self.remoteTriggered: if not self.ListView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
self.trUtf8(u'No items selected...'), self.trUtf8('No items selected...'),
self.trUtf8(u'You must select one or more items')) self.trUtf8('You must select one or more items'))
log.debug(self.PluginNameShort + u' Preview Requested') log.debug(self.PluginNameShort + u' Preview Requested')
service_item = self.buildServiceItem() service_item = self.buildServiceItem()
if service_item: if service_item:
@ -371,8 +371,8 @@ class MediaManagerItem(QtGui.QWidget):
def onLiveClick(self): def onLiveClick(self):
if not self.ListView.selectedIndexes(): if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
self.trUtf8(u'No items selected...'), self.trUtf8('No items selected...'),
self.trUtf8(u'You must select one or more items')) self.trUtf8('You must select one or more items'))
log.debug(self.PluginNameShort + u' Live Requested') log.debug(self.PluginNameShort + u' Live Requested')
service_item = self.buildServiceItem() service_item = self.buildServiceItem()
if service_item: if service_item:
@ -382,8 +382,8 @@ class MediaManagerItem(QtGui.QWidget):
def onAddClick(self): def onAddClick(self):
if not self.ListView.selectedIndexes() and not self.remoteTriggered: if not self.ListView.selectedIndexes() and not self.remoteTriggered:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
self.trUtf8(u'No items selected...'), self.trUtf8('No items selected...'),
self.trUtf8(u'You must select one or more items')) self.trUtf8('You must select one or more items'))
log.debug(self.PluginNameShort + u' Add Requested') log.debug(self.PluginNameShort + u' Add Requested')
service_item = self.buildServiceItem() service_item = self.buildServiceItem()
if service_item: if service_item:

View File

@ -69,9 +69,9 @@ class TestMediaManager:
i2.addToolbar() i2.addToolbar()
i2.addToolbarButton(u'Test2', u'Test2', None) i2.addToolbarButton(u'Test2', u'Test2', None)
self.MediaToolBox.setItemText( self.MediaToolBox.setItemText(
self.MediaToolBox.indexOf(i1), self.trUtf8(u'Item1')) self.MediaToolBox.indexOf(i1), self.trUtf8('Item1'))
self.MediaToolBox.setItemText( self.MediaToolBox.setItemText(
self.MediaToolBox.indexOf(i2), self.trUtf8(u'Item2')) self.MediaToolBox.indexOf(i2), self.trUtf8('Item2'))
log.info(u'Show window') log.info(u'Show window')
self.main_window.show() self.main_window.show()
log.info(u'End') log.info(u'End')

View File

@ -148,50 +148,50 @@ class AboutForm(QtGui.QDialog):
""" """
Set up translation Set up translation
""" """
AboutForm.setWindowTitle(self.trUtf8(u'About openlp.org')) AboutForm.setWindowTitle(self.trUtf8('About openlp.org'))
self.CopyrightLabel.setText( self.CopyrightLabel.setText(
self.trUtf8(u'Copyright \xa9 2004-2009 openlp.org Foundation')) self.trUtf8('Copyright \u00a9 2004-2009 openlp.org Foundation'))
self.AboutAuthors.setText(self.trUtf8( self.AboutAuthors.setText(self.trUtf8(
u'openlp.org is written and maintained by volunteers. If you would ' 'openlp.org is written and maintained by volunteers. If you would '
u'like to see more free Christian software being written, please ' 'like to see more free Christian software being written, please '
u'consider contributing by using the button below.')) 'consider contributing by using the button below.'))
self.License1Label.setText(self.trUtf8( self.License1Label.setText(self.trUtf8(
u'This program is free software; you can redistribute it and/or ' 'This program is free software; you can redistribute it and/or '
u'modify it under the terms of the GNU General Public License as ' 'modify it under the terms of the GNU General Public License as '
u'published by the Free Software Foundation; either version 2 of ' 'published by the Free Software Foundation; either version 2 of '
u'the License, or (at your option) any later version.')) 'the License, or (at your option) any later version.'))
self.License2Label.setText(self.trUtf8( self.License2Label.setText(self.trUtf8(
u'You should have received a copy of the GNU General Public ' 'You should have received a copy of the GNU General Public '
u'License along with this program; if not, write to the Free ' 'License along with this program; if not, write to the Free '
u'Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ' 'Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, '
u'MA 02111-1307 USA.')) 'MA 02111-1307 USA.'))
self.License3Label.setText(self.trUtf8( self.License3Label.setText(self.trUtf8(
u'This program is distributed in the hope that it will be useful, ' 'This program is distributed in the hope that it will be useful, '
u'but WITHOUT ANY WARRANTY; without even the implied warranty of ' 'but WITHOUT ANY WARRANTY; without even the implied warranty of '
u'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ' 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU '
u'General Public License for more details.')) 'General Public License for more details.'))
self.License4Label.setText(unicode(self.trUtf8( self.License4Label.setText(unicode(self.trUtf8(
u'Software version %s, Build %s')) % 'Software version %s, Build %s')) %
(self.applicationVersion[u'version'], self.applicationVersion[u'build'])) (self.applicationVersion[u'version'], self.applicationVersion[u'build']))
self.AboutNotebook.setTabText( self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8(u'License')) self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8('License'))
self.CreditsTextEdit.setPlainText(self.trUtf8( self.CreditsTextEdit.setPlainText(self.trUtf8(
u'Project Lead\n' 'Project Lead\n'
u' Raoul \"superfly\" Snyman\n' ' Raoul \"superfly\" Snyman\n'
u'\n' '\n'
u'Developers\n' 'Developers\n'
u' Tim \"TRB143\" Bentley\n' ' Tim \"TRB143\" Bentley\n'
u' Jonathan \"gushie\" Corwin\n' ' Jonathan \"gushie\" Corwin\n'
u' Scott \"sguerrieri\" Guerrieri\n' ' Scott \"sguerrieri\" Guerrieri\n'
u' Raoul \"superfly\" Snyman\n' ' Raoul \"superfly\" Snyman\n'
u' Martin \"mijiti\" Thompson\n' ' Martin \"mijiti\" Thompson\n'
u' Jon \"Meths\" Tibble\n' ' Jon \"Meths\" Tibble\n'
u' Carsten \"catini\" Tingaard')) ' Carsten \"catini\" Tingaard'))
self.AboutNotebook.setTabText( self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.CreditsTab), self.trUtf8(u'Credits')) self.AboutNotebook.indexOf(self.CreditsTab), self.trUtf8('Credits'))
self.ContributeButton.setText(self.trUtf8(u'Contribute')) self.ContributeButton.setText(self.trUtf8('Contribute'))
self.CloseButton.setText(self.trUtf8(u'Close')) self.CloseButton.setText(self.trUtf8('Close'))
self.extContributeItem.setText(self.trUtf8(u'&Contribute')) self.extContributeItem.setText(self.trUtf8('&Contribute'))
def onContributeButtonClicked(self): def onContributeButtonClicked(self):
""" """

View File

@ -92,10 +92,10 @@ class AlertForm(QtGui.QDialog):
QtCore.QMetaObject.connectSlotsByName(AlertForm) QtCore.QMetaObject.connectSlotsByName(AlertForm)
def retranslateUi(self, AlertForm): def retranslateUi(self, AlertForm):
AlertForm.setWindowTitle(self.trUtf8(u'Alert Message')) AlertForm.setWindowTitle(self.trUtf8('Alert Message'))
self.AlertEntryLabel.setText(self.trUtf8(u'Alert Text:')) self.AlertEntryLabel.setText(self.trUtf8('Alert Text:'))
self.DisplayButton.setText(self.trUtf8(u'Display')) self.DisplayButton.setText(self.trUtf8('Display'))
self.CancelButton.setText(self.trUtf8(u'Cancel')) self.CancelButton.setText(self.trUtf8('Cancel'))
def onDisplayClicked(self): def onDisplayClicked(self):
self.parent.mainDisplay.displayAlert(self.AlertEntryEditItem.text()) self.parent.mainDisplay.displayAlert(self.AlertEntryEditItem.text())

View File

@ -37,7 +37,7 @@ class AlertsTab(SettingsTab):
def setupUi(self): def setupUi(self):
self.setObjectName(u'AlertsTab') self.setObjectName(u'AlertsTab')
self.tabTitleVisible = self.trUtf8(u'Alerts') self.tabTitleVisible = self.trUtf8('Alerts')
self.AlertsLayout = QtGui.QHBoxLayout(self) self.AlertsLayout = QtGui.QHBoxLayout(self)
self.AlertsLayout.setSpacing(8) self.AlertsLayout.setSpacing(8)
self.AlertsLayout.setMargin(8) self.AlertsLayout.setMargin(8)
@ -147,14 +147,14 @@ class AlertsTab(SettingsTab):
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.FontGroupBox.setTitle(self.trUtf8(u'Font')) self.FontGroupBox.setTitle(self.trUtf8('Font'))
self.FontLabel.setText(self.trUtf8(u'Font Name:')) self.FontLabel.setText(self.trUtf8('Font Name:'))
self.FontColorLabel.setText(self.trUtf8(u'Font Color:')) self.FontColorLabel.setText(self.trUtf8('Font Color:'))
self.BackgroundColorLabel.setText(self.trUtf8(u'Background Color:')) self.BackgroundColorLabel.setText(self.trUtf8('Background Color:'))
self.TimeoutLabel.setText(self.trUtf8(u'Alert timeout:')) self.TimeoutLabel.setText(self.trUtf8('Alert timeout:'))
self.TimeoutSpinBox.setSuffix(self.trUtf8(u's')) self.TimeoutSpinBox.setSuffix(self.trUtf8('s'))
self.PreviewGroupBox.setTitle(self.trUtf8(u'Preview')) self.PreviewGroupBox.setTitle(self.trUtf8('Preview'))
self.FontPreview.setText(self.trUtf8(u'openlp.org 2.0 rocks!')) self.FontPreview.setText(self.trUtf8('openlp.org 2.0 rocks!'))
def onBackgroundColorButtonClicked(self): def onBackgroundColorButtonClicked(self):
self.bg_color = QtGui.QColorDialog.getColor( self.bg_color = QtGui.QColorDialog.getColor(