Skip to content

Commit 3739c3a

Browse files
committedApr 7, 2017
Move tr out of AlgorithmProvider to subclasses
1 parent 9a97a87 commit 3739c3a

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed
 

‎python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import os
2929

30+
from qgis.PyQt.QtCore import QCoreApplication
3031
from qgis.core import QgsApplication
3132
from processing.core.AlgorithmProvider import AlgorithmProvider
3233
from processing.core.ProcessingConfig import ProcessingConfig, Setting
@@ -146,3 +147,8 @@ def loadAlgorithms(self):
146147

147148
def supportedOutputRasterLayerExtensions(self):
148149
return GdalUtils.getSupportedRasterExtensions()
150+
151+
def tr(self, string, context=''):
152+
if context == '':
153+
context = 'GdalAlgorithmProvider'
154+
return QCoreApplication.translate(context, string)

‎python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
__revision__ = '$Format:%H$'
2828

2929
import os
30+
from qgis.PyQt.QtCore import QCoreApplication
3031
from qgis.core import QgsApplication
3132
from processing.core.ProcessingConfig import ProcessingConfig, Setting
3233
from processing.core.AlgorithmProvider import AlgorithmProvider
@@ -119,3 +120,8 @@ def supportedOutputVectorLayerExtensions(self):
119120

120121
def canBeActivated(self):
121122
return not bool(Grass7Utils.checkGrass7IsInstalled())
123+
124+
def tr(self, string, context=''):
125+
if context == '':
126+
context = 'Grass7AlgorithmProvider'
127+
return QCoreApplication.translate(context, string)

‎python/plugins/processing/algs/r/RAlgorithmProvider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import os
3030

31+
from qgis.PyQt.QtCore import QCoreApplication
3132
from qgis.core import QgsApplication
3233
from processing.core.ProcessingConfig import ProcessingConfig, Setting
3334
from processing.core.ProcessingLog import ProcessingLog
@@ -128,3 +129,8 @@ def loadFromFolder(self, folder):
128129
ProcessingLog.LOG_ERROR,
129130
self.tr('Could not load R script: {0}\n{1}').format(descriptionFile, str(e)))
130131
return
132+
133+
def tr(self, string, context=''):
134+
if context == '':
135+
context = 'RAlgorithmProvider'
136+
return QCoreApplication.translate(context, string)

‎python/plugins/processing/algs/saga/SagaAlgorithmProvider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import os
3030
from qgis.PyQt.QtGui import QIcon
31+
from qgis.PyQt.QtCore import QCoreApplication
3132
from processing.core.AlgorithmProvider import AlgorithmProvider
3233
from processing.core.ProcessingConfig import ProcessingConfig, Setting
3334
from processing.core.ProcessingLog import ProcessingLog
@@ -123,3 +124,8 @@ def getSupportedOutputTableLayerExtensions(self):
123124

124125
def icon(self):
125126
return QIcon(os.path.join(pluginPath, 'images', 'saga.png'))
127+
128+
def tr(self, string, context=''):
129+
if context == '':
130+
context = 'SagaAlgorithmProvider'
131+
return QCoreApplication.translate(context, string)

‎python/plugins/processing/core/AlgorithmProvider.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
__revision__ = '$Format:%H$'
2727

28-
from qgis.PyQt.QtCore import QCoreApplication
2928
from qgis.core import (QgsProcessingProvider)
3029
from processing.core.ProcessingConfig import Setting, ProcessingConfig
3130

@@ -72,8 +71,3 @@ def unload(self):
7271
"""
7372
name = 'ACTIVATE_' + self.id().upper().replace(' ', '_')
7473
ProcessingConfig.removeSetting(name)
75-
76-
def tr(self, string, context=''):
77-
if context == '':
78-
context = self.__class__.__name__
79-
return QCoreApplication.translate(context, string)

0 commit comments

Comments
 (0)
Please sign in to comment.