From 4d715a3d5d7739011fc8c3b2d97a09543449fbeb Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 24 Nov 2009 21:51:41 +0200 Subject: [PATCH] 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. --- openlp-get-strings.py | 4 +- openlp/core/lib/mediamanageritem.py | 36 ++++++------ openlp/core/test/test_mediamanageritem.py | 4 +- openlp/core/ui/about.py | 68 +++++++++++------------ openlp/core/ui/alertform.py | 8 +-- openlp/core/ui/alertstab.py | 18 +++--- {i18n => resources/i18n}/openlp_en.ts | 0 7 files changed, 69 insertions(+), 69 deletions(-) rename {i18n => resources/i18n}/openlp_en.ts (100%) diff --git a/openlp-get-strings.py b/openlp-get-strings.py index 02aa16772..767a855cf 100755 --- a/openlp-get-strings.py +++ b/openlp-get-strings.py @@ -83,14 +83,14 @@ def write_file(filename): file.close() def main(): - start_dir = u'.' + start_dir = os.path.abspath(u'.') for root, dirs, files in os.walk(start_dir): for file in files: if file.endswith(u'.py'): print u'Parsing "%s"' % file parse_file(os.path.join(root, 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.' if __name__ == u'__main__': diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 722d5756e..f82334e46 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -211,21 +211,21 @@ class MediaManagerItem(QtGui.QWidget): if self.hasFileIcon: self.addToolbarButton( 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'%sFileItem' % self.PluginNameShort) ## New Button ## if self.hasNewIcon: self.addToolbarButton( 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'%sNewItem' % self.PluginNameShort) ## Edit Button ## if self.hasEditIcon: self.addToolbarButton( u'Edit %s' % self.PluginNameShort, - u'%s %s' % (self.trUtf8(u'Edit the selected'), + u'%s %s' % (self.trUtf8('Edit the selected'), self.PluginNameVisible), u':%s_edit.png' % self.IconPath, self.onEditClick, u'%sEditItem' % self.PluginNameShort) @@ -233,7 +233,7 @@ class MediaManagerItem(QtGui.QWidget): if self.hasDeleteIcon: self.addToolbarButton( 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'%sDeleteItem' % self.PluginNameShort) ## Separator Line ## @@ -241,19 +241,19 @@ class MediaManagerItem(QtGui.QWidget): ## Preview ## self.addToolbarButton( 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'PreviewItem') ## Live Button ## self.addToolbarButton( 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'LiveItem') ## Add to service Button ## self.addToolbarButton( - u'%s %s %s' % (u'Add', self.PluginNameShort, u'to Service'), - self.trUtf8(u'Add the selected item(s) to the service'), + u'Add %s to Service' % self.PluginNameShort, + self.trUtf8('Add the selected item(s) to the service'), u':/system/system_add.png', self.onAddClick, u'%sAddServiceItem' % self.PluginNameShort) @@ -276,22 +276,22 @@ class MediaManagerItem(QtGui.QWidget): self.ListView.addAction( contextMenuAction( 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.ListView.addAction(contextMenuSeparator(self.ListView)) self.ListView.addAction( contextMenuAction( 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.ListView.addAction( contextMenuAction( self.ListView, u':/system/system_live.png', - self.trUtf8(u'&Show Live'), self.onLiveClick)) + self.trUtf8('&Show Live'), self.onLiveClick)) self.ListView.addAction( contextMenuAction( 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( self.ListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick) @@ -360,8 +360,8 @@ class MediaManagerItem(QtGui.QWidget): def onPreviewClick(self): if not self.ListView.selectedIndexes() and not self.remoteTriggered: QtGui.QMessageBox.information(self, - self.trUtf8(u'No items selected...'), - self.trUtf8(u'You must select one or more items')) + self.trUtf8('No items selected...'), + self.trUtf8('You must select one or more items')) log.debug(self.PluginNameShort + u' Preview Requested') service_item = self.buildServiceItem() if service_item: @@ -371,8 +371,8 @@ class MediaManagerItem(QtGui.QWidget): def onLiveClick(self): if not self.ListView.selectedIndexes(): QtGui.QMessageBox.information(self, - self.trUtf8(u'No items selected...'), - self.trUtf8(u'You must select one or more items')) + self.trUtf8('No items selected...'), + self.trUtf8('You must select one or more items')) log.debug(self.PluginNameShort + u' Live Requested') service_item = self.buildServiceItem() if service_item: @@ -382,8 +382,8 @@ class MediaManagerItem(QtGui.QWidget): def onAddClick(self): if not self.ListView.selectedIndexes() and not self.remoteTriggered: QtGui.QMessageBox.information(self, - self.trUtf8(u'No items selected...'), - self.trUtf8(u'You must select one or more items')) + self.trUtf8('No items selected...'), + self.trUtf8('You must select one or more items')) log.debug(self.PluginNameShort + u' Add Requested') service_item = self.buildServiceItem() if service_item: diff --git a/openlp/core/test/test_mediamanageritem.py b/openlp/core/test/test_mediamanageritem.py index 85aab943d..f9539174c 100644 --- a/openlp/core/test/test_mediamanageritem.py +++ b/openlp/core/test/test_mediamanageritem.py @@ -69,9 +69,9 @@ class TestMediaManager: i2.addToolbar() i2.addToolbarButton(u'Test2', u'Test2', None) self.MediaToolBox.setItemText( - self.MediaToolBox.indexOf(i1), self.trUtf8(u'Item1')) + self.MediaToolBox.indexOf(i1), self.trUtf8('Item1')) self.MediaToolBox.setItemText( - self.MediaToolBox.indexOf(i2), self.trUtf8(u'Item2')) + self.MediaToolBox.indexOf(i2), self.trUtf8('Item2')) log.info(u'Show window') self.main_window.show() log.info(u'End') diff --git a/openlp/core/ui/about.py b/openlp/core/ui/about.py index 3cc487bea..808dea07a 100644 --- a/openlp/core/ui/about.py +++ b/openlp/core/ui/about.py @@ -148,50 +148,50 @@ class AboutForm(QtGui.QDialog): """ Set up translation """ - AboutForm.setWindowTitle(self.trUtf8(u'About openlp.org')) + AboutForm.setWindowTitle(self.trUtf8('About openlp.org')) 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( - u'openlp.org is written and maintained by volunteers. If you would ' - u'like to see more free Christian software being written, please ' - u'consider contributing by using the button below.')) + 'openlp.org is written and maintained by volunteers. If you would ' + 'like to see more free Christian software being written, please ' + 'consider contributing by using the button below.')) self.License1Label.setText(self.trUtf8( - u'This program is free software; you can redistribute it and/or ' - u'modify it under the terms of the GNU General Public License as ' - u'published by the Free Software Foundation; either version 2 of ' - u'the License, or (at your option) any later version.')) + 'This program is free software; you can redistribute it and/or ' + 'modify it under the terms of the GNU General Public License as ' + 'published by the Free Software Foundation; either version 2 of ' + 'the License, or (at your option) any later version.')) self.License2Label.setText(self.trUtf8( - u'You should have received a copy of the GNU General Public ' - u'License along with this program; if not, write to the Free ' - u'Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ' - u'MA 02111-1307 USA.')) + 'You should have received a copy of the GNU General Public ' + 'License along with this program; if not, write to the Free ' + 'Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ' + 'MA 02111-1307 USA.')) self.License3Label.setText(self.trUtf8( - u'This program is distributed in the hope that it will be useful, ' - u'but WITHOUT ANY WARRANTY; without even the implied warranty of ' - u'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ' - u'General Public License for more details.')) + 'This program is distributed in the hope that it will be useful, ' + 'but WITHOUT ANY WARRANTY; without even the implied warranty of ' + 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ' + 'General Public License for more details.')) 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.AboutNotebook.setTabText( - self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8(u'License')) + self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8('License')) self.CreditsTextEdit.setPlainText(self.trUtf8( - u'Project Lead\n' - u' Raoul \"superfly\" Snyman\n' - u'\n' - u'Developers\n' - u' Tim \"TRB143\" Bentley\n' - u' Jonathan \"gushie\" Corwin\n' - u' Scott \"sguerrieri\" Guerrieri\n' - u' Raoul \"superfly\" Snyman\n' - u' Martin \"mijiti\" Thompson\n' - u' Jon \"Meths\" Tibble\n' - u' Carsten \"catini\" Tingaard')) + 'Project Lead\n' + ' Raoul \"superfly\" Snyman\n' + '\n' + 'Developers\n' + ' Tim \"TRB143\" Bentley\n' + ' Jonathan \"gushie\" Corwin\n' + ' Scott \"sguerrieri\" Guerrieri\n' + ' Raoul \"superfly\" Snyman\n' + ' Martin \"mijiti\" Thompson\n' + ' Jon \"Meths\" Tibble\n' + ' Carsten \"catini\" Tingaard')) self.AboutNotebook.setTabText( - self.AboutNotebook.indexOf(self.CreditsTab), self.trUtf8(u'Credits')) - self.ContributeButton.setText(self.trUtf8(u'Contribute')) - self.CloseButton.setText(self.trUtf8(u'Close')) - self.extContributeItem.setText(self.trUtf8(u'&Contribute')) + self.AboutNotebook.indexOf(self.CreditsTab), self.trUtf8('Credits')) + self.ContributeButton.setText(self.trUtf8('Contribute')) + self.CloseButton.setText(self.trUtf8('Close')) + self.extContributeItem.setText(self.trUtf8('&Contribute')) def onContributeButtonClicked(self): """ diff --git a/openlp/core/ui/alertform.py b/openlp/core/ui/alertform.py index 9c069bd1c..820d4da97 100644 --- a/openlp/core/ui/alertform.py +++ b/openlp/core/ui/alertform.py @@ -92,10 +92,10 @@ class AlertForm(QtGui.QDialog): QtCore.QMetaObject.connectSlotsByName(AlertForm) def retranslateUi(self, AlertForm): - AlertForm.setWindowTitle(self.trUtf8(u'Alert Message')) - self.AlertEntryLabel.setText(self.trUtf8(u'Alert Text:')) - self.DisplayButton.setText(self.trUtf8(u'Display')) - self.CancelButton.setText(self.trUtf8(u'Cancel')) + AlertForm.setWindowTitle(self.trUtf8('Alert Message')) + self.AlertEntryLabel.setText(self.trUtf8('Alert Text:')) + self.DisplayButton.setText(self.trUtf8('Display')) + self.CancelButton.setText(self.trUtf8('Cancel')) def onDisplayClicked(self): self.parent.mainDisplay.displayAlert(self.AlertEntryEditItem.text()) diff --git a/openlp/core/ui/alertstab.py b/openlp/core/ui/alertstab.py index 6123ff3c5..5cf7ea5f6 100644 --- a/openlp/core/ui/alertstab.py +++ b/openlp/core/ui/alertstab.py @@ -37,7 +37,7 @@ class AlertsTab(SettingsTab): def setupUi(self): self.setObjectName(u'AlertsTab') - self.tabTitleVisible = self.trUtf8(u'Alerts') + self.tabTitleVisible = self.trUtf8('Alerts') self.AlertsLayout = QtGui.QHBoxLayout(self) self.AlertsLayout.setSpacing(8) self.AlertsLayout.setMargin(8) @@ -147,14 +147,14 @@ class AlertsTab(SettingsTab): QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) def retranslateUi(self): - self.FontGroupBox.setTitle(self.trUtf8(u'Font')) - self.FontLabel.setText(self.trUtf8(u'Font Name:')) - self.FontColorLabel.setText(self.trUtf8(u'Font Color:')) - self.BackgroundColorLabel.setText(self.trUtf8(u'Background Color:')) - self.TimeoutLabel.setText(self.trUtf8(u'Alert timeout:')) - self.TimeoutSpinBox.setSuffix(self.trUtf8(u's')) - self.PreviewGroupBox.setTitle(self.trUtf8(u'Preview')) - self.FontPreview.setText(self.trUtf8(u'openlp.org 2.0 rocks!')) + self.FontGroupBox.setTitle(self.trUtf8('Font')) + self.FontLabel.setText(self.trUtf8('Font Name:')) + self.FontColorLabel.setText(self.trUtf8('Font Color:')) + self.BackgroundColorLabel.setText(self.trUtf8('Background Color:')) + self.TimeoutLabel.setText(self.trUtf8('Alert timeout:')) + self.TimeoutSpinBox.setSuffix(self.trUtf8('s')) + self.PreviewGroupBox.setTitle(self.trUtf8('Preview')) + self.FontPreview.setText(self.trUtf8('openlp.org 2.0 rocks!')) def onBackgroundColorButtonClicked(self): self.bg_color = QtGui.QColorDialog.getColor( diff --git a/i18n/openlp_en.ts b/resources/i18n/openlp_en.ts similarity index 100% rename from i18n/openlp_en.ts rename to resources/i18n/openlp_en.ts