Skip to content

Commit

Permalink
translation string fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 5, 2017
1 parent c77172e commit 5a962e8
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 74 deletions.
20 changes: 10 additions & 10 deletions python/plugins/processing/gui/NumberInputPanel.py
Expand Up @@ -84,7 +84,7 @@ def showExpressionsBuilder(self):
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))
Expand All @@ -97,16 +97,16 @@ def showExpressionsBuilder(self):
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)

Expand Down
2 changes: 1 addition & 1 deletion 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."}
],
Expand Down
95 changes: 47 additions & 48 deletions src/core/qgsunittypes.cpp
Expand Up @@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsunittypes.h"
#include <QCoreApplication>

/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
Expand Down Expand Up @@ -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", "<unknown>" );
return QObject::tr( "<unknown>", "distance" );

case DistanceNauticalMiles:
return QCoreApplication::translate( "UnitType", "nautical miles" );
return QObject::tr( "nautical miles", "distance" );
}
return QString();
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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", "<unknown>" );
return QObject::tr( "<unknown>", "area" );
}
return QString();
}
Expand All @@ -521,23 +520,23 @@ QString QgsUnitTypes::toAbbreviatedString( QgsUnitTypes::AreaUnit unit )
switch ( unit )
{
case AreaSquareMeters:
return QCoreApplication::translate( "QgsUnitTypes::AreaUnit", "" );
return QObject::trUtf8( "", "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();
}
Expand Down Expand Up @@ -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", "<unknown>" );
return QObject::tr( "<unknown>", "angle" );
}
return QString();
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Expand Up @@ -25,8 +25,6 @@

import qgis # NOQA

from builtins import file

import os
import re
import tempfile
Expand Down
26 changes: 13 additions & 13 deletions tests/src/python/test_qgssymbollayer_createsld.py
Expand Up @@ -466,20 +466,20 @@ def testGraduatedNoScaleDependencies(self):
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
# 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)

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):
def testRuleBasedNoRootScaleDependencies(self):
layer = QgsVectorLayer("Polygon", "addfeat", "memory")

mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.qml' % (unitTestDataPath(), "ruleBased"))
Expand Down

0 comments on commit 5a962e8

Please sign in to comment.