Skip to content
Permalink
Browse files

[processing] make bunch of strings translatable (sorry translators)

  • Loading branch information
alexbruy committed Oct 3, 2014
1 parent f935316 commit bd13693ae3db5a3f884130dcae343ccccbb0ff6f
Showing with 331 additions and 317 deletions.
  1. +2 −2 python/plugins/processing/core/GeoAlgorithm.py
  2. +5 −5 python/plugins/processing/core/Processing.py
  3. +4 −4 python/plugins/processing/core/parameters.py
  4. +26 −21 python/plugins/processing/gui/AlgorithmExecutionDialog.py
  5. +4 −4 python/plugins/processing/gui/BatchInputSelectionPanel.py
  6. +1 −1 python/plugins/processing/gui/BatchOutputSelectionPanel.py
  7. +19 −23 python/plugins/processing/gui/BatchProcessingDialog.py
  8. +2 −2 python/plugins/processing/gui/ConfigDialog.py
  9. +2 −2 python/plugins/processing/gui/CouldNotLoadResultsDialog.py
  10. +1 −1 python/plugins/processing/gui/CreateNewScriptAction.py
  11. +2 −1 python/plugins/processing/gui/DeleteScriptAction.py
  12. +4 −4 python/plugins/processing/gui/ExtentSelectionPanel.py
  13. +3 −3 python/plugins/processing/gui/FileSelectionPanel.py
  14. +4 −4 python/plugins/processing/gui/FixedTableDialog.py
  15. +2 −3 python/plugins/processing/gui/FixedTablePanel.py
  16. +29 −24 python/plugins/processing/gui/GetScriptsAndModels.py
  17. +8 −6 python/plugins/processing/gui/Help2Html.py
  18. +16 −15 python/plugins/processing/gui/HelpEditionDialog.py
  19. +1 −1 python/plugins/processing/gui/HistoryDialog.py
  20. +1 −1 python/plugins/processing/gui/InputLayerSelectorPanel.py
  21. +2 −3 python/plugins/processing/gui/MessageBarProgress.py
  22. +4 −5 python/plugins/processing/gui/MissingDependencyDialog.py
  23. +3 −2 python/plugins/processing/gui/MultipleFileInputDialog.py
  24. +4 −4 python/plugins/processing/gui/MultipleFileInputPanel.py
  25. +2 −1 python/plugins/processing/gui/ParametersDialog.py
  26. +9 −9 python/plugins/processing/gui/ParametersPanel.py
  27. +2 −1 python/plugins/processing/gui/Postprocessing.py
  28. +2 −2 python/plugins/processing/gui/RangePanel.py
  29. +2 −2 python/plugins/processing/gui/RenderingStyleFilePanel.py
  30. +7 −4 python/plugins/processing/gui/TestTools.py
  31. +12 −7 python/plugins/processing/modeler/AddModelFromFileAction.py
  32. +14 −11 python/plugins/processing/modeler/CalculatorModelerAlgorithm.py
  33. +2 −2 python/plugins/processing/modeler/CreateNewModelAction.py
  34. +4 −3 python/plugins/processing/modeler/DeleteModelAction.py
  35. +1 −1 python/plugins/processing/modeler/EditModelAction.py
  36. +16 −16 python/plugins/processing/modeler/ModelerAlgorithm.py
  37. +4 −5 python/plugins/processing/modeler/ModelerAlgorithmProvider.py
  38. +8 −10 python/plugins/processing/modeler/ModelerDialog.py
  39. +1 −1 python/plugins/processing/modeler/ModelerOnlyAlgorithmProvider.py
  40. +41 −41 python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py
  41. +12 −12 python/plugins/processing/modeler/ModelerParametersDialog.py
  42. +0 −3 python/plugins/processing/modeler/ModelerScene.py
  43. +1 −1 python/plugins/processing/modeler/MultilineTextPanel.py
  44. +8 −9 python/plugins/processing/modeler/RasterLayerBoundsAlgorithm.py
  45. +8 −8 python/plugins/processing/modeler/VectorLayerBoundsAlgorithm.py
  46. +10 −7 python/plugins/processing/script/AddScriptFromFileAction.py
  47. +13 −15 python/plugins/processing/script/ScriptAlgorithm.py
  48. +3 −5 python/plugins/processing/script/ScriptAlgorithmProvider.py
@@ -521,7 +521,7 @@ def getPostProcessingErrorMessage(self, wrongLayers):
for layer in wrongLayers:
html += self.tr('<li>%s: <font size=3 face="Courier New" '
'color="#ff0000">%s</font></li>\n') % \
(layer.description, layer.value)
(layer.description, layer.value)
html += self.tr('</ul><p>The above files could not be opened, which '
'probably indicates that they were not correctly '
'produced by the executed algorithm</p>'
@@ -532,4 +532,4 @@ def getPostProcessingErrorMessage(self, wrongLayers):
def tr(self, string, context=''):
if context == '':
context = 'GeoAlgorithm'
return QtCore.QCoreApplication.translate(context, string)
return QCoreApplication.translate(context, string)
@@ -95,8 +95,8 @@ def addProvider(provider, updateList=False):
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 @@ def runAlgorithm(algOrName, onFinish, *args):
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:
@@ -364,7 +364,7 @@ def getFileFilter(self):
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 @@ def setValue(self, obj):
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 @@ def getSafeExportedTable(self):
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 @@ def getSafeExportedLayer(self):
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)
@@ -64,7 +64,7 @@ def __init__(self, alg, mainWidget):
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 @@ def __init__(self, alg, mainWidget):
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 @@ def __init__(self, alg, mainWidget):
else:
url = QUrl(help)
else:
html = '<h2>Sorry, no help is available for this \
algorithm.</h2>'
html = self.tr('<h2>Sorry, no help is available for this '
'algorithm.</h2>')
try:
if html:
self.webView.setHtml(html)
elif url:
self.webView.load(url)
except:
self.webView.setHtml('<h2>Could not open help file :-( </h2>')
self.webView.setHtml(
self.tr('<h2>Could not open help file :-( </h2>'))
self.tabWidget.addTab(self.webView, 'Help')
self.verticalLayout.addWidget(self.progressLabel)
self.verticalLayout.addWidget(self.progress)
@@ -195,17 +196,18 @@ def accept(self):
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 @@ def accept(self):

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('<b>Algorithm %s starting...</b>' % self.alg.name)
self.setInfo(
self.tr('<b>Algorithm %s starting...</b>') % self.alg.name)
# make sure the log tab is visible before executing the algorithm
try:
self.repaint()
@@ -254,12 +257,13 @@ def accept(self):
palette = ex.widget.palette()
palette.setColor(QPalette.Base, QColor(255, 255, 0))
ex.widget.setPalette(palette)
self.progressLabel.setText('<b>Missing parameter value: '
+ ex.parameter.description + '</b>')
self.progressLabel.setText(
self.tr('<b>Missing parameter value: %s</b>' % 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 @@ def finish(self):
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()
@@ -62,11 +62,11 @@ def showPopupMenu(self):
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 @@ def showFileSelectionDialog(self):
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:
@@ -63,7 +63,7 @@ def __init__(self, output, alg, row, col, batchDialog):

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)
@@ -63,23 +63,23 @@ def __init__(self, alg):
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)
self.advancedButton.clicked.connect(
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 @@ def setTableContent(self):

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 @@ def accept(self):
continue
widget = self.table.cellWidget(row, col)
if not self.setParameterValueFromWidget(param, widget, alg):
self.progressLabel.setText('<b>Missing parameter value: '
+ param.description + ' (row ' + str(row + 1)
+ ')</b>')
self.progressLabel.setText(
self.tr('<b>Missing parameter value: %s (row %d)</b>') % (param.description, row + 1))
self.algs = None
return
col += 1
@@ -184,9 +183,7 @@ def accept(self):
col += 1
else:
self.progressLabel.setText(
'<b>Wrong or missing parameter value: '
+ out.description + ' (row ' + str(row + 1)
+ ')</b>')
self.tr('<b>Wrong or missing parameter value: %s (row %d)</b>') % (out.description, row + 1))
self.algs = None
return
self.algs.append(alg)
@@ -206,13 +203,12 @@ def accept(self):
except:
pass
for (i, alg) in enumerate(self.algs):
self.setBaseText('Processing algorithm ' + str(i + 1) + '/'
+ str(len(self.algs)) + '...')
self.setInfo('<b>Algorithm %s starting...</b>' % alg.name)
self.setBaseText(self.tr('Processing algorithm %d/%d...') %(i + 1, len(self.algs)))
self.setInfo(self.tr('<b>Algorithm %s starting...</b>' % 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 @@ def finishAll(self):
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 @@ def getWidgetFromParameter(self, param, row, col):
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 @@ def addRow(self):

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:
@@ -74,7 +74,7 @@ def fillTree(self):
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 @@ def accept(self):
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())
@@ -42,15 +42,15 @@ def __init__(self, wrongLayers, alg):

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)
browser.anchorClicked.connect(self.linkClicked)
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)
@@ -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):

0 comments on commit bd13693

Please sign in to comment.
You can’t perform that action at this time.