diff --git a/python/plugins/processing/core/GeoAlgorithm.py b/python/plugins/processing/core/GeoAlgorithm.py
index 69b9711af54..43cefe3c02a 100644
--- a/python/plugins/processing/core/GeoAlgorithm.py
+++ b/python/plugins/processing/core/GeoAlgorithm.py
@@ -521,7 +521,7 @@ class GeoAlgorithm:
for layer in wrongLayers:
html += self.tr('
%s: %s\n') % \
- (layer.description, layer.value)
+ (layer.description, layer.value)
html += self.tr('The above files could not be opened, which '
'probably indicates that they were not correctly '
'produced by the executed algorithm
'
@@ -532,4 +532,4 @@ class GeoAlgorithm:
def tr(self, string, context=''):
if context == '':
context = 'GeoAlgorithm'
- return QtCore.QCoreApplication.translate(context, string)
+ return QCoreApplication.translate(context, string)
diff --git a/python/plugins/processing/core/Processing.py b/python/plugins/processing/core/Processing.py
index f718cd60b35..131ac62ecbc 100644
--- a/python/plugins/processing/core/Processing.py
+++ b/python/plugins/processing/core/Processing.py
@@ -95,8 +95,8 @@ class Processing:
Processing.updateAlgsList()
except:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr('Could not load provider: %s\n%s')
- % (provider.getDescription(), unicode(sys.exc_info()[1])))
+ self.tr('Could not load provider: %s\n%s')
+ % (provider.getDescription(), unicode(sys.exc_info()[1])))
Processing.removeProvider(provider)
@staticmethod
@@ -284,16 +284,16 @@ class Processing:
print 'Error: Wrong parameter value %s for parameter %s.' \
% (value, name)
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr("Error in %s. Wrong parameter value %s for parameter %s.") \
+ self.tr('Error in %s. Wrong parameter value %s for parameter %s.') \
% (alg.name, value, name))
return
# fill any missing parameters with default values if allowed
for param in alg.parameters:
if param.name not in setParams:
if not param.setValue(None):
- print ("Error: Missing parameter value for parameter %s." % (param.name))
+ print ('Error: Missing parameter value for parameter %s.' % (param.name))
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- self.tr("Error in %s. Missing parameter value for parameter %s.") \
+ self.tr('Error in %s. Missing parameter value for parameter %s.') \
% (alg.name, param.name))
return
else:
diff --git a/python/plugins/processing/core/parameters.py b/python/plugins/processing/core/parameters.py
index 84f35da13e0..0c6660916eb 100644
--- a/python/plugins/processing/core/parameters.py
+++ b/python/plugins/processing/core/parameters.py
@@ -364,7 +364,7 @@ class ParameterMultipleInput(ParameterDataObject):
else:
exts = dataobjects.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
- exts[i] = self.tr('%s files(*.%s', 'ParameterMultipleInput') % (exts[i].upper(), exts[i].lower())
+ exts[i] = self.tr('%s files(*.%s)', 'ParameterMultipleInput') % (exts[i].upper(), exts[i].lower())
return ';;'.join(exts)
@@ -495,7 +495,7 @@ class ParameterRaster(ParameterDataObject):
def getFileFilter(self):
exts = dataobjects.getSupportedOutputRasterLayerExtensions()
for i in range(len(exts)):
- exts[i] = self.tr('%s files(*.%s', 'ParameterRaster') % (exts[i].upper(), exts[i].lower())
+ exts[i] = self.tr('%s files(*.%s)', 'ParameterRaster') % (exts[i].upper(), exts[i].lower())
return ';;'.join(exts)
@@ -612,7 +612,7 @@ class ParameterTable(ParameterDataObject):
def getFileFilter(self):
exts = ['csv', 'dbf']
for i in range(len(exts)):
- exts[i] = self.tr('%s files(*.%s', 'ParameterTable') % (exts[i].upper(), exts[i].lower())
+ exts[i] = self.tr('%s files(*.%s)', 'ParameterTable') % (exts[i].upper(), exts[i].lower())
return ';;'.join(exts)
@@ -721,5 +721,5 @@ class ParameterVector(ParameterDataObject):
def getFileFilter(self):
exts = dataobjects.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
- exts[i] = self.tr('%s files(*.%s', 'ParameterVector') % (exts[i].upper(), exts[i].lower())
+ exts[i] = self.tr('%s files(*.%s)', 'ParameterVector') % (exts[i].upper(), exts[i].lower())
return ';;'.join(exts)
diff --git a/python/plugins/processing/gui/AlgorithmExecutionDialog.py b/python/plugins/processing/gui/AlgorithmExecutionDialog.py
index 3ee404bb36a..025167fe426 100644
--- a/python/plugins/processing/gui/AlgorithmExecutionDialog.py
+++ b/python/plugins/processing/gui/AlgorithmExecutionDialog.py
@@ -64,7 +64,7 @@ class AlgorithmExecutionDialog(QDialog):
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Close)
self.runButton = QPushButton()
- self.runButton.setText('Run')
+ self.runButton.setText(self.tr('Run'))
self.buttonBox.addButton(self.runButton, QDialogButtonBox.ActionRole)
self.runButton.clicked.connect(self.accept)
self.setWindowTitle(self.alg.name)
@@ -78,11 +78,11 @@ class AlgorithmExecutionDialog(QDialog):
self.verticalLayout.setMargin(9)
self.tabWidget = QTabWidget()
self.tabWidget.setMinimumWidth(300)
- self.tabWidget.addTab(self.mainWidget, 'Parameters')
+ self.tabWidget.addTab(self.mainWidget, self.tr('Parameters'))
self.verticalLayout.addWidget(self.tabWidget)
self.logText = QTextEdit()
self.logText.readOnly = True
- self.tabWidget.addTab(self.logText, 'Log')
+ self.tabWidget.addTab(self.logText, self.tr('Log'))
self.webView = QWebView()
html = None
url = None
@@ -93,15 +93,16 @@ class AlgorithmExecutionDialog(QDialog):
else:
url = QUrl(help)
else:
- html = 'Sorry, no help is available for this \
- algorithm.
'
+ html = self.tr('Sorry, no help is available for this '
+ 'algorithm.
')
try:
if html:
self.webView.setHtml(html)
elif url:
self.webView.load(url)
except:
- self.webView.setHtml('Could not open help file :-(
')
+ self.webView.setHtml(
+ self.tr('Could not open help file :-(
'))
self.tabWidget.addTab(self.webView, 'Help')
self.verticalLayout.addWidget(self.progressLabel)
self.verticalLayout.addWidget(self.progress)
@@ -195,17 +196,18 @@ class AlgorithmExecutionDialog(QDialog):
try:
self.setParamValues()
if checkCRS and not self.alg.checkInputCRS():
- reply = QMessageBox.question(self, "Unmatching CRS's",
- 'Layers do not all use the same CRS.\n'
- + 'This can cause unexpected results.\n'
- + 'Do you want to continue?',
- QMessageBox.Yes | QMessageBox.No,
- QMessageBox.No)
+ reply = QMessageBox.question(self, self.tr("Unmatching CRS's"),
+ self.tr('Layers do not all use the same CRS. This can '
+ 'cause unexpected results.\nDo you want to'
+ 'continue?'),
+ QMessageBox.Yes | QMessageBox.No,
+ QMessageBox.No)
if reply == QMessageBox.No:
return
msg = self.alg.checkParameterValuesBeforeExecuting()
if msg:
- QMessageBox.warning(self, 'Unable to execute algorithm', msg)
+ QMessageBox.warning(
+ self, self.tr('Unable to execute algorithm'), msg)
return
self.runButton.setEnabled(False)
self.buttonBox.button(
@@ -221,10 +223,11 @@ class AlgorithmExecutionDialog(QDialog):
self.tabWidget.setCurrentIndex(1) # Log tab
self.progress.setMaximum(0)
- self.progressLabel.setText('Processing algorithm...')
+ self.progressLabel.setText(self.tr('Processing algorithm...'))
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
- self.setInfo('Algorithm %s starting...' % self.alg.name)
+ self.setInfo(
+ self.tr('Algorithm %s starting...') % self.alg.name)
# make sure the log tab is visible before executing the algorithm
try:
self.repaint()
@@ -254,12 +257,13 @@ class AlgorithmExecutionDialog(QDialog):
palette = ex.widget.palette()
palette.setColor(QPalette.Base, QColor(255, 255, 0))
ex.widget.setPalette(palette)
- self.progressLabel.setText('Missing parameter value: '
- + ex.parameter.description + '')
+ self.progressLabel.setText(
+ self.tr('Missing parameter value: %s' % ex.parameter.description))
return
except:
- QMessageBox.critical(self, 'Unable to execute algorithm',
- 'Wrong or missing parameter values')
+ QMessageBox.critical(self,
+ self.tr('Unable to execute algorithm'),
+ self.tr('Wrong or missing parameter values'))
def finish(self):
keepOpen = ProcessingConfig.getSetting(
@@ -274,8 +278,9 @@ class AlgorithmExecutionDialog(QDialog):
else:
self.resetGUI()
if self.alg.getHTMLOutputsCount() > 0:
- self.setInfo('HTML output has been generated by this '
- + 'algorithm.\nOpen the results dialog to check it.')
+ self.setInfo(
+ self.tr('HTML output has been generated by this algorithm.'
+ '\nOpen the results dialog to check it.'))
def error(self, msg):
QApplication.restoreOverrideCursor()
diff --git a/python/plugins/processing/gui/BatchInputSelectionPanel.py b/python/plugins/processing/gui/BatchInputSelectionPanel.py
index 968c681b2df..9ad269c7f62 100644
--- a/python/plugins/processing/gui/BatchInputSelectionPanel.py
+++ b/python/plugins/processing/gui/BatchInputSelectionPanel.py
@@ -62,11 +62,11 @@ class BatchInputSelectionPanel(QtGui.QWidget):
popupmenu = QtGui.QMenu()
if not (isinstance(self.param, ParameterMultipleInput)
and self.param.datatype == ParameterMultipleInput.TYPE_FILE):
- selectLayerAction = QtGui.QAction('Select from open layers',
+ selectLayerAction = QtGui.QAction(self.tr('Select from open layers'),
self.pushButton)
selectLayerAction.triggered.connect(self.showLayerSelectionDialog)
popupmenu.addAction(selectLayerAction)
- selectFileAction = QtGui.QAction('Select from filesystem',
+ selectFileAction = QtGui.QAction(self.tr('Select from filesystem'),
self.pushButton)
selectFileAction.triggered.connect(self.showFileSelectionDialog)
popupmenu.addAction(selectFileAction)
@@ -114,8 +114,8 @@ class BatchInputSelectionPanel(QtGui.QWidget):
else:
path = ''
- ret = QtGui.QFileDialog.getOpenFileNames(self, 'Open file', path,
- 'All files(*.*);;' + self.param.getFileFilter())
+ ret = QtGui.QFileDialog.getOpenFileNames(self, self.tr('Open file'), path,
+ self.tr('All files(*.*);;') + self.param.getFileFilter())
if ret:
files = list(ret)
if len(files) == 1:
diff --git a/python/plugins/processing/gui/BatchOutputSelectionPanel.py b/python/plugins/processing/gui/BatchOutputSelectionPanel.py
index f7ec68a21b3..ae6994961aa 100644
--- a/python/plugins/processing/gui/BatchOutputSelectionPanel.py
+++ b/python/plugins/processing/gui/BatchOutputSelectionPanel.py
@@ -63,7 +63,7 @@ class BatchOutputSelectionPanel(QtGui.QWidget):
def showSelectionDialog(self):
filefilter = self.output.getFileFilter(self.alg)
- filename = QtGui.QFileDialog.getSaveFileName(self, 'Save file', '',
+ filename = QtGui.QFileDialog.getSaveFileName(self, self.tr('Save file'), '',
filefilter)
if filename:
filename = unicode(filename)
diff --git a/python/plugins/processing/gui/BatchProcessingDialog.py b/python/plugins/processing/gui/BatchProcessingDialog.py
index c6ca49d52ba..bd407064a1f 100644
--- a/python/plugins/processing/gui/BatchProcessingDialog.py
+++ b/python/plugins/processing/gui/BatchProcessingDialog.py
@@ -63,11 +63,11 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
AlgorithmExecutionDialog.__init__(self, alg, self.table)
self.setWindowModality(1)
self.resize(800, 500)
- self.setWindowTitle('Batch Processing - ' + self.alg.name)
+ self.setWindowTitle(self.tr('Batch Processing - %s') % self.alg.name)
for param in self.alg.parameters:
if param.isAdvanced:
self.advancedButton = QtGui.QPushButton()
- self.advancedButton.setText('Show advanced parameters')
+ self.advancedButton.setText(self.tr('Show advanced parameters'))
self.advancedButton.setMaximumWidth(150)
self.buttonBox.addButton(self.advancedButton,
QtGui.QDialogButtonBox.ActionRole)
@@ -75,11 +75,11 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
self.showAdvancedParametersClicked)
break
self.addRowButton = QtGui.QPushButton()
- self.addRowButton.setText('Add row')
+ self.addRowButton.setText(self.tr('Add row'))
self.buttonBox.addButton(self.addRowButton,
QtGui.QDialogButtonBox.ActionRole)
self.deleteRowButton = QtGui.QPushButton()
- self.deleteRowButton.setText('Delete row')
+ self.deleteRowButton.setText(self.tr('Delete row'))
self.buttonBox.addButton(self.addRowButton,
QtGui.QDialogButtonBox.ActionRole)
self.buttonBox.addButton(self.deleteRowButton,
@@ -151,7 +151,7 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
if self.alg.getVisibleOutputsCount():
self.table.setHorizontalHeaderItem(i,
- QtGui.QTableWidgetItem('Load in QGIS'))
+ QtGui.QTableWidgetItem(self.tr('Load in QGIS')))
for i in range(3):
self.addRow()
@@ -168,9 +168,8 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
continue
widget = self.table.cellWidget(row, col)
if not self.setParameterValueFromWidget(param, widget, alg):
- self.progressLabel.setText('Missing parameter value: '
- + param.description + ' (row ' + str(row + 1)
- + ')')
+ self.progressLabel.setText(
+ self.tr('Missing parameter value: %s (row %d)') % (param.description, row + 1))
self.algs = None
return
col += 1
@@ -184,9 +183,7 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
col += 1
else:
self.progressLabel.setText(
- 'Wrong or missing parameter value: '
- + out.description + ' (row ' + str(row + 1)
- + ')')
+ self.tr('Wrong or missing parameter value: %s (row %d)') % (out.description, row + 1))
self.algs = None
return
self.algs.append(alg)
@@ -206,13 +203,12 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
except:
pass
for (i, alg) in enumerate(self.algs):
- self.setBaseText('Processing algorithm ' + str(i + 1) + '/'
- + str(len(self.algs)) + '...')
- self.setInfo('Algorithm %s starting...' % alg.name)
+ self.setBaseText(self.tr('Processing algorithm %d/%d...') %(i + 1, len(self.algs)))
+ self.setInfo(self.tr('Algorithm %s starting...' % alg.name))
if runalg(alg, self) and not self.canceled:
if self.load[i]:
handleAlgorithmResults(alg, self, False)
- self.setInfo('Algorithm %s correctly executed...' % alg.name)
+ self.setInfo(self.tr('Algorithm %s correctly executed...') % alg.name)
else:
QApplication.restoreOverrideCursor()
return
@@ -260,8 +256,8 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
self.createSummaryTable()
QApplication.restoreOverrideCursor()
self.table.setEnabled(True)
- QMessageBox.information(self, 'Batch processing',
- 'Batch processing successfully completed!')
+ QMessageBox.information(self, self.tr('Batch processing'),
+ self.tr('Batch processing successfully completed!'))
def setParameterValueFromWidget(self, param, widget, alg=None):
if isinstance(param, (ParameterRaster, ParameterVector,
@@ -291,8 +287,8 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
item = BatchInputSelectionPanel(param, row, col, self)
elif isinstance(param, ParameterBoolean):
item = QtGui.QComboBox()
- item.addItem('Yes')
- item.addItem('No')
+ item.addItem(self.tr('Yes'))
+ item.addItem(self.tr('No'))
if param.default:
item.setCurrentIndex(0)
else:
@@ -341,17 +337,17 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
if self.alg.getVisibleOutputsCount():
item = QtGui.QComboBox()
- item.addItem('Yes')
- item.addItem('No')
+ item.addItem(self.tr('Yes'))
+ item.addItem(self.tr('No'))
item.setCurrentIndex(0)
self.table.setCellWidget(self.table.rowCount() - 1, i, item)
def showAdvancedParametersClicked(self):
self.showAdvanced = not self.showAdvanced
if self.showAdvanced:
- self.advancedButton.setText('Hide advanced parameters')
+ self.advancedButton.setText(self.tr('Hide advanced parameters'))
else:
- self.advancedButton.setText('Show advanced parameters')
+ self.advancedButton.setText(self.tr('Show advanced parameters'))
i = 0
for param in self.alg.parameters:
if param.isAdvanced:
diff --git a/python/plugins/processing/gui/ConfigDialog.py b/python/plugins/processing/gui/ConfigDialog.py
index a01e2e4ffef..74011ec7bcc 100644
--- a/python/plugins/processing/gui/ConfigDialog.py
+++ b/python/plugins/processing/gui/ConfigDialog.py
@@ -74,7 +74,7 @@ class ConfigDialog(QDialog, Ui_DlgConfig):
settings = ProcessingConfig.getSettings()
rootItem = self.model.invisibleRootItem()
- priorityKeys = ['General', 'Models', 'Scripts']
+ priorityKeys = [self.tr('General'), self.tr('Models'), self.tr('Scripts')]
for group in priorityKeys:
groupItem = QStandardItem(group)
icon = ProcessingConfig.getGroupIcon(group)
@@ -141,7 +141,7 @@ class ConfigDialog(QDialog, Ui_DlgConfig):
setting.value = value
except ValueError:
QMessageBox.critical(self, self.tr('Wrong value'),
- self.tr('Wrong parameter value:\n%1').arg(value))
+ self.tr('Wrong parameter value:\n%1') % value)
return
else:
setting.value = unicode(self.items[setting].text())
diff --git a/python/plugins/processing/gui/CouldNotLoadResultsDialog.py b/python/plugins/processing/gui/CouldNotLoadResultsDialog.py
index 2361220bab9..05f7d1cd9f3 100644
--- a/python/plugins/processing/gui/CouldNotLoadResultsDialog.py
+++ b/python/plugins/processing/gui/CouldNotLoadResultsDialog.py
@@ -42,7 +42,7 @@ class CouldNotLoadResultsDialog(QtGui.QDialog):
def setupUi(self):
self.resize(600, 350)
- self.setWindowTitle('Problem loading output layers')
+ self.setWindowTitle(self.tr('Problem loading output layers'))
layout = QVBoxLayout()
browser = QtGui.QTextBrowser()
browser.setOpenLinks(False)
@@ -50,7 +50,7 @@ class CouldNotLoadResultsDialog(QtGui.QDialog):
html = self.alg.getPostProcessingErrorMessage(self.wrongLayers)
browser.setHtml(html)
button = QPushButton()
- button.setText('Close')
+ button.setText(self.tr('Close'))
button.clicked.connect(self.closeButtonPressed)
buttonBox = QtGui.QDialogButtonBox()
buttonBox.setOrientation(QtCore.Qt.Horizontal)
diff --git a/python/plugins/processing/gui/CreateNewScriptAction.py b/python/plugins/processing/gui/CreateNewScriptAction.py
index b660e08a958..1ffbf926b4b 100644
--- a/python/plugins/processing/gui/CreateNewScriptAction.py
+++ b/python/plugins/processing/gui/CreateNewScriptAction.py
@@ -37,7 +37,7 @@ class CreateNewScriptAction(ToolboxAction):
def __init__(self, actionName, scriptType):
self.name = actionName
- self.group = 'Tools'
+ self.group = self.tr('Tools', 'CreateNewScriptAction')
self.scriptType = scriptType
def getIcon(self):
diff --git a/python/plugins/processing/gui/DeleteScriptAction.py b/python/plugins/processing/gui/DeleteScriptAction.py
index a3596cf422c..7e81d13b77e 100644
--- a/python/plugins/processing/gui/DeleteScriptAction.py
+++ b/python/plugins/processing/gui/DeleteScriptAction.py
@@ -53,7 +53,8 @@ class DeleteScriptAction(ContextAction):
def execute(self, alg):
reply = QMessageBox.question(None,
self.tr('Confirmation', 'DeleteScriptAction'),
- self.tr('Are you sure you want to delete this script?', 'DeleteScriptAction'),
+ self.tr('Are you sure you want to delete this script?',
+ 'DeleteScriptAction'),
QMessageBox.Yes | QMessageBox.No,
QMessageBox.No)
if reply == QMessageBox.Yes:
diff --git a/python/plugins/processing/gui/ExtentSelectionPanel.py b/python/plugins/processing/gui/ExtentSelectionPanel.py
index e8b9f698f0e..a98d5a48e82 100644
--- a/python/plugins/processing/gui/ExtentSelectionPanel.py
+++ b/python/plugins/processing/gui/ExtentSelectionPanel.py
@@ -51,7 +51,7 @@ class ExtentSelectionPanel(QtGui.QWidget):
if self.canUseAutoExtent():
if hasattr(self.text, 'setPlaceholderText'):
self.text.setPlaceholderText(
- '[Leave blank to use min covering extent]')
+ self.tr('[Leave blank to use min covering extent]'))
self.horizontalLayout.addWidget(self.text)
self.pushButton = QtGui.QPushButton()
self.pushButton.setText('...')
@@ -74,17 +74,17 @@ class ExtentSelectionPanel(QtGui.QWidget):
def buttonPushed(self):
popupmenu = QMenu()
- useLayerExtentAction = QtGui.QAction('Use layer/canvas extent',
+ useLayerExtentAction = QtGui.QAction(self.tr('Use layer/canvas extent'),
self.pushButton)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
popupmenu.addAction(useLayerExtentAction)
- selectOnCanvasAction = QtGui.QAction('Select extent on canvas',
+ selectOnCanvasAction = QtGui.QAction(self.tr('Select extent on canvas'),
self.pushButton)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
popupmenu.addAction(selectOnCanvasAction)
if self.canUseAutoExtent():
useMincoveringExtentAction = \
- QtGui.QAction('Use min covering extent from input layers',
+ QtGui.QAction(self.tr('Use min covering extent from input layers'),
self.pushButton)
useMincoveringExtentAction.triggered.connect(
self.useMinCoveringExtent)
diff --git a/python/plugins/processing/gui/FileSelectionPanel.py b/python/plugins/processing/gui/FileSelectionPanel.py
index 2af83b7ab99..771f3987155 100644
--- a/python/plugins/processing/gui/FileSelectionPanel.py
+++ b/python/plugins/processing/gui/FileSelectionPanel.py
@@ -44,7 +44,7 @@ class FileSelectionPanel(QtGui.QWidget):
QtGui.QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QtGui.QPushButton()
- self.pushButton.setText('...')
+ self.pushButton.setText(self.tr('...'))
self.pushButton.clicked.connect(self.showSelectionDialog)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
@@ -64,13 +64,13 @@ class FileSelectionPanel(QtGui.QWidget):
if self.isFolder:
folder = QtGui.QFileDialog.getExistingDirectory(self,
- 'Select folder', path)
+ self.tr('Select folder'), path)
if folder:
self.text.setText(str(folder))
settings.setValue('/Processing/LastInputPath',
os.path.dirname(unicode(folder)))
else:
- filenames = QtGui.QFileDialog.getOpenFileNames(self, 'Open file',
+ filenames = QtGui.QFileDialog.getOpenFileNames(self, self.tr('Open file'),
path, '*.' + self.ext)
if filenames:
self.text.setText(u';'.join(filenames))
diff --git a/python/plugins/processing/gui/FixedTableDialog.py b/python/plugins/processing/gui/FixedTableDialog.py
index 5d3cc58e664..d5f6e0463e6 100644
--- a/python/plugins/processing/gui/FixedTableDialog.py
+++ b/python/plugins/processing/gui/FixedTableDialog.py
@@ -42,7 +42,7 @@ class FixedTableDialog(QtGui.QDialog):
def setupUi(self):
self.resize(600, 350)
- self.setWindowTitle('Fixed Table')
+ self.setWindowTitle(self.tr('Fixed Table'))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
@@ -62,10 +62,10 @@ class FixedTableDialog(QtGui.QDialog):
self.table.setRowHeight(i, 22)
self.table.verticalHeader().setVisible(False)
self.addRowButton = QtGui.QPushButton()
- self.addRowButton.setText('Add row')
+ self.addRowButton.setText(self.tr('Add row'))
self.addRowButton.setEnabled(not self.param.fixedNumOfRows)
self.removeRowButton = QtGui.QPushButton()
- self.removeRowButton.setText('Remove row')
+ self.removeRowButton.setText(self.tr('Remove row'))
self.removeRowButton.setEnabled(not self.param.fixedNumOfRows)
self.buttonBox.addButton(self.addRowButton,
QtGui.QDialogButtonBox.ActionRole)
@@ -108,4 +108,4 @@ class FixedTableDialog(QtGui.QDialog):
self.table.setRowHeight(self.table.rowCount() - 1, 22)
for i in range(self.table.columnCount()):
self.table.setItem(self.table.rowCount() - 1, i,
- QtGui.QTableWidgetItem('0'))
\ No newline at end of file
+ QtGui.QTableWidgetItem('0'))
diff --git a/python/plugins/processing/gui/FixedTablePanel.py b/python/plugins/processing/gui/FixedTablePanel.py
index 3dd5e4c4579..705000df0b4 100644
--- a/python/plugins/processing/gui/FixedTablePanel.py
+++ b/python/plugins/processing/gui/FixedTablePanel.py
@@ -43,13 +43,12 @@ class FixedTablePanel(QtGui.QWidget):
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.label = QtGui.QLabel()
- self.label.setText('Fixed table ' + str(len(param.cols)) + ' X '
- + str(param.numRows))
+ self.label.setText(self.tr('Fixed table %dx%d' % (len(param.cols), param.numRows)))
self.label.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.label)
self.pushButton = QtGui.QPushButton()
- self.pushButton.setText('...')
+ self.pushButton.setText(self.tr('...'))
self.pushButton.clicked.connect(self.showFixedTableDialog)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
diff --git a/python/plugins/processing/gui/GetScriptsAndModels.py b/python/plugins/processing/gui/GetScriptsAndModels.py
index a7d1eadeec1..2ee10611283 100644
--- a/python/plugins/processing/gui/GetScriptsAndModels.py
+++ b/python/plugins/processing/gui/GetScriptsAndModels.py
@@ -44,8 +44,8 @@ from processing.gui.Help2Html import getDescription, ALG_DESC, ALG_VERSION, ALG_
class GetScriptsAction(ToolboxAction):
def __init__(self):
- self.name = "Get scripts from on-line scripts collection"
- self.group = 'Tools'
+ self.name = self.tr('Get scripts from on-line scripts collection', 'GetScriptsAction')
+ self.group = self.tr('Tools', 'GetScriptsAction')
def getIcon(self):
return QIcon(':/processing/images/script.png')
@@ -58,14 +58,16 @@ class GetScriptsAction(ToolboxAction):
self.toolbox.updateProvider('script')
except HTTPError:
- QMessageBox.critical(iface.mainWindow(), "Connection problem", "Could not connect to scripts/models repository")
+ QMessageBox.critical(iface.mainWindow(),
+ self.tr('Connection problem', 'GetScriptsAction'),
+ self.tr('Could not connect to scripts/models repository', 'GetScriptsAction'))
class GetModelsAction(ToolboxAction):
def __init__(self):
- self.name = "Get models from on-line scripts collection"
- self.group = 'Tools'
+ self.name = self.tr('Get models from on-line scripts collection', 'GetModelsAction')
+ self.group = self.tr('Tools', 'GetModelsAction')
def getIcon(self):
return QIcon(':/processing/images/model.png')
@@ -77,7 +79,9 @@ class GetModelsAction(ToolboxAction):
if dlg.updateToolbox:
self.toolbox.updateProvider('model')
except HTTPError:
- QMessageBox.critical(iface.mainWindow(), "Connection problem", "Could not connect to scripts/models repository")
+ QMessageBox.critical(iface.mainWindow(),
+ self.tr('Connection problem', 'GetModelsAction'),
+ self.tr('Could not connect to scripts/models repository', 'GetModelsAction'))
def readUrl(url):
@@ -109,11 +113,11 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
self.resourceType = resourceType
if self.resourceType == self.MODELS:
self.folder = ModelerUtils.modelsFolder()
- self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/models/"
+ self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/models/'
self.icon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/model.png')
else:
self.folder = ScriptUtils.scriptsFolder()
- self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/scripts/"
+ self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/scripts/'
self.icon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/script.png')
self.lastSelectedItem = None
self.setupUi(self)
@@ -125,16 +129,16 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
def populateTree(self):
self.uptodateItem = QTreeWidgetItem()
- self.uptodateItem.setText(0, "Installed")
+ self.uptodateItem.setText(0, self.tr('Installed'))
self.toupdateItem = QTreeWidgetItem()
- self.toupdateItem.setText(0, "Upgradable")
+ self.toupdateItem.setText(0, self.tr('Upgradable'))
self.notinstalledItem = QTreeWidgetItem()
- self.notinstalledItem.setText(0, "Not installed")
+ self.notinstalledItem.setText(0, self.tr('Not installed'))
self.toupdateItem.setIcon(0, self.icon)
self.uptodateItem.setIcon(0, self.icon)
self.notinstalledItem.setIcon(0, self.icon)
- resources = readUrl(self.urlBase + "list.txt").splitlines()
- resources = [r.split(",") for r in resources]
+ resources = readUrl(self.urlBase + 'list.txt').splitlines()
+ resources = [r.split(',') for r in resources]
for filename, version, name in resources:
treeBranch = self.getTreeBranchForState(filename, float(version))
item = TreeItem(filename, name, self.icon)
@@ -151,15 +155,15 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
def currentItemChanged(self, item, prev):
if isinstance(item, TreeItem):
try:
- url = self.urlBase + item.filename.replace(" ","%20") + ".help"
+ url = self.urlBase + item.filename.replace(' ', '%20') + '.help'
helpContent = readUrl(url)
descriptions = json.loads(helpContent)
- html = "%s
" % item.name
- html+="Description: " + getDescription(ALG_DESC, descriptions)+"
"
- html+="Created by: " + getDescription(ALG_CREATOR, descriptions)+"
"
- html+="Version: " + getDescription(ALG_VERSION, descriptions)+"
"
+ html = '%s
' % item.name
+ html += self.tr('Description:%s
') % getDescription(ALG_DESC, descriptions)
+ html += self.tr('Created by:%s') % getDescription(ALG_CREATOR, descriptions)
+ html += self.tr('
Version:%s') % getDescription(ALG_VERSION, descriptions)
except HTTPError, e:
- html = "
No detailed description available for this script
"
+ html = self.tr('No detailed description available for this script
')
self.webView.setHtml(html)
else:
self.webView.setHtml(self.HELP_TEXT)
@@ -168,7 +172,7 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
if not os.path.exists(os.path.join(self.folder, filename)):
return self.notinstalledItem
else:
- helpFile = os.path.join(self.folder, filename + ".help")
+ helpFile = os.path.join(self.folder, filename + '.help')
try:
with open(helpFile) as f:
helpContent = json.load(f)
@@ -199,16 +203,17 @@ class GetScriptsAndModelsDialog(QDialog, Ui_DlgGetScriptsAndModels):
self.progressBar.setMaximum(len(toDownload))
for i, filename in enumerate(toDownload):
QCoreApplication.processEvents()
- url = self.urlBase + filename.replace(" ","%20")
+ url = self.urlBase + filename.replace(' ','%20')
try:
code = readUrl(url)
path = os.path.join(self.folder, filename)
- with open(path, "w") as f:
+ with open(path, 'w') as f:
f.write(code)
self.progressBar.setValue(i + 1)
except HTTPError:
- QMessageBox.critical(iface.mainWindow(), "Connection problem",
- "Could not download file :" + filename)
+ QMessageBox.critical(iface.mainWindow(),
+ self.tr('Connection problem'),
+ self.tr('Could not download file: %s') % filename)
return
diff --git a/python/plugins/processing/gui/Help2Html.py b/python/plugins/processing/gui/Help2Html.py
index bc993831b4a..88ce3400f38 100644
--- a/python/plugins/processing/gui/Help2Html.py
+++ b/python/plugins/processing/gui/Help2Html.py
@@ -68,20 +68,20 @@ def getHtmlFromHelpFile(alg, helpFile):
def getHtmlFromDescriptionsDict(alg, descriptions):
- s = 'Algorithm description
\n'
+ s = tr('Algorithm description
\n')
s += '' + getDescription(ALG_DESC, descriptions) + '
\n'
- s += 'Input parameters
\n'
+ s += tr('Input parameters
\n')
for param in alg.parameters:
s += '' + param.description + '
\n'
s += '' + getDescription(param.name, descriptions) + '
\n'
- s += 'Outputs
\n'
+ s += tr('Outputs
\n')
for out in alg.outputs:
s += '' + out.description + '
\n'
s += '' + getDescription(out.name, descriptions) + '
\n'
s += '
'
- s += 'Algorithm author: ' + getDescription(ALG_CREATOR, descriptions) + '
'
- s += 'Help author: ' + getDescription(ALG_HELP_CREATOR, descriptions) + '
'
- s += 'Algorithm version: ' + getDescription(ALG_VERSION, descriptions) + '
'
+ s += tr('Algorithm author: %s
') % getDescription(ALG_CREATOR, descriptions)
+ s += tr('Help author: %s
') + getDescription(ALG_HELP_CREATOR, descriptions)
+ s += tr('Algorithm version: %s
') + getDescription(ALG_VERSION, descriptions)
s += ''
return s
@@ -92,3 +92,5 @@ def getDescription(name, descriptions):
else:
return ''
+def tr(string):
+ return QtCore.QCoreApplication.translate('Help2Html', string)
diff --git a/python/plugins/processing/gui/HelpEditionDialog.py b/python/plugins/processing/gui/HelpEditionDialog.py
index 6f46e7d90d1..6d10f6dc2e9 100644
--- a/python/plugins/processing/gui/HelpEditionDialog.py
+++ b/python/plugins/processing/gui/HelpEditionDialog.py
@@ -58,7 +58,8 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
with open(helpfile) as f:
self.descriptions = json.load(f)
except Exception, e:
- ProcessingLog.addToLog(ProcessingLog.LOG_WARNING, "Cannot open help file: " + helpfile)
+ ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
+ self.tr('Cannot open help file: %s') % helpfile)
self.currentName = self.ALG_DESC
if self.ALG_DESC in self.descriptions:
@@ -82,32 +83,32 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
with open(self.alg.descriptionFile + '.help', 'w') as f:
json.dump(self.descriptions, f)
except Exception, e:
- QMessageBox.warning(self, 'Error saving help file',
- 'Help file could not be saved.\n'
- 'Check that you have permission to modify the help\n'
- 'file. You might not have permission if you are \n'
- 'editing an example model or script, since they \n'
- 'are stored on the installation folder')
+ QMessageBox.warning(self, self.tr('Error saving help file'),
+ self.tr('Help file could not be saved.\n'
+ 'Check that you have permission to modify the help\n'
+ 'file. You might not have permission if you are \n'
+ 'editing an example model or script, since they \n'
+ 'are stored on the installation folder'))
QDialog.accept(self)
def getHtml(self):
- s = 'Algorithm description
\n'
+ s = self.tr('Algorithm description
\n')
s += '' + self.getDescription(self.ALG_DESC) + '
\n'
- s += 'Input parameters
\n'
+ s += self.tr('Input parameters
\n')
for param in self.alg.parameters:
s += '' + param.description + '
\n'
s += '' + self.getDescription(param.name) + '
\n'
- s += 'Outputs
\n'
+ s += self.tr('Outputs
\n')
for out in self.alg.outputs:
s += '' + out.description + '
\n'
s += '' + self.getDescription(out.name) + '
\n'
return s
def fillTree(self):
- item = TreeDescriptionItem('Algorithm description', self.ALG_DESC)
+ item = TreeDescriptionItem(self.tr('Algorithm description'), self.ALG_DESC)
self.tree.addTopLevelItem(item)
- parametersItem = TreeDescriptionItem('Input parameters', None)
+ parametersItem = TreeDescriptionItem(self.tr('Input parameters'), None)
self.tree.addTopLevelItem(parametersItem)
for param in self.alg.parameters:
item = TreeDescriptionItem(param.description, param.name)
@@ -117,12 +118,12 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
for out in self.alg.outputs:
item = TreeDescriptionItem(out.description, out.name)
outputsItem.addChild(item)
- item = TreeDescriptionItem('Algorithm created by', self.ALG_CREATOR)
+ item = TreeDescriptionItem(self.tr('Algorithm created by'), self.ALG_CREATOR)
self.tree.addTopLevelItem(item)
- item = TreeDescriptionItem('Algorithm help written by',
+ item = TreeDescriptionItem(self.tr('Algorithm help written by'),
self.ALG_HELP_CREATOR)
self.tree.addTopLevelItem(item)
- item = TreeDescriptionItem('Algorithm version',
+ item = TreeDescriptionItem(self.tr('Algorithm version'),
self.ALG_VERSION)
self.tree.addTopLevelItem(item)
diff --git a/python/plugins/processing/gui/HistoryDialog.py b/python/plugins/processing/gui/HistoryDialog.py
index 6bcd11690e7..e126180a581 100644
--- a/python/plugins/processing/gui/HistoryDialog.py
+++ b/python/plugins/processing/gui/HistoryDialog.py
@@ -77,7 +77,7 @@ class HistoryDialog(QDialog, Ui_DlgHistory):
def saveLog(self):
fileName = QFileDialog.getSaveFileName(self,
- self.tr('Save file'), '.', 'Log files (*.log *.LOG)')
+ self.tr('Save file'), '.', self.tr('Log files (*.log *.LOG)'))
if fileName == '':
return
diff --git a/python/plugins/processing/gui/InputLayerSelectorPanel.py b/python/plugins/processing/gui/InputLayerSelectorPanel.py
index dd589748c45..9e8205a7682 100644
--- a/python/plugins/processing/gui/InputLayerSelectorPanel.py
+++ b/python/plugins/processing/gui/InputLayerSelectorPanel.py
@@ -63,7 +63,7 @@ class InputLayerSelectorPanel(QtGui.QWidget):
path = ''
filename = QtGui.QFileDialog.getOpenFileName(self, self.param.description, path,
- 'All files(*.*);;' + self.param.getFileFilter())
+ self.tr('All files(*.*);;') + self.param.getFileFilter())
if filename:
self.text.addItem(filename, filename)
self.text.setCurrentIndex(self.text.count() - 1)
diff --git a/python/plugins/processing/gui/MessageBarProgress.py b/python/plugins/processing/gui/MessageBarProgress.py
index 87496ee32ee..59ab6229389 100644
--- a/python/plugins/processing/gui/MessageBarProgress.py
+++ b/python/plugins/processing/gui/MessageBarProgress.py
@@ -45,9 +45,8 @@ class MessageBarProgress:
def error(self, msg):
iface.messageBar().clearWidgets()
- iface.messageBar().pushMessage("Error", msg,
- level = QgsMessageBar.CRITICAL,
- duration = 3)
+ iface.messageBar().pushMessage(self.tr('Error'),
+ msg, level=QgsMessageBar.CRITICAL, duration=3)
def setText(self, text):
pass
diff --git a/python/plugins/processing/gui/MissingDependencyDialog.py b/python/plugins/processing/gui/MissingDependencyDialog.py
index 70a6eefba20..871a664f41e 100644
--- a/python/plugins/processing/gui/MissingDependencyDialog.py
+++ b/python/plugins/processing/gui/MissingDependencyDialog.py
@@ -36,21 +36,20 @@ class MissingDependencyDialog(QtGui.QDialog):
def __init__(self, msg):
QtGui.QDialog.__init__(self, None, QtCore.Qt.WindowSystemMenuHint
| QtCore.Qt.WindowTitleHint)
- self.msg = \
- 'Missing dependency.This algorithm cannot be run :-(
' \
- + msg
+ self.msg = self.tr('Missing dependency.This algorithm cannot '
+ 'be run :-(
\n%s') % msg
self.setupUi()
def setupUi(self):
self.resize(500, 300)
- self.setWindowTitle('Missing dependency')
+ self.setWindowTitle(self.tr('Missing dependency'))
layout = QVBoxLayout()
browser = QtGui.QTextBrowser()
browser.setOpenLinks(False)
browser.anchorClicked.connect(self.linkClicked)
browser.setHtml(self.msg)
button = QPushButton()
- button.setText('Close')
+ button.setText(self.tr('Close'))
button.clicked.connect(self.closeButtonPressed)
buttonBox = QtGui.QDialogButtonBox()
buttonBox.setOrientation(QtCore.Qt.Horizontal)
diff --git a/python/plugins/processing/gui/MultipleFileInputDialog.py b/python/plugins/processing/gui/MultipleFileInputDialog.py
index c65d03b8d06..d882458d2fa 100644
--- a/python/plugins/processing/gui/MultipleFileInputDialog.py
+++ b/python/plugins/processing/gui/MultipleFileInputDialog.py
@@ -42,7 +42,7 @@ class MultipleFileInputDialog(QtGui.QDialog):
def setupUi(self):
self.resize(381, 320)
- self.setWindowTitle("Multiple selection")
+ self.setWindowTitle(self.tr("Multiple selection"))
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
@@ -92,7 +92,8 @@ class MultipleFileInputDialog(QtGui.QDialog):
else :
path = QtCore.QDir.currentPath()
- filesOpened = QtGui.QFileDialog.getOpenFileNames( None, "Select the file(s) to use", path, "All files (*.*)" )
+ filesOpened = QtGui.QFileDialog.getOpenFileNames(None,
+ self.tr('Select the file(s) to use'), path, self.tr('All files (*.*)'))
lastfile = ""
for item in filesOpened:
diff --git a/python/plugins/processing/gui/MultipleFileInputPanel.py b/python/plugins/processing/gui/MultipleFileInputPanel.py
index df482c8f37f..6b4b6f9651d 100644
--- a/python/plugins/processing/gui/MultipleFileInputPanel.py
+++ b/python/plugins/processing/gui/MultipleFileInputPanel.py
@@ -39,11 +39,11 @@ class MultipleFileInputPanel(QtGui.QWidget):
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.label = QtGui.QLabel()
- self.label.setText("0 elements selected")
+ self.label.setText(self.tr('0 elements selected'))
self.label.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.label)
self.pushButton = QtGui.QPushButton()
- self.pushButton.setText("...")
+ self.pushButton.setText(self.tr('...'))
self.pushButton.clicked.connect(self.showSelectionDialog)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
@@ -51,11 +51,11 @@ class MultipleFileInputPanel(QtGui.QWidget):
def setSelectedItems(self, selected):
#no checking is performed!
self.selectedoptions = selected
- self.label.setText(str(len(self.selectedoptions)) + " elements selected")
+ self.label.setText(self.tr('%d elements selected') % len(self.selectedoptions))
def showSelectionDialog(self):
dlg = MultipleFileInputDialog(self.selectedoptions)
dlg.exec_()
if dlg.selectedoptions != None:
self.selectedoptions = dlg.selectedoptions
- self.label.setText(str(len(self.selectedoptions)) + " elements selected")
+ self.label.setText(self.tr('%d elements selected') % len(self.selectedoptions))
diff --git a/python/plugins/processing/gui/ParametersDialog.py b/python/plugins/processing/gui/ParametersDialog.py
index a310bd8096d..a4b340fac56 100644
--- a/python/plugins/processing/gui/ParametersDialog.py
+++ b/python/plugins/processing/gui/ParametersDialog.py
@@ -36,10 +36,11 @@ class ParametersDialog(AlgorithmExecutionDialog):
NOT_SELECTED = QtCore.QCoreApplication.translate('ParametersDialog', '[Not selected]')
def __init__(self, alg):
+ AlgorithmExecutionDialog.__init__(self, alg, self.scrollArea)
+
self.paramTable = ParametersPanel(self, alg)
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setFrameShape(QtGui.QFrame.NoFrame);
self.scrollArea.setWidget(self.paramTable)
self.scrollArea.setWidgetResizable(True)
- AlgorithmExecutionDialog.__init__(self, alg, self.scrollArea)
self.executed = False
diff --git a/python/plugins/processing/gui/ParametersPanel.py b/python/plugins/processing/gui/ParametersPanel.py
index 1e0ef81efa5..c6323147dd7 100644
--- a/python/plugins/processing/gui/ParametersPanel.py
+++ b/python/plugins/processing/gui/ParametersPanel.py
@@ -71,7 +71,7 @@ from processing.tools import dataobjects
class ParametersPanel(QWidget):
- NOT_SELECTED = '[Not selected]'
+ NOT_SELECTED = QCoreApplication.translate('ParametersPanel', '[Not selected]')
def __init__(self, parent, alg):
super(ParametersPanel, self).__init__(None)
@@ -96,7 +96,7 @@ class ParametersPanel(QWidget):
for param in self.alg.parameters:
if param.isAdvanced:
self.advancedButton = QPushButton()
- self.advancedButton.setText('Show advanced parameters')
+ self.advancedButton.setText(self.tr('Show advanced parameters'))
self.advancedButton.setMaximumWidth(250)
self.advancedButton.clicked.connect(
self.showAdvancedParametersClicked)
@@ -110,7 +110,7 @@ class ParametersPanel(QWidget):
desc += ' (xmin, xmax, ymin, ymax)'
try:
if param.optional:
- desc += ' [optional]'
+ desc += self.tr(' [optional]')
except:
pass
widget = self.getWidgetFromParameter(param)
@@ -126,7 +126,7 @@ class ParametersPanel(QWidget):
icon = QIcon(os.path.dirname(__file__)
+ '/../images/iterate.png')
button.setIcon(icon)
- button.setToolTip('Iterate over this layer')
+ button.setToolTip(self.tr('Iterate over this layer'))
button.setCheckable(True)
button.setMaximumWidth(30)
button.setMaximumHeight(30)
@@ -169,7 +169,7 @@ class ParametersPanel(QWidget):
self.verticalLayout.addWidget(widget)
if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
check = QCheckBox()
- check.setText('Open output file after running algorithm')
+ check.setText(self.tr('Open output file after running algorithm'))
check.setChecked(True)
self.verticalLayout.addWidget(check)
self.checkBoxes[output.name] = check
@@ -181,9 +181,9 @@ class ParametersPanel(QWidget):
def showAdvancedParametersClicked(self):
self.showAdvanced = not self.showAdvanced
if self.showAdvanced:
- self.advancedButton.setText('Hide advanced parameters')
+ self.advancedButton.setText(self.tr('Hide advanced parameters'))
else:
- self.advancedButton.setText('Show advanced parameters')
+ self.advancedButton.setText(self.tr('Show advanced parameters'))
for param in self.alg.parameters:
if param.isAdvanced:
self.labels[param.name].setVisible(self.showAdvanced)
@@ -280,7 +280,7 @@ class ParametersPanel(QWidget):
layers = dataobjects.getTables()
if len(layers) > 0:
if param.optional:
- item.addItem("[not set]")
+ item.addItem(self.tr("[not set]"))
item.addItems(self.getFields(layers[0], param.datatype))
elif isinstance(param, ParameterSelection):
item = QComboBox()
@@ -343,7 +343,7 @@ class ParametersPanel(QWidget):
widget = self.valueItems[child]
widget.clear()
if self.alg.getParameterFromName(child).optional:
- widget.addItem("[not set]")
+ widget.addItem(self.tr("[not set]"))
widget.addItems(self.getFields(layer,
self.alg.getParameterFromName(child).datatype))
diff --git a/python/plugins/processing/gui/Postprocessing.py b/python/plugins/processing/gui/Postprocessing.py
index a92a19c1002..b8c5f5bc2e1 100644
--- a/python/plugins/processing/gui/Postprocessing.py
+++ b/python/plugins/processing/gui/Postprocessing.py
@@ -27,6 +27,7 @@ __revision__ = '$Format:%H$'
import os
from PyQt4.QtGui import *
+from PyQt4.QtCore import *
from qgis.core import *
from processing.gui.SilentProgress import SilentProgress
from processing.core.ProcessingConfig import ProcessingConfig
@@ -45,7 +46,7 @@ def handleAlgorithmResults(alg, progress=None, showResults=True):
htmlResults = False
if progress is None:
progress = SilentProgress()
- progress.setText('Loading resulting layers')
+ progress.setText(QCoreApplication.translate('Postprocessing', 'Loading resulting layers'))
i = 0
for out in alg.outputs:
progress.setPercentage(100 * i / float(len(alg.outputs)))
diff --git a/python/plugins/processing/gui/RangePanel.py b/python/plugins/processing/gui/RangePanel.py
index d44c8623ad0..a8bae764b87 100644
--- a/python/plugins/processing/gui/RangePanel.py
+++ b/python/plugins/processing/gui/RangePanel.py
@@ -36,12 +36,12 @@ class RangePanel(QtGui.QWidget):
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.labelmin = QtGui.QLabel()
- self.labelmin.setText('Min')
+ self.labelmin.setText(self.tr('Min'))
self.textmin = QtGui.QLineEdit()
self.textmin.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
self.labelmax = QtGui.QLabel()
- self.labelmax.setText('Max')
+ self.labelmax.setText(self.tr('Max'))
self.textmax = QtGui.QLineEdit()
self.textmin.setText(param.default.split(',')[0])
self.textmax.setText(param.default.split(',')[1])
diff --git a/python/plugins/processing/gui/RenderingStyleFilePanel.py b/python/plugins/processing/gui/RenderingStyleFilePanel.py
index da20dcf0c29..eb87a98830f 100644
--- a/python/plugins/processing/gui/RenderingStyleFilePanel.py
+++ b/python/plugins/processing/gui/RenderingStyleFilePanel.py
@@ -48,8 +48,8 @@ class RenderingStyleFilePanel(QtGui.QWidget):
self.setLayout(self.horizontalLayout)
def showSelectionDialog(self):
- filename = QtGui.QFileDialog.getOpenFileName(self, 'Select style file'
- , '', '*.qml')
+ filename = QtGui.QFileDialog.getOpenFileName(self,
+ self.tr('Select style file'), '', self.tr('QGIS Layer Style File (*.qml *.QML)'))
if filename:
self.text.setText(unicode(filename))
diff --git a/python/plugins/processing/gui/TestTools.py b/python/plugins/processing/gui/TestTools.py
index df0f91f540b..4f4393ffebc 100644
--- a/python/plugins/processing/gui/TestTools.py
+++ b/python/plugins/processing/gui/TestTools.py
@@ -64,9 +64,9 @@ def createTest(text):
for out in alg.outputs:
filename = (tokens[i])[1:-1]
if tokens[i] == str(None):
- QtGui.QMessageBox.critical(None, 'Error',
- 'Cannot create unit test for that algorithm \
- execution.\nThe output cannot be a temporary file')
+ QtGui.QMessageBox.critical(None, tr('Error'),
+ tr('Cannot create unit test for that algorithm execution. The '
+ 'output cannot be a temporary file'))
return
s += "\toutput=outputs['" + out.name + "']\n"
if isinstance(out, (OutputNumber, OutputString)):
@@ -111,6 +111,9 @@ def createTest(text):
dlg = ShowTestDialog(s)
dlg.exec_()
+def tr(string):
+ return QCoreApplication.translate('TestTools', string)
+
class ShowTestDialog(QtGui.QDialog):
@@ -118,7 +121,7 @@ class ShowTestDialog(QtGui.QDialog):
QtGui.QDialog.__init__(self)
self.setModal(True)
self.resize(600, 400)
- self.setWindowTitle('Unit test')
+ self.setWindowTitle(self.tr('Unit test'))
layout = QVBoxLayout()
self.text = QtGui.QTextEdit()
self.text.setEnabled(True)
diff --git a/python/plugins/processing/modeler/AddModelFromFileAction.py b/python/plugins/processing/modeler/AddModelFromFileAction.py
index ba21f5b988b..c9fc69bebea 100644
--- a/python/plugins/processing/modeler/AddModelFromFileAction.py
+++ b/python/plugins/processing/modeler/AddModelFromFileAction.py
@@ -36,23 +36,28 @@ from processing.modeler.ModelerUtils import ModelerUtils
class AddModelFromFileAction(ToolboxAction):
def __init__(self):
- self.name = "Add model from file"
- self.group = 'Tools'
+ self.name = self.tr('Add model from file', 'AddModelFromFileAction')
+ self.group = self.tr('Tools', 'AddModelFromFileAction')
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + '/../images/model.png')
def execute(self):
- filename = QtGui.QFileDialog.getOpenFileName(self.toolbox, 'model files', None,
- '*.model')
+ filename = QtGui.QFileDialog.getOpenFileName(self.toolbox,
+ self.tr('Open model', 'AddModelFromFileAction'), None,
+ self.tr('Processing model files (*.model *.MODEL)', 'AddModelFromFileAction'))
if filename:
try:
ModelerAlgorithm.fromFile(filename)
except WrongModelException:
- QtGui.QMessageBox.warning(self.toolbox, "Error reading model", "The selected file does not contain a valid model")
+ QtGui.QMessageBox.warning(self.toolbox,
+ self.tr('Error reading model', 'AddModelFromFileAction'),
+ self.tr('The selected file does not contain a valid model', 'AddModelFromFileAction'))
return
except:
- QtGui.QMessageBox.warning(self.toolbox, "Error reading model", "Cannot read file")
+ QtGui.QMessageBox.warning(self.toolbox,
+ self.tr('Error reading model', 'AddModelFromFileAction'),
+ self.tr('Cannot read file', 'AddModelFromFileAction'))
destFilename = os.path.join(ModelerUtils.modelsFolder(), os.path.basename(filename))
shutil.copyfile(filename,destFilename)
- self.toolbox.updateProvider('script')
\ No newline at end of file
+ self.toolbox.updateProvider('model')
diff --git a/python/plugins/processing/modeler/CalculatorModelerAlgorithm.py b/python/plugins/processing/modeler/CalculatorModelerAlgorithm.py
index 6d29144e563..1dbd41a0ff8 100644
--- a/python/plugins/processing/modeler/CalculatorModelerAlgorithm.py
+++ b/python/plugins/processing/modeler/CalculatorModelerAlgorithm.py
@@ -46,13 +46,15 @@ class CalculatorModelerAlgorithm(GeoAlgorithm):
def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False
- self.name = 'Calculator'
- self.group = 'Modeler-only tools'
- self.addParameter(ParameterString(FORMULA, 'Formula', ''))
+ self.name = self.tr('Calculator', 'CalculatorModelerAlgorithm')
+ self.group = self.tr('Modeler-only tools', 'CalculatorModelerAlgorithm')
+ self.addParameter(ParameterString(FORMULA,
+ self.tr('Formula', 'CalculatorModelerAlgorithm'), ''))
for i in range(AVAILABLE_VARIABLES):
self.addParameter(ParameterNumber(NUMBER
+ str(i), 'dummy'))
- self.addOutput(OutputNumber(RESULT, 'Result'))
+ self.addOutput(OutputNumber(RESULT,
+ self.tr('Result', 'CalculatorModelerAlgorithm')))
def processAlgorithm(self, progress):
formula = self.getParameterValue(FORMULA)
@@ -64,7 +66,8 @@ class CalculatorModelerAlgorithm(GeoAlgorithm):
result = eval(formula)
self.setOutputValue(RESULT, result)
except:
- raise GeoAlgorithmExecutionException('Wrong formula: ' + formula)
+ raise GeoAlgorithmExecutionException(
+ self.tr('Wrong formula: %s', 'CalculatorModelerAlgorithm') % formula)
def getCustomModelerParametersDialog(self, modelAlg, algIndex=None):
return CalculatorModelerParametersDialog(self, modelAlg, algIndex)
@@ -82,21 +85,21 @@ class CalculatorModelerParametersDialog(ModelerParametersDialog):
| QtGui.QDialogButtonBox.Ok)
self.infoText = QtGui.QTextEdit()
numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber)
- text = ('You can refer to model values in you formula, using'
- 'single-letter variables, as follows:\n')
+ text = self.tr('You can refer to model values in you formula, using'
+ 'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog')
ichar = 97
if numbers:
for number in numbers:
text += chr(ichar) + '->' + self.resolveValueDescription(number) + '\n'
ichar += 1
else:
- text += "\n - No numerical variables are available."
+ text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog')
self.infoText.setText(text)
self.infoText.setEnabled(False)
self.formulaText = QtGui.QLineEdit()
if hasattr(self.formulaText, 'setPlaceholderText'):
- self.formulaText.setPlaceholderText('[Enter your formula here]')
- self.setWindowTitle("Calculator")
+ self.formulaText.setPlaceholderText(self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog'))
+ self.setWindowTitle(self.tr('Calculator', 'CalculatorModelerParametersDialog'))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
@@ -113,7 +116,7 @@ class CalculatorModelerParametersDialog(ModelerParametersDialog):
def createAlgorithm(self):
alg = Algorithm('modelertools:calculator')
alg.setName(self.model)
- alg.description = "Calculator"
+ alg.description = self.tr('Calculator', 'CalculatorModelerParametersDialog')
formula = self.formulaText.text()
alg.params[FORMULA] = formula
diff --git a/python/plugins/processing/modeler/CreateNewModelAction.py b/python/plugins/processing/modeler/CreateNewModelAction.py
index d4fb8da8d08..50e9c0cf25f 100644
--- a/python/plugins/processing/modeler/CreateNewModelAction.py
+++ b/python/plugins/processing/modeler/CreateNewModelAction.py
@@ -33,8 +33,8 @@ from processing.modeler.ModelerDialog import ModelerDialog
class CreateNewModelAction(ToolboxAction):
def __init__(self):
- self.name = 'Create new model'
- self.group = 'Tools'
+ self.name = self.tr('Create new model', 'CreateNewModelAction')
+ self.group = self.tr('Tools', 'CreateNewModelAction')
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + '/../images/model.png')
diff --git a/python/plugins/processing/modeler/DeleteModelAction.py b/python/plugins/processing/modeler/DeleteModelAction.py
index 530c63ea8b7..92ff031eaec 100644
--- a/python/plugins/processing/modeler/DeleteModelAction.py
+++ b/python/plugins/processing/modeler/DeleteModelAction.py
@@ -34,14 +34,15 @@ from processing.modeler.ModelerAlgorithm import ModelerAlgorithm
class DeleteModelAction(ContextAction):
def __init__(self):
- self.name = 'Delete model'
+ self.name = self.tr('Delete model', 'DeleteModelAction')
def isEnabled(self):
return isinstance(self.alg, ModelerAlgorithm)
def execute(self):
- reply = QtGui.QMessageBox.question(None, 'Confirmation',
- 'Are you sure you want to delete this model?',
+ reply = QtGui.QMessageBox.question(None,
+ self.tr('Confirmation', 'DeleteModelAction'),
+ self.tr('Are you sure you want to delete this model?', 'DeleteModelAction'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
diff --git a/python/plugins/processing/modeler/EditModelAction.py b/python/plugins/processing/modeler/EditModelAction.py
index d882bc9a012..8152d1e7f73 100644
--- a/python/plugins/processing/modeler/EditModelAction.py
+++ b/python/plugins/processing/modeler/EditModelAction.py
@@ -32,7 +32,7 @@ from processing.modeler.ModelerDialog import ModelerDialog
class EditModelAction(ContextAction):
def __init__(self):
- self.name = 'Edit model'
+ self.name = self.tr('Edit model', 'EditModelAction')
def isEnabled(self):
return isinstance(self.alg, ModelerAlgorithm)
diff --git a/python/plugins/processing/modeler/ModelerAlgorithm.py b/python/plugins/processing/modeler/ModelerAlgorithm.py
index 1a208dbe23b..4c60c20e4b4 100644
--- a/python/plugins/processing/modeler/ModelerAlgorithm.py
+++ b/python/plugins/processing/modeler/ModelerAlgorithm.py
@@ -170,7 +170,7 @@ class ModelerAlgorithm(GeoAlgorithm):
return newone
def __init__(self):
- self.name = "Model"
+ self.name = self.tr('Model', 'ModelerAlgorithm')
# The dialog where this model is being edited
self.modelerdialog = None
self.descriptionFile = None
@@ -330,8 +330,8 @@ class ModelerAlgorithm(GeoAlgorithm):
# algorithms to skip some conversion routines
if not param.setValue(value) and not isinstance(param,
ParameterDataObject):
- raise GeoAlgorithmExecutionException('Wrong value: '
- + str(value))
+ raise GeoAlgorithmExecutionException(
+ self.tr('Wrong value: %s', 'ModelerAlgorithm') % value)
for out in algInstance.outputs:
if not out.hidden:
if out.name in alg.outputs:
@@ -424,9 +424,11 @@ class ModelerAlgorithm(GeoAlgorithm):
break
if canExecute:
try:
- progress.setDebugInfo('Prepare algorithm: ' + alg.name)
+ progress.setDebugInfo(
+ self.tr('Prepare algorithm: %s', 'ModelerAlgorithm') % alg.name)
self.prepareAlgorithm(alg)
- progress.setText('Running %s [%i/%i]' % ( alg.description, len(executed) + 1 ,len(toExecute)))
+ progress.setText(
+ self.tr('Running %s [%i/%i]', 'ModelerAlgorithm') % (alg.description, len(executed) + 1 ,len(toExecute)))
progress.setDebugInfo('Parameters: ' + ', '.join([unicode(p).strip()
+ '=' + unicode(p.value) for p in alg.algorithm.parameters]))
t0 = time.time()
@@ -434,15 +436,14 @@ class ModelerAlgorithm(GeoAlgorithm):
dt = time.time() - t0
executed.append(alg.name)
progress.setDebugInfo(
- 'OK. Execution took %0.3f ms (%i outputs).'
- % (dt, len(alg.algorithm.outputs)))
+ self.tr('OK. Execution took %0.3f ms (%i outputs).', 'ModelerAlgorithm') % (dt, len(alg.algorithm.outputs)))
except GeoAlgorithmExecutionException, e:
- progress.setDebugInfo('Failed')
+ progress.setDebugInfo(self.tr('Failed', 'ModelerAlgorithm'))
raise GeoAlgorithmExecutionException(
- 'Error executing algorithm %s\n%s' % (alg.description, e.msg))
+ self.tr('Error executing algorithm %s\n%s', 'ModelerAlgorithm') % (alg.description, e.msg))
progress.setDebugInfo(
- 'Model processed ok. Executed %i algorithms total' % len(executed))
+ self.tr('Model processed ok. Executed %i algorithms total', 'ModelerAlgorithm') % len(executed))
def getAsCommand(self):
@@ -558,8 +559,8 @@ class ModelerAlgorithm(GeoAlgorithm):
if param:
pass
else:
- raise WrongModelException('Error in parameter line: '
- + line)
+ raise WrongModelException(
+ self.tr('Error in parameter line: %s', 'ModelerAlgorithm') % line)
line = lines.readline().strip('\n')
tokens = line.split(',')
model.addParameter(ModelerParameter(param, QtCore.QPointF(
@@ -621,8 +622,8 @@ class ModelerAlgorithm(GeoAlgorithm):
model.addAlgorithm(modelAlg)
modelAlgs.append(modelAlg.name)
else:
- raise WrongModelException('Error in algorithm name: '
- + algLine)
+ raise WrongModelException(
+ self.tr('Error in algorithm name: %s', 'ModelerAlgorithm') % algLine)
line = lines.readline().strip('\n').strip('\r')
for modelAlg in model.algs.values():
for name, value in modelAlg.params.iteritems():
@@ -633,5 +634,4 @@ class ModelerAlgorithm(GeoAlgorithm):
if isinstance(e, WrongModelException):
raise e
else:
- raise WrongModelException('Error in model definition line:'
- + line.strip() + ' : ' + traceback.format_exc())
+ raise WrongModelException(self.tr('Error in model definition line: %s\n%s', 'ModelerAlgorithm') % (line.strip(), traceback.format_exc()))
diff --git a/python/plugins/processing/modeler/ModelerAlgorithmProvider.py b/python/plugins/processing/modeler/ModelerAlgorithmProvider.py
index a28b0ecea8b..803b461a3a1 100644
--- a/python/plugins/processing/modeler/ModelerAlgorithmProvider.py
+++ b/python/plugins/processing/modeler/ModelerAlgorithmProvider.py
@@ -51,8 +51,8 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
ProcessingConfig.addSetting(Setting(self.getDescription(),
- ModelerUtils.MODELS_FOLDER, 'Models folder'
- , ModelerUtils.modelsFolder()))
+ ModelerUtils.MODELS_FOLDER, self.tr('Models folder', 'ModelerAlgorithmProvider'),
+ ModelerUtils.modelsFolder()))
def setAlgsList(self, algs):
ModelerUtils.allAlgs = algs
@@ -61,7 +61,7 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
return ModelerUtils.modelsFolder()
def getDescription(self):
- return 'Models'
+ return self.tr('Models', 'ModelerAlgorithmProvider')
def getName(self):
return 'model'
@@ -86,5 +86,4 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
self.algs.append(alg)
except WrongModelException, e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- 'Could not load model ' + descriptionFile + '\n'
- + e.msg)
+ self.tr('Could not load model %s\n%s', 'ModelerAlgorithmProvider') % (descriptionFile, e.msg))
diff --git a/python/plugins/processing/modeler/ModelerDialog.py b/python/plugins/processing/modeler/ModelerDialog.py
index 1b292fe85ba..ac98775e16f 100644
--- a/python/plugins/processing/modeler/ModelerDialog.py
+++ b/python/plugins/processing/modeler/ModelerDialog.py
@@ -166,9 +166,9 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
if hasattr(self.searchBox, 'setPlaceholderText'):
self.searchBox.setPlaceholderText(self.tr('Search...'))
if hasattr(self.textName, 'setPlaceholderText'):
- self.textName.setPlaceholderText('[Enter model name here]')
+ self.textName.setPlaceholderText(self.tr('[Enter model name here]'))
if hasattr(self.textGroup, 'setPlaceholderText'):
- self.textGroup.setPlaceholderText('[Enter group name here]')
+ self.textGroup.setPlaceholderText(self.tr('[Enter group name here]'))
# Connect signals and slots
self.inputsTree.doubleClicked.connect(self.addInput)
@@ -313,7 +313,7 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
def openModel(self):
filename = unicode(QFileDialog.getOpenFileName(self,
self.tr('Open Model'), ModelerUtils.modelsFolder(),
- self.tr('Processing models (*.model)')))
+ self.tr('Processing models (*.model *.MODEL)')))
if filename:
try:
alg = ModelerAlgorithm.fromFile(filename)
@@ -327,18 +327,16 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
self.hasChanged = False
except WrongModelException, e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- 'Could not load model ' + filename + '\n'
- + e.msg)
+ self.tr('Could not load model %s\n%s') % (filename, e.msg))
QMessageBox.critical(self, self.tr('Could not open model'),
self.tr('The selected model could not be loaded.\n'
'See the log for more information.'))
except Exception, e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
- 'Could not load model ' + filename + '\n'
- + e.args[0])
+ self.tr('Could not load model %s\n%s') % (filename, e.args[0]))
QMessageBox.critical(self, self.tr('Could not open model'),
- self.tr('The selected model could not be loaded.\n'
- 'See the log for more information.'))
+ self.tr('The selected model could not be loaded.\n'
+ 'See the log for more information.'))
def repaintModel(self):
self.scene = ModelerScene()
@@ -483,7 +481,7 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
if len(groups) > 0:
mainItem = QTreeWidgetItem()
- mainItem.setText(0, 'Geoalgorithms')
+ mainItem.setText(0, self.tr('Geoalgorithms'))
mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
mainItem.setToolTip(0, mainItem.text(0))
for (groupname, group) in groups.items():
diff --git a/python/plugins/processing/modeler/ModelerOnlyAlgorithmProvider.py b/python/plugins/processing/modeler/ModelerOnlyAlgorithmProvider.py
index b3ca8ea34a1..32d08945dbc 100644
--- a/python/plugins/processing/modeler/ModelerOnlyAlgorithmProvider.py
+++ b/python/plugins/processing/modeler/ModelerOnlyAlgorithmProvider.py
@@ -46,7 +46,7 @@ class ModelerOnlyAlgorithmProvider(AlgorithmProvider):
return 'modelertools'
def getDescription(self):
- return 'Modeler-only tools'
+ return self.tr('Modeler-only tools', 'ModelerOnlyAlgorithmProvider')
def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../images/model.png')
diff --git a/python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py b/python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py
index 33e3544c7f6..6ca223d22d0 100644
--- a/python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py
+++ b/python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py
@@ -78,7 +78,7 @@ class ModelerParameterDefinitionDialog(QDialog):
self.setupUi()
def setupUi(self):
- self.setWindowTitle('Parameter definition')
+ self.setWindowTitle(self.tr('Parameter definition'))
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setSpacing(40)
@@ -87,7 +87,7 @@ class ModelerParameterDefinitionDialog(QDialog):
self.horizontalLayout = QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
- self.label = QLabel('Parameter name')
+ self.label = QLabel(self.tr('Parameter name'))
self.horizontalLayout.addWidget(self.label)
self.nameTextBox = QLineEdit()
self.horizontalLayout.addWidget(self.nameTextBox)
@@ -107,7 +107,7 @@ class ModelerParameterDefinitionDialog(QDialog):
== ModelerParameterDefinitionDialog.PARAMETER_BOOLEAN \
or isinstance(self.param, ParameterBoolean):
self.state = QCheckBox()
- self.state.setText('Checked')
+ self.state.setText(self.tr('Checked'))
self.state.setChecked(False)
if self.param is not None:
self.state.setChecked(True if self.param.value else False)
@@ -116,7 +116,7 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_TABLE_FIELD \
or isinstance(self.param, ParameterTableField):
- self.horizontalLayout2.addWidget(QLabel('Parent layer'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Parent layer')))
self.parentCombo = QComboBox()
idx = 0
for param in self.alg.inputs.values():
@@ -131,10 +131,10 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_RASTER \
or isinstance(self.param, ParameterRaster):
- self.horizontalLayout2.addWidget(QLabel('Required'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Required')))
self.yesNoCombo = QComboBox()
- self.yesNoCombo.addItem('Yes')
- self.yesNoCombo.addItem('No')
+ self.yesNoCombo.addItem(self.tr('Yes'))
+ self.yesNoCombo.addItem(self.tr('No'))
if self.param is not None:
self.yesNoCombo.setCurrentIndex(
(1 if self.param.optional else 0))
@@ -143,10 +143,10 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_TABLE \
or isinstance(self.param, ParameterTable):
- self.horizontalLayout2.addWidget(QLabel('Required'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Required')))
self.yesNoCombo = QComboBox()
- self.yesNoCombo.addItem('Yes')
- self.yesNoCombo.addItem('No')
+ self.yesNoCombo.addItem(self.tr('Yes'))
+ self.yesNoCombo.addItem(self.tr('No'))
if self.param is not None:
self.yesNoCombo.setCurrentIndex(
(1 if self.param.optional else 0))
@@ -155,17 +155,17 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_VECTOR \
or isinstance(self.param, ParameterVector):
- self.horizontalLayout2.addWidget(QLabel('Required'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Required')))
self.yesNoCombo = QComboBox()
- self.yesNoCombo.addItem('Yes')
- self.yesNoCombo.addItem('No')
+ self.yesNoCombo.addItem(self.tr('Yes'))
+ self.yesNoCombo.addItem(self.tr('No'))
self.horizontalLayout2.addWidget(self.yesNoCombo)
- self.horizontalLayout3.addWidget(QLabel('Shape type'))
+ self.horizontalLayout3.addWidget(QLabel(self.tr('Shape type')))
self.shapetypeCombo = QComboBox()
- self.shapetypeCombo.addItem('Any')
- self.shapetypeCombo.addItem('Point')
- self.shapetypeCombo.addItem('Line')
- self.shapetypeCombo.addItem('Polygon')
+ self.shapetypeCombo.addItem(self.tr('Any'))
+ self.shapetypeCombo.addItem(self.tr('Point'))
+ self.shapetypeCombo.addItem(self.tr('Line'))
+ self.shapetypeCombo.addItem(self.tr('Polygon'))
if self.param is not None:
self.yesNoCombo.setCurrentIndex(
(1 if self.param.optional else 0))
@@ -177,19 +177,19 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_MULTIPLE \
or isinstance(self.param, ParameterMultipleInput):
- self.horizontalLayout2.addWidget(QLabel('Mandatory'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Mandatory')))
self.yesNoCombo = QComboBox()
- self.yesNoCombo.addItem('Yes')
- self.yesNoCombo.addItem('No')
+ self.yesNoCombo.addItem(self.tr('Yes'))
+ self.yesNoCombo.addItem(self.tr('No'))
self.horizontalLayout2.addWidget(self.yesNoCombo)
- self.horizontalLayout3.addWidget(QLabel('Data type'))
+ self.horizontalLayout3.addWidget(QLabel(self.tr('Data type')))
self.datatypeCombo = QComboBox()
- self.datatypeCombo.addItem('Vector (any)')
- self.datatypeCombo.addItem('Vector (point)')
- self.datatypeCombo.addItem('Vector (line)')
- self.datatypeCombo.addItem('Vector (polygon)')
- self.datatypeCombo.addItem('Raster')
- self.datatypeCombo.addItem('Table')
+ self.datatypeCombo.addItem(self.tr('Vector (any)'))
+ self.datatypeCombo.addItem(self.tr('Vector (point)'))
+ self.datatypeCombo.addItem(self.tr('Vector (line)'))
+ self.datatypeCombo.addItem(self.tr('Vector (polygon)'))
+ self.datatypeCombo.addItem(self.tr('Raster'))
+ self.datatypeCombo.addItem(self.tr('Table'))
if self.param is not None:
self.yesNoCombo.setCurrentIndex(
(1 if self.param.optional else 0))
@@ -200,15 +200,15 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_NUMBER \
or isinstance(self.param, ParameterNumber):
- self.horizontalLayout2.addWidget(QLabel('Min/Max values'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Min/Max values')))
self.minTextBox = QLineEdit()
self.maxTextBox = QLineEdit()
self.horizontalLayout2.addWidget(self.minTextBox)
self.horizontalLayout2.addWidget(self.maxTextBox)
self.verticalLayout.addLayout(self.horizontalLayout2)
- self.horizontalLayout3.addWidget(QLabel('Default value'))
+ self.horizontalLayout3.addWidget(QLabel(self.tr('Default value')))
self.defaultTextBox = QLineEdit()
- self.defaultTextBox.setText('0')
+ self.defaultTextBox.setText(self.tr('0'))
if self.param is not None:
self.defaultTextBox.setText(str(self.param.default))
self.horizontalLayout3.addWidget(self.defaultTextBox)
@@ -216,7 +216,7 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_STRING \
or isinstance(self.param, ParameterString):
- self.horizontalLayout2.addWidget(QLabel('Default value'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Default value')))
self.defaultTextBox = QLineEdit()
if self.param is not None:
self.defaultTextBox.setText(self.param.default)
@@ -225,10 +225,10 @@ class ModelerParameterDefinitionDialog(QDialog):
elif self.paramType == \
ModelerParameterDefinitionDialog.PARAMETER_FILE \
or isinstance(self.param, ParameterFile):
- self.horizontalLayout2.addWidget(QLabel('Type'))
+ self.horizontalLayout2.addWidget(QLabel(self.tr('Type')))
self.fileFolderCombo = QComboBox()
- self.fileFolderCombo.addItem('File')
- self.fileFolderCombo.addItem('Folder')
+ self.fileFolderCombo.addItem(self.tr('File'))
+ self.fileFolderCombo.addItem(self.tr('Folder'))
if self.param is not None:
self.fileFolderCombo.setCurrentIndex(
(1 if self.param.isFolder else 0))
@@ -250,8 +250,8 @@ class ModelerParameterDefinitionDialog(QDialog):
def okPressed(self):
description = unicode(self.nameTextBox.text())
if description.strip() == '':
- QMessageBox.warning(self, 'Unable to define parameter',
- 'Invalid parameter name')
+ QMessageBox.warning(self, self.tr('Unable to define parameter'),
+ self.tr('Invalid parameter name'))
return
if self.param is None:
validChars = \
@@ -270,8 +270,8 @@ class ModelerParameterDefinitionDialog(QDialog):
== ModelerParameterDefinitionDialog.PARAMETER_TABLE_FIELD \
or isinstance(self.param, ParameterTableField):
if self.parentCombo.currentIndex() < 0:
- QMessageBox.warning(self, 'Unable to define parameter',
- 'Wrong or missing parameter values')
+ QMessageBox.warning(self, self.tr('Unable to define parameter'),
+ self.tr('Wrong or missing parameter values'))
return
parent = self.parentCombo.itemData(self.parentCombo.currentIndex())
self.param = ParameterTableField(name, description, parent)
@@ -314,8 +314,8 @@ class ModelerParameterDefinitionDialog(QDialog):
self.param = ParameterNumber(name, description, vmin, vmax,
float(str(self.defaultTextBox.text())))
except:
- QMessageBox.warning(self, 'Unable to define parameter',
- 'Wrong or missing parameter values')
+ QMessageBox.warning(self, self.tr('Unable to define parameter'),
+ self.tr('Wrong or missing parameter values'))
return
elif self.paramType \
== ModelerParameterDefinitionDialog.PARAMETER_STRING \
diff --git a/python/plugins/processing/modeler/ModelerParametersDialog.py b/python/plugins/processing/modeler/ModelerParametersDialog.py
index 065575aa2e4..cc59dee1351 100644
--- a/python/plugins/processing/modeler/ModelerParametersDialog.py
+++ b/python/plugins/processing/modeler/ModelerParametersDialog.py
@@ -82,7 +82,7 @@ class ModelerParametersDialog(QDialog):
hLayout = QHBoxLayout()
hLayout.setSpacing(5)
hLayout.setMargin(0)
- descriptionLabel = QLabel("Description")
+ descriptionLabel = QLabel(self.tr("Description"))
self.descriptionBox = QLineEdit()
self.descriptionBox.setText(self._alg.name)
hLayout.addWidget(descriptionLabel)
@@ -96,7 +96,7 @@ class ModelerParametersDialog(QDialog):
for param in self._alg.parameters:
if param.isAdvanced:
self.advancedButton = QPushButton()
- self.advancedButton.setText('Show advanced parameters')
+ self.advancedButton.setText(self.tr('Show advanced parameters'))
self.advancedButton.setMaximumWidth(150)
self.advancedButton.clicked.connect(
self.showAdvancedParametersClicked)
@@ -141,7 +141,7 @@ class ModelerParametersDialog(QDialog):
label = QLabel(' ')
self.verticalLayout.addWidget(label)
- label = QLabel('Parent algorithms')
+ label = QLabel(self.tr('Parent algorithms'))
self.dependenciesPanel = self.getDependenciesPanel()
self.verticalLayout.addWidget(label)
self.verticalLayout.addWidget(self.dependenciesPanel)
@@ -161,7 +161,7 @@ class ModelerParametersDialog(QDialog):
self.scrollArea = QScrollArea()
self.scrollArea.setWidget(self.paramPanel)
self.scrollArea.setWidgetResizable(True)
- self.tabWidget.addTab(self.scrollArea, 'Parameters')
+ self.tabWidget.addTab(self.scrollArea, self.tr('Parameters'))
self.webView = QWebView()
html = None
@@ -173,15 +173,15 @@ class ModelerParametersDialog(QDialog):
else:
url = QUrl(help)
else:
- html = 'Sorry, no help is available for this \
- algorithm.
'
+ html = self.tr('Sorry, no help is available for this '
+ 'algorithm.
')
try:
if html:
self.webView.setHtml(html)
elif url:
self.webView.load(url)
except:
- self.webView.setHtml('Could not open help file :-(
')
+ self.webView.setHtml(self.tr('Could not open help file :-(
'))
self.tabWidget.addTab(self.webView, 'Help')
self.verticalLayout2.addWidget(self.tabWidget)
self.verticalLayout2.addWidget(self.buttonBox)
@@ -207,9 +207,9 @@ class ModelerParametersDialog(QDialog):
def showAdvancedParametersClicked(self):
self.showAdvanced = not self.showAdvanced
if self.showAdvanced:
- self.advancedButton.setText('Hide advanced parameters')
+ self.advancedButton.setText(self.tr('Hide advanced parameters'))
else:
- self.advancedButton.setText('Show advanced parameters')
+ self.advancedButton.setText(self.tr('Show advanced parameters'))
for param in self._alg.parameters:
if param.isAdvanced:
self.labels[param.name].setVisible(self.showAdvanced)
@@ -241,7 +241,7 @@ class ModelerParametersDialog(QDialog):
return self.model.inputs[value.name].param.description
else:
alg = self.model.algs[value.alg]
- return "'%s' from algorithm '%s'" % (alg.algorithm.getOutputFromName(value.output).description, alg.description)
+ return self.tr("'%s' from algorithm '%s'") % (alg.algorithm.getOutputFromName(value.output).description, alg.description)
def getWidgetFromParameter(self, param):
@@ -628,8 +628,8 @@ class ModelerParametersDialog(QDialog):
if self.alg is not None:
self.close()
else:
- QMessageBox.warning(self, 'Unable to add algorithm',
- 'Wrong or missing parameter values')
+ QMessageBox.warning(self, self.tr('Unable to add algorithm'),
+ self.tr('Wrong or missing parameter values'))
def cancelPressed(self):
self.alg = None
diff --git a/python/plugins/processing/modeler/ModelerScene.py b/python/plugins/processing/modeler/ModelerScene.py
index 6a5218714a1..a836ae19d4b 100644
--- a/python/plugins/processing/modeler/ModelerScene.py
+++ b/python/plugins/processing/modeler/ModelerScene.py
@@ -139,6 +139,3 @@ class ModelerScene(QtGui.QGraphicsScene):
if mouseEvent.button() != QtCore.Qt.LeftButton:
return
super(ModelerScene, self).mousePressEvent(mouseEvent)
-
-
-
diff --git a/python/plugins/processing/modeler/MultilineTextPanel.py b/python/plugins/processing/modeler/MultilineTextPanel.py
index 3a646a717cd..8be9ff786d3 100644
--- a/python/plugins/processing/modeler/MultilineTextPanel.py
+++ b/python/plugins/processing/modeler/MultilineTextPanel.py
@@ -39,7 +39,7 @@ class MultilineTextPanel(QtGui.QWidget):
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.combo = QtGui.QComboBox()
- self.combo.addItem('[Use text below]')
+ self.combo.addItem(self.tr('[Use text below]'))
for option in options:
self.combo.addItem(option[0], option[1])
self.combo.setSizePolicy(QtGui.QSizePolicy.Expanding,
diff --git a/python/plugins/processing/modeler/RasterLayerBoundsAlgorithm.py b/python/plugins/processing/modeler/RasterLayerBoundsAlgorithm.py
index 2de2cac96d3..abe18a415f8 100644
--- a/python/plugins/processing/modeler/RasterLayerBoundsAlgorithm.py
+++ b/python/plugins/processing/modeler/RasterLayerBoundsAlgorithm.py
@@ -43,14 +43,14 @@ class RasterLayerBoundsAlgorithm(GeoAlgorithm):
def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False
- self.name = 'Raster layer bounds'
- self.group = 'Modeler-only tools'
- self.addParameter(ParameterRaster(self.LAYER, 'Layer'))
- self.addOutput(OutputNumber(self.XMIN, 'min X'))
- self.addOutput(OutputNumber(self.XMAX, 'max X'))
- self.addOutput(OutputNumber(self.YMIN, 'min Y'))
- self.addOutput(OutputNumber(self.YMAX, 'max Y'))
- self.addOutput(OutputExtent(self.EXTENT, 'Extent'))
+ self.name = self.tr('Raster layer bounds', 'RasterLayerBoundsAlgorithm')
+ self.group = self.tr('Modeler-only tools', 'RasterLayerBoundsAlgorithm')
+ self.addParameter(ParameterRaster(self.LAYER, self.tr('Layer', 'RasterLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.XMIN, self.tr('min X', 'RasterLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.XMAX, self.tr('max X', 'RasterLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.YMIN, self.tr('min Y', 'RasterLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.YMAX, self.tr('max Y', 'RasterLayerBoundsAlgorithm')))
+ self.addOutput(OutputExtent(self.EXTENT, self.tr('Extent', 'RasterLayerBoundsAlgorithm')))
def processAlgorithm(self, progress):
uri = self.getParameterValue(self.LAYER)
@@ -63,4 +63,3 @@ class RasterLayerBoundsAlgorithm(GeoAlgorithm):
layer.extent().xMaximum(),
layer.extent().yMinimum(),
layer.extent().yMaximum()))
-
diff --git a/python/plugins/processing/modeler/VectorLayerBoundsAlgorithm.py b/python/plugins/processing/modeler/VectorLayerBoundsAlgorithm.py
index d5af542950d..05ca1e9e876 100644
--- a/python/plugins/processing/modeler/VectorLayerBoundsAlgorithm.py
+++ b/python/plugins/processing/modeler/VectorLayerBoundsAlgorithm.py
@@ -44,14 +44,14 @@ class VectorLayerBoundsAlgorithm(GeoAlgorithm):
def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False
- self.name = 'Vector layer bounds'
- self.group = 'Modeler-only tools'
- self.addParameter(ParameterVector(self.LAYER, 'Layer'))
- self.addOutput(OutputNumber(self.XMIN, 'min X'))
- self.addOutput(OutputNumber(self.XMAX, 'max X'))
- self.addOutput(OutputNumber(self.YMIN, 'min Y'))
- self.addOutput(OutputNumber(self.YMAX, 'max Y'))
- self.addOutput(OutputExtent(self.EXTENT, 'Extent'))
+ self.name = self.tr('Vector layer bounds', 'VectorLayerBoundsAlgorithm')
+ self.group = self.tr('Modeler-only tools', 'VectorLayerBoundsAlgorithm')
+ self.addParameter(ParameterVector(self.LAYER, self.tr('Layer', 'VectorLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.XMIN, self.tr('min X', 'VectorLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.XMAX, self.tr('max X', 'VectorLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.YMIN, self.tr('min Y', 'VectorLayerBoundsAlgorithm')))
+ self.addOutput(OutputNumber(self.YMAX, self.tr('max Y', 'VectorLayerBoundsAlgorithm')))
+ self.addOutput(OutputExtent(self.EXTENT, self.tr('Extent', 'VectorLayerBoundsAlgorithm')))
def processAlgorithm(self, progress):
uri = self.getParameterValue(self.LAYER)
diff --git a/python/plugins/processing/script/AddScriptFromFileAction.py b/python/plugins/processing/script/AddScriptFromFileAction.py
index 33831a72f68..68340a7cb22 100644
--- a/python/plugins/processing/script/AddScriptFromFileAction.py
+++ b/python/plugins/processing/script/AddScriptFromFileAction.py
@@ -35,22 +35,25 @@ from processing.script.ScriptUtils import ScriptUtils
class AddScriptFromFileAction(ToolboxAction):
def __init__(self):
- self.name = "Add script from file"
- self.group = 'Tools'
+ self.name = self.tr('Add script from file', 'AddScriptFromFileAction')
+ self.group = self.tr('Tools', 'AddScriptFromFileAction')
def getIcon(self):
return QtGui.QIcon(':/processing/images/script.png')
def execute(self):
- filename = QtGui.QFileDialog.getOpenFileName(self.toolbox, 'Script files', None,
- '*.py')
+ filename = QtGui.QFileDialog.getOpenFileName(self.toolbox,
+ self.tr('Script files', 'AddScriptFromFileAction'), None,
+ self.tr('Script filesĀ (*.py *.PY)', 'AddScriptFromFileAction'))
if filename:
try:
script = ScriptAlgorithm(filename)
except WrongScriptException:
- QtGui.QMessageBox.warning(self.toolbox, "Error reading script", "The selected file does not contain a valid script")
+ QtGui.QMessageBox.warning(self.toolbox,
+ self.tr('Error reading script', 'AddScriptFromFileAction'),
+ self.tr('The selected file does not contain a valid script', 'AddScriptFromFileAction'))
return
destFilename = os.path.join(ScriptUtils.scriptsFolder(), os.path.basename(filename))
- with open(destFilename, "w") as f:
+ with open(destFilename, 'w') as f:
f.write(script.script)
- self.toolbox.updateProvider('script')
\ No newline at end of file
+ self.toolbox.updateProvider('script')
diff --git a/python/plugins/processing/script/ScriptAlgorithm.py b/python/plugins/processing/script/ScriptAlgorithm.py
index f749aa3c2f7..3cec3b3bb71 100644
--- a/python/plugins/processing/script/ScriptAlgorithm.py
+++ b/python/plugins/processing/script/ScriptAlgorithm.py
@@ -87,7 +87,7 @@ class ScriptAlgorithm(GeoAlgorithm):
self.silentOutputs = []
filename = os.path.basename(self.descriptionFile)
self.name = filename[:filename.rfind('.')].replace('_', ' ')
- self.group = 'User scripts'
+ self.group = self.tr('User scripts', 'ScriptAlgorithm')
lines = open(self.descriptionFile)
line = lines.readline()
while line != '':
@@ -95,21 +95,21 @@ class ScriptAlgorithm(GeoAlgorithm):
try:
self.processParameterLine(line.strip('\n'))
except:
- raise WrongScriptException('Could not load script: '
- + self.descriptionFile + '\n'
- + 'Problem with line: ' + line)
+ raise WrongScriptException(
+ self.tr('Could not load script: %s\n'
+ 'Problem with line: %d', 'ScriptAlgorithm') % (self.descriptionFile, line))
self.script += line
line = lines.readline()
lines.close()
- if self.group == '[Test scripts]':
+ if self.group == self.tr('[Test scripts]', 'ScriptAlgorithm'):
self.showInModeler = False
self.showInToolbox = False
def defineCharacteristicsFromScript(self):
lines = self.script.split('\n')
self.silentOutputs = []
- self.name = '[Unnamed algorithm]'
- self.group = 'User scripts'
+ self.name = self.tr('[Unnamed algorithm]', 'ScriptAlgorithm')
+ self.group = self.tr('User scripts', 'ScriptAlgorithm')
for line in lines:
if line.startswith('##'):
try:
@@ -228,10 +228,9 @@ class ScriptAlgorithm(GeoAlgorithm):
out.description = desc
self.addOutput(out)
else:
- raise WrongScriptException('Could not load script:'
- + self.descriptionFile or ''
- + '.\n Problem with line "' + line + '"'
- )
+ raise WrongScriptException(
+ self.tr('Could not load script: %s.\n'
+ 'Problem with line %d', 'ScriptAlgorithm') % (self.descriptionFile or '', line))
def processDescriptionParameterLine(self, line):
try:
@@ -244,10 +243,9 @@ class ScriptAlgorithm(GeoAlgorithm):
else:
self.addOutput(getOutputFromString(line))
except Exception:
- raise WrongScriptException('Could not load script:'
- + self.descriptionFile or ''
- + '.\n Problem with line "' + line + '"'
- )
+ raise WrongScriptException(
+ self.tr('Could not load script: %s.\n'
+ 'Problem with line %d', 'ScriptAlgorithm') % (self.descriptionFile or '', line))
def processAlgorithm(self, progress):
diff --git a/python/plugins/processing/script/ScriptAlgorithmProvider.py b/python/plugins/processing/script/ScriptAlgorithmProvider.py
index 2f145b7b5b0..9bd3f55db59 100644
--- a/python/plugins/processing/script/ScriptAlgorithmProvider.py
+++ b/python/plugins/processing/script/ScriptAlgorithmProvider.py
@@ -42,7 +42,7 @@ class ScriptAlgorithmProvider(AlgorithmProvider):
def __init__(self):
AlgorithmProvider.__init__(self)
- self.actions.extend([CreateNewScriptAction('Create new script',
+ self.actions.extend([CreateNewScriptAction(self.tr('Create new script', 'ScriptAlgorithmProvider'),
CreateNewScriptAction.SCRIPT_PYTHON),
AddScriptFromFileAction(),
GetScriptsAction()])
@@ -54,7 +54,7 @@ class ScriptAlgorithmProvider(AlgorithmProvider):
AlgorithmProvider.initializeSettings(self)
ProcessingConfig.addSetting(Setting(self.getDescription(),
ScriptUtils.SCRIPTS_FOLDER,
- 'Scripts folder',
+ self.tr('Scripts folder', 'ScriptAlgorithmProvider'),
ScriptUtils.scriptsFolder()))
def unload(self):
@@ -68,10 +68,8 @@ class ScriptAlgorithmProvider(AlgorithmProvider):
return 'script'
def getDescription(self):
- return 'Scripts'
+ return self.tr('Scripts', 'ScriptAlgorithmProvider')
def _loadAlgorithms(self):
folder = ScriptUtils.scriptsFolder()
self.algs = ScriptUtils.loadFromFolder(folder)
-
-