Skip to content

Commit

Permalink
[processing] Translate some strings when running gdal algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 8, 2021
1 parent 601a9e1 commit 02f861c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions python/plugins/processing/algs/gdal/GdalUtils.py
Expand Up @@ -44,6 +44,9 @@
QgsDataSourceUri,
QgsProjUtils,
QgsCoordinateReferenceSystem)

from qgis.PyQt.QtCore import QCoreApplication

from processing.core.ProcessingConfig import ProcessingConfig
from processing.tools.system import isWindows, isMac

Expand Down Expand Up @@ -88,14 +91,14 @@ def runGdal(commands, feedback=None):

fused_command = ' '.join([str(c) for c in commands])
QgsMessageLog.logMessage(fused_command, 'Processing', Qgis.Info)
feedback.pushInfo('GDAL command:')
feedback.pushInfo(GdalUtils.tr('GDAL command:'))
feedback.pushCommandInfo(fused_command)
feedback.pushInfo('GDAL command output:')
feedback.pushInfo(GdalUtils.tr('GDAL command output:'))
success = False
retry_count = 0
while not success:
loglines = []
loglines.append('GDAL execution console output')
loglines.append(GdalUtils.tr('GDAL execution console output'))
try:
with subprocess.Popen(
fused_command,
Expand Down Expand Up @@ -444,3 +447,9 @@ def gdal_crs_string(crs):

# fallback to proj4 string, stripping out newline characters
return crs.toProj().replace('\n', ' ').replace('\r', ' ')

@classmethod
def tr(cls, string, context=''):
if context == '':
context = cls.__name__
return QCoreApplication.translate(context, string)

0 comments on commit 02f861c

Please sign in to comment.