mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
Merge pull request #62818 from nicogodet/fix-grassutils-tr
Provide `__class__.__name__` as translation context instead of hardcoded class name
This commit is contained in:
commit
9a762e2ba8
@ -221,10 +221,8 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
|||||||
| QgsProcessingAlgorithm.Flag.FlagDisplayNameIsLiteral
|
| QgsProcessingAlgorithm.Flag.FlagDisplayNameIsLiteral
|
||||||
)
|
)
|
||||||
|
|
||||||
def tr(self, string, context=""):
|
def tr(self, string: str):
|
||||||
if context == "":
|
return QCoreApplication.translate(self.__class__.__name__, string)
|
||||||
context = self.__class__.__name__
|
|
||||||
return QCoreApplication.translate(context, string)
|
|
||||||
|
|
||||||
def helpUrl(self):
|
def helpUrl(self):
|
||||||
helpPath = GrassUtils.grassHelpPath()
|
helpPath = GrassUtils.grassHelpPath()
|
||||||
@ -287,10 +285,8 @@ class GrassAlgorithm(QgsProcessingAlgorithm):
|
|||||||
parameter = getParameterFromString(param_string, "GrassAlgorithm")
|
parameter = getParameterFromString(param_string, "GrassAlgorithm")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QgsMessageLog.logMessage(
|
QgsMessageLog.logMessage(
|
||||||
QCoreApplication.translate(
|
self.tr("Could not open GRASS GIS algorithm: {0}").format(self._name),
|
||||||
"GrassAlgorithm", "Could not open GRASS GIS algorithm: {0}"
|
self.tr("Processing"),
|
||||||
).format(self._name),
|
|
||||||
QCoreApplication.translate("GrassAlgorithm", "Processing"),
|
|
||||||
Qgis.MessageLevel.Critical,
|
Qgis.MessageLevel.Critical,
|
||||||
)
|
)
|
||||||
raise e
|
raise e
|
||||||
|
@ -222,7 +222,5 @@ class GrassProvider(QgsProcessingProvider):
|
|||||||
def canBeActivated(self):
|
def canBeActivated(self):
|
||||||
return not bool(GrassUtils.checkGrassIsInstalled())
|
return not bool(GrassUtils.checkGrassIsInstalled())
|
||||||
|
|
||||||
def tr(self, string, context=""):
|
def tr(self, string: str):
|
||||||
if context == "":
|
return QCoreApplication.translate(self.__class__.__name__, string)
|
||||||
context = "Grass7AlgorithmProvider"
|
|
||||||
return QCoreApplication.translate(context, string)
|
|
||||||
|
@ -628,11 +628,9 @@ class GrassUtils:
|
|||||||
"Please install it or configure your PATH environment variable."
|
"Please install it or configure your PATH environment variable."
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def tr(string, context=""):
|
def tr(cls, string: str):
|
||||||
if context == "":
|
return QCoreApplication.translate(cls.__name__, string)
|
||||||
context = "Grass7Utils"
|
|
||||||
return QCoreApplication.translate(context, string)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def writeCommand(output, command):
|
def writeCommand(output, command):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user