diff --git a/python/plugins/processing/gui/NumberInputPanel.py b/python/plugins/processing/gui/NumberInputPanel.py index ee91a562e3f..2be8ca5ed89 100644 --- a/python/plugins/processing/gui/NumberInputPanel.py +++ b/python/plugins/processing/gui/NumberInputPanel.py @@ -84,7 +84,7 @@ class ModellerNumberInputPanel(BASE, WIDGET): name = "%s_%s" % (value.alg, value.output) alg = self.modelParametersDialog.model.algs[value.alg] out = alg.algorithm.getOutputFromName(value.output) - desc = self.tr("Output '{0}' from algorithm '{1}").format(out.description, alg.description) + desc = self.tr("Output '{0}' from algorithm '{1}'").format(out.description, alg.description) variables[name] = desc values = self.modelParametersDialog.getAvailableValuesOfType(ParameterVector, OutputVector) values.extend(self.modelParametersDialog.getAvailableValuesOfType(ParameterRaster, OutputRaster)) @@ -97,16 +97,16 @@ class ModellerNumberInputPanel(BASE, WIDGET): name = "%s_%s" % (value.alg, value.output) alg = self.modelParametersDialog.model.algs[value.alg] element = alg.algorithm.getOutputFromName(value.output) - desc = self.tr("Output '{0}' from algorithm '{1}").format(element.description, alg.description) - variables['%s_minx' % name] = "Minimum X of %s" % desc - variables['%s_miny' % name] = "Maximum X of %s" % desc - variables['%s_maxx' % name] = "Minimum Y of %s" % desc - variables['%s_maxy' % name] = "Maximum Y of %s" % desc + desc = self.tr("Output '{0}' from algorithm '{1}'").format(element.description, alg.description) + variables['%s_minx' % name] = self.tr("Minimum X of {0}").format(desc) + variables['%s_miny' % name] = self.tr("Minimum Y of {0}").format(desc) + variables['%s_maxx' % name] = self.tr("Maximum X of {0}").format(desc) + variables['%s_maxy' % name] = self.tr("Maximum Y of {0}").format(desc) if isinstance(element, (ParameterRaster, OutputRaster)): - variables['%s_min' % name] = "Minimum value of %s" % desc - variables['%s_max' % name] = "Maximum value of %s" % desc - variables['%s_avg' % name] = "Mean value of %s" % desc - variables['%s_stddev' % name] = "Standard deviation of %s" % desc + variables['%s_min' % name] = self.tr("Minimum value of {0}").format(desc) + variables['%s_max' % name] = self.tr("Maximum value of {0}").format(desc) + variables['%s_avg' % name] = self.tr("Mean value of {0}").format(desc) + variables['%s_stddev' % name] = self.tr("Standard deviation of {0}").format(desc) for variable, desc in variables.items(): dlg.expressionBuilder().registerItem("Modeler", variable, "@" + variable, desc, highlightedItem=True) diff --git a/resources/function_help/json/env b/resources/function_help/json/env index fa0de3a259a..be56aac8322 100644 --- a/resources/function_help/json/env +++ b/resources/function_help/json/env @@ -1,7 +1,7 @@ { "name": "env", "type": "function", - "description": "Gets an environment variable and returns its content as a string. If the variable is not found, `NULL` will be returned. This is handy to inject system specific configuration like drive letters or path prefixes. Definition of environment variables depends on the operating system, please check with your system administrator or the operating system documentation how this can be set..", + "description": "Gets an environment variable and returns its content as a string. If the variable is not found, `NULL` will be returned. This is handy to inject system specific configuration like drive letters or path prefixes. Definition of environment variables depends on the operating system, please check with your system administrator or the operating system documentation how this can be set.", "arguments": [ {"arg":"name","description":"The name of the environment variable which should be retrieved."} ], diff --git a/src/core/qgsunittypes.cpp b/src/core/qgsunittypes.cpp index 954d7509885..92e70a0f042 100644 --- a/src/core/qgsunittypes.cpp +++ b/src/core/qgsunittypes.cpp @@ -15,7 +15,6 @@ ***************************************************************************/ #include "qgsunittypes.h" -#include /*************************************************************************** * This class is considered CRITICAL and any change MUST be accompanied with @@ -140,28 +139,28 @@ QString QgsUnitTypes::toString( DistanceUnit unit ) switch ( unit ) { case DistanceMeters: - return QCoreApplication::translate( "UnitType", "meters" ); + return QObject::tr( "meters", "distance" ); case DistanceKilometers: - return QCoreApplication::translate( "UnitType", "kilometers" ); + return QObject::tr( "kilometers", "distance" ); case DistanceFeet: - return QCoreApplication::translate( "UnitType", "feet" ); + return QObject::tr( "feet", "distance" ); case DistanceYards: - return QCoreApplication::translate( "UnitType", "yards" ); + return QObject::tr( "yards", "distance" ); case DistanceMiles: - return QCoreApplication::translate( "UnitType", "miles" ); + return QObject::tr( "miles", "distance" ); case DistanceDegrees: - return QCoreApplication::translate( "UnitType", "degrees" ); + return QObject::tr( "degrees", "distance" ); case DistanceUnknownUnit: - return QCoreApplication::translate( "UnitType", "" ); + return QObject::tr( "", "distance" ); case DistanceNauticalMiles: - return QCoreApplication::translate( "UnitType", "nautical miles" ); + return QObject::tr( "nautical miles", "distance" ); } return QString(); } @@ -171,28 +170,28 @@ QString QgsUnitTypes::toAbbreviatedString( QgsUnitTypes::DistanceUnit unit ) switch ( unit ) { case DistanceMeters: - return QCoreApplication::translate( "UnitType", "m" ); + return QObject::tr( "m", "distance" ); case DistanceKilometers: - return QCoreApplication::translate( "UnitType", "km" ); + return QObject::tr( "km", "distance" ); case DistanceFeet: - return QCoreApplication::translate( "UnitType", "ft" ); + return QObject::tr( "ft", "distance" ); case DistanceYards: - return QCoreApplication::translate( "UnitType", "yd" ); + return QObject::tr( "yd", "distance" ); case DistanceMiles: - return QCoreApplication::translate( "UnitType", "mi" ); + return QObject::tr( "mi", "distance" ); case DistanceDegrees: - return QCoreApplication::translate( "UnitType", "deg" ); + return QObject::tr( "deg", "distance" ); case DistanceUnknownUnit: return QString(); case DistanceNauticalMiles: - return QCoreApplication::translate( "UnitType", "NM" ); + return QObject::tr( "NM", "distance" ); } return QString(); } @@ -493,25 +492,25 @@ QString QgsUnitTypes::toString( QgsUnitTypes::AreaUnit unit ) switch ( unit ) { case AreaSquareMeters: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square meters" ); + return QObject::tr( "square meters", "area" ); case AreaSquareKilometers: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square kilometers" ); + return QObject::tr( "square kilometers", "area" ); case AreaSquareFeet: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square feet" ); + return QObject::tr( "square feet", "area" ); case AreaSquareYards: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square yards" ); + return QObject::tr( "square yards", "area" ); case AreaSquareMiles: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square miles" ); + return QObject::tr( "square miles", "area" ); case AreaHectares: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "hectares" ); + return QObject::tr( "hectares", "area" ); case AreaAcres: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "acres" ); + return QObject::tr( "acres", "area" ); case AreaSquareNauticalMiles: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square nautical miles" ); + return QObject::tr( "square nautical miles", "area" ); case AreaSquareDegrees: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "square degrees" ); + return QObject::tr( "square degrees", "area" ); case AreaUnknownUnit: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "" ); + return QObject::tr( "", "area" ); } return QString(); } @@ -521,23 +520,23 @@ QString QgsUnitTypes::toAbbreviatedString( QgsUnitTypes::AreaUnit unit ) switch ( unit ) { case AreaSquareMeters: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "m²" ); + return QObject::trUtf8( "m²", "area" ); case AreaSquareKilometers: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "km²" ); + return QObject::trUtf8( "km²", "area" ); case AreaSquareFeet: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "ft²" ); + return QObject::trUtf8( "ft²", "area" ); case AreaSquareYards: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "yd²" ); + return QObject::trUtf8( "yd²", "area" ); case AreaSquareMiles: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "mi²" ); + return QObject::trUtf8( "mi²", "area" ); case AreaHectares: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "ha²" ); + return QObject::trUtf8( "ha²", "area" ); case AreaAcres: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "ac²" ); + return QObject::trUtf8( "ac²", "area" ); case AreaSquareNauticalMiles: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "NM²" ); + return QObject::trUtf8( "NM²", "area" ); case AreaSquareDegrees: - return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "deg²" ); + return QObject::trUtf8( "deg²", "area" ); case AreaUnknownUnit: return QString(); } @@ -941,19 +940,19 @@ QString QgsUnitTypes::toString( QgsUnitTypes::AngleUnit unit ) switch ( unit ) { case AngleDegrees: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "degrees" ); + return QObject::tr( "degrees", "angle" ); case AngleRadians: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "radians" ); + return QObject::tr( "radians", "angle" ); case AngleGon: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "gon" ); + return QObject::tr( "gon", "angle" ); case AngleMinutesOfArc: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "minutes of arc" ); + return QObject::tr( "minutes of arc", "angle" ); case AngleSecondsOfArc: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "seconds of arc" ); + return QObject::tr( "seconds of arc", "angle" ); case AngleTurn: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "turns" ); + return QObject::tr( "turns", "angle" ); case AngleUnknownUnit: - return QCoreApplication::translate( "QgsUnitTypes::AngleUnit", "" ); + return QObject::tr( "", "angle" ); } return QString(); } @@ -1102,22 +1101,22 @@ QString QgsUnitTypes::formatAngle( double angle, int decimals, QgsUnitTypes::Ang switch ( unit ) { case AngleDegrees: - unitLabel = QObject::trUtf8( "°" ); + unitLabel = QObject::trUtf8( "°", "angle" ); break; case AngleRadians: - unitLabel = QObject::trUtf8( " rad" ); + unitLabel = QObject::trUtf8( " rad", "angle" ); break; case AngleGon: - unitLabel = QObject::trUtf8( " gon" ); + unitLabel = QObject::trUtf8( " gon", "angle" ); break; case AngleMinutesOfArc: - unitLabel = QObject::trUtf8( "′" ); + unitLabel = QObject::trUtf8( "′", "angle minutes" ); break; case AngleSecondsOfArc: - unitLabel = QObject::trUtf8( "″" ); + unitLabel = QObject::trUtf8( "″", "angle seconds" ); break; case AngleTurn: - unitLabel = QObject::trUtf8( " tr" ); + unitLabel = QObject::trUtf8( " tr", "angle turn" ); break; case AngleUnknownUnit: break; diff --git a/tests/src/python/test_qgsdelimitedtextprovider.py b/tests/src/python/test_qgsdelimitedtextprovider.py index 3608a4131e7..30e0eb773a3 100644 --- a/tests/src/python/test_qgsdelimitedtextprovider.py +++ b/tests/src/python/test_qgsdelimitedtextprovider.py @@ -25,8 +25,6 @@ __revision__ = '$Format:%H$' import qgis # NOQA -from builtins import file - import os import re import tempfile diff --git a/tests/src/python/test_qgssymbollayer_createsld.py b/tests/src/python/test_qgssymbollayer_createsld.py index 1e494e976a4..9c647a7d62f 100644 --- a/tests/src/python/test_qgssymbollayer_createsld.py +++ b/tests/src/python/test_qgssymbollayer_createsld.py @@ -466,22 +466,22 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase): for i in range(0, ruleCount): self.assertScaleDenominator(root, None, None, i) +# def testRuleBasedNoRootScaleDependencies(self): +# layer = QgsVectorLayer("Polygon", "addfeat", "memory") +# +# mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.qml' % (unitTestDataPath(), "ruleBased")) +# status = layer.loadNamedStyle(mFilePath) # NOQA +# +# dom, root = self.layerToSld(layer) +# print(("Rule based, no root scale deps:" + dom.toString())) +# +# ruleCount = root.elementsByTagName('se:Rule').size() # NOQA +# self.assertScaleDenominator(root, '1000', '40000000', 0) +# self.assertScaleDenominator(root, None, None, 1) + def testRuleBasedNoRootScaleDependencies(self): layer = QgsVectorLayer("Polygon", "addfeat", "memory") - mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.qml' % (unitTestDataPath(), "ruleBased")) - status = layer.loadNamedStyle(mFilePath) # NOQA - - dom, root = self.layerToSld(layer) - print(("Rule based, no root scale deps:" + dom.toString())) - - ruleCount = root.elementsByTagName('se:Rule').size() # NOQA - self.assertScaleDenominator(root, '1000', '40000000', 0) - self.assertScaleDenominator(root, None, None, 1) - - def testRuleBasedNoRootScaleDependencies2(self): - layer = QgsVectorLayer("Polygon", "addfeat", "memory") - mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.qml' % (unitTestDataPath(), "ruleBased")) status = layer.loadNamedStyle(mFilePath) # NOQA layer.setMinimumScale(5000)