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 Apr 24, 2020
1 parent 8ee4d05 commit 067e925
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 48 deletions.
8 changes: 6 additions & 2 deletions python/plugins/processing/modeler/ModelerDialog.py
Expand Up @@ -336,8 +336,12 @@ def addAlgorithm(self, alg_id, pos=None):

res, errors = self.model().validateChildAlgorithm(id)
if not res:
self.view().scene().showWarning(self.tr('Algorithm “{}” is invalid').format(alg.description()), self.tr('Algorithm is Invalid'), self.tr(
"<p>The “{}” algorithm is invalid, because:</p><ul><li>{}</li></ul>").format(alg.description(), '</li><li>'.join(errors)), level=Qgis.Warning)
self.view().scene().showWarning(
QCoreApplication.translate('ModelerDialog', 'Algorithm “{}” is invalid').format(alg.description()),
self.tr('Algorithm is Invalid'),
QCoreApplication.translate('ModelerDialog', "<p>The “{}” algorithm is invalid, because:</p><ul><li>{}</li></ul>").format(alg.description(), '</li><li>'.join(errors)),
level=Qgis.Warning
)
else:
self.view().scene().messageBar().clearWidgets()

Expand Down
10 changes: 8 additions & 2 deletions python/plugins/processing/modeler/ModelerGraphicItem.py
Expand Up @@ -21,6 +21,8 @@
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'

from qgis.PyQt.QtCore import QCoreApplication

from qgis.core import (QgsProcessingParameterDefinition,
QgsProject,
Qgis)
Expand Down Expand Up @@ -146,8 +148,12 @@ def edit(self, edit_comment=False):

res, errors = self.model().validateChildAlgorithm(alg.childId())
if not res:
self.scene().showWarning(self.tr('Algorithm “{}” is invalid').format(alg.description()), self.tr('Algorithm is Invalid'), self.tr(
"<p>The “{}” algorithm is invalid, because:</p><ul><li>{}</li></ul>").format(alg.description(), '</li><li>'.join(errors)), level=Qgis.Warning)
self.scene().showWarning(
QCoreApplication.translate('ModelerGraphicItem', 'Algorithm “{}” is invalid').format(alg.description()),
self.tr('Algorithm is Invalid'),
QCoreApplication.translate('ModelerGraphicItem', "<p>The “{}” algorithm is invalid, because:</p><ul><li>{}</li></ul>").format(alg.description(), '</li><li>'.join(errors)),
level=Qgis.Warning
)
else:
self.scene().messageBar().clearWidgets()

Expand Down
48 changes: 24 additions & 24 deletions src/analysis/processing/qgsalgorithmconstantraster.cpp
Expand Up @@ -103,45 +103,45 @@ QVariantMap QgsConstantRasterAlgorithm::processAlgorithm( const QVariantMap &par
Qgis::DataType rasterDataType = Qgis::Float32; //standard output type
switch ( typeId )
{
case ( 0 ):
case 0:
rasterDataType = Qgis::Byte;
if ( value < std::numeric_limits<quint8>::min() || value > std::numeric_limits<quint8>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Byte only accept positive values between %1 and %2" ).arg( std::numeric_limits<quint8>::min() ).arg( std::numeric_limits<quint8>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits<quint8>::min() ).arg( std::numeric_limits<quint8>::max() ).arg( QStringLiteral( "Byte" ) ) );
if ( fractpart > 0 )
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type Byte. The decimals of the constant value will be omitted." ) );
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Byte" ) ) );
break;
case ( 1 ):
case 1:
rasterDataType = Qgis::Int16;
if ( value < std::numeric_limits<qint16>::min() || value > std::numeric_limits<qint16>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Integer16 only accept values between %1 and %2" ).arg( std::numeric_limits<qint16>::min() ).arg( std::numeric_limits<qint16>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2" ).arg( std::numeric_limits<qint16>::min() ).arg( std::numeric_limits<qint16>::max() ).arg( QStringLiteral( "Integer16" ) ) );
if ( fractpart > 0 )
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type Integer16. The decimals of the constant value will be omitted." ) );
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Integer16" ) ) );
break;
case ( 2 ):
case 2:
rasterDataType = Qgis::UInt16;
if ( value < std::numeric_limits<quint16>::min() || value > std::numeric_limits<quint16>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Unsigned Integer16 only accept positive values between %1 and %2" ).arg( std::numeric_limits<quint16>::min() ).arg( std::numeric_limits<quint16>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits<quint16>::min() ).arg( std::numeric_limits<quint16>::max() ).arg( "Unsigned Integer16" ) );
if ( fractpart > 0 )
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type Unsigned Integer16. The decimals of the constant value will be omitted." ) );
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Unsigned Integer16" ) ) );
break;
case ( 3 ):
case 3:
rasterDataType = Qgis::Int32;
if ( value < std::numeric_limits<qint32>::min() || value > std::numeric_limits<qint32>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Integer32 only accept values between %1 and %2" ).arg( std::numeric_limits<qint32>::min() ).arg( std::numeric_limits<qint32>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2" ).arg( std::numeric_limits<qint32>::min() ).arg( std::numeric_limits<qint32>::max() ).arg( QStringLiteral( "Integer32" ) ) );
if ( fractpart > 0 )
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type Integer32. The decimals of the constant value will be omitted." ) );
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Integer32" ) ) );
break;
case ( 4 ):
case 4:
rasterDataType = Qgis::UInt32;
if ( value < std::numeric_limits<quint32>::min() || value > std::numeric_limits<quint32>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Unsigned Integer32 only accept positive values between %1 and %2" ).arg( std::numeric_limits<quint32>::min() ).arg( std::numeric_limits<quint32>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2" ).arg( std::numeric_limits<quint32>::min() ).arg( std::numeric_limits<quint32>::max() ).arg( QStringLiteral( "Unsigned Integer32" ) ) );
if ( fractpart > 0 )
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type Unsigned Integer32. The decimals of the constant value will be omitted." ) );
feedback->reportError( QObject::tr( "The entered constant value has decimals but will be written to a raster dataset of type %1. The decimals of the constant value will be omitted." ).arg( QStringLiteral( "Unsigned Integer32" ) ) );
break;
case ( 5 ):
case 5:
rasterDataType = Qgis::Float32;
break;
case ( 6 ):
case 6:
rasterDataType = Qgis::Float64;
break;
default:
Expand Down Expand Up @@ -175,49 +175,49 @@ QVariantMap QgsConstantRasterAlgorithm::processAlgorithm( const QVariantMap &par
QgsRasterBlock block( rasterDataType, cols, 1 );
switch ( typeId )
{
case ( 0 ):
case 0:
{
std::vector<quint8> byteRow( cols );
std::fill( byteRow.begin(), byteRow.end(), value );
block.setData( QByteArray::fromRawData( ( char * )&byteRow[0], QgsRasterBlock::typeSize( Qgis::Byte ) * cols ) );
break;
}
case ( 1 ):
case 1:
{
std::vector<qint16> int16Row( cols );
std::fill( int16Row.begin(), int16Row.end(), value );
block.setData( QByteArray::fromRawData( ( char * )&int16Row[0], QgsRasterBlock::typeSize( Qgis::Int16 ) * cols ) );
break;
}
case ( 2 ):
case 2:
{
std::vector<quint16> uInt16Row( cols );
std::fill( uInt16Row.begin(), uInt16Row.end(), value );
block.setData( QByteArray::fromRawData( ( char * )&uInt16Row[0], QgsRasterBlock::typeSize( Qgis::UInt16 ) * cols ) );
break;
}
case ( 3 ):
case 3:
{
std::vector<qint32> int32Row( cols );
std::fill( int32Row.begin(), int32Row.end(), value );
block.setData( QByteArray::fromRawData( ( char * )&int32Row[0], QgsRasterBlock::typeSize( Qgis::Int32 ) * cols ) );
break;
}
case ( 4 ):
case 4:
{
std::vector<quint32> uInt32Row( cols );
std::fill( uInt32Row.begin(), uInt32Row.end(), value );
block.setData( QByteArray::fromRawData( ( char * )&uInt32Row[0], QgsRasterBlock::typeSize( Qgis::UInt32 ) * cols ) );
break;
}
case ( 5 ):
case 5:
{
std::vector<float> float32Row( cols );
std::fill( float32Row.begin(), float32Row.end(), value );
block.setData( QByteArray::fromRawData( ( char * )&float32Row[0], QgsRasterBlock::typeSize( Qgis::Float32 ) * cols ) );
break;
}
case ( 6 ):
case 6:
{
std::vector<double> float64Row( cols );
std::fill( float64Row.begin(), float64Row.end(), value );
Expand Down
38 changes: 19 additions & 19 deletions src/analysis/processing/qgsalgorithmrandomraster.cpp
Expand Up @@ -119,66 +119,66 @@ bool QgsRandomRasterAlgorithm::prepareAlgorithm( const QVariantMap &parameters,
mRasterDataType = Qgis::Float32; //standard output type
switch ( mTypeId )
{
case ( 0 ):
case 0:
mRasterDataType = Qgis::Byte;
if ( mRandomLowerBound < std::numeric_limits<quint8>::min() || mRandomUpperBound > std::numeric_limits<quint8>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Byte only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<quint8>::min() ).arg( std::numeric_limits<quint8>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<quint8>::min() ).arg( std::numeric_limits<quint8>::max() ).arg( QStringLiteral( "Byte" ) ) );
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
//if parameters unset (=both are 0 or equal) --> use the whole value range
mRandomUpperBound = std::numeric_limits<quint8>::max();
mRandomLowerBound = std::numeric_limits<quint8>::min();
}
break;
case ( 1 ):
case 1:
mRasterDataType = Qgis::Int16;
if ( mRandomLowerBound < std::numeric_limits<qint16>::min() || mRandomUpperBound > std::numeric_limits<qint16>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Integer16 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<qint16>::min() ).arg( std::numeric_limits<qint16>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<qint16>::min() ).arg( std::numeric_limits<qint16>::max() ).arg( QStringLiteral( "Integer16" ) ) );
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
mRandomUpperBound = std::numeric_limits<qint16>::max();
mRandomLowerBound = std::numeric_limits<qint16>::min();
}
break;
case ( 2 ):
case 2:
mRasterDataType = Qgis::UInt16;
if ( mRandomLowerBound < std::numeric_limits<quint16>::min() || mRandomUpperBound > std::numeric_limits<quint16>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Unsigned Integer16 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<quint16>::min() ).arg( std::numeric_limits<quint16>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<quint16>::min() ).arg( std::numeric_limits<quint16>::max() ).arg( QStringLiteral( "Unsigned Integer16" ) ) );
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
mRandomUpperBound = std::numeric_limits<quint16>::max();
mRandomLowerBound = std::numeric_limits<quint16>::min();
}
break;
case ( 3 ):
case 3:
mRasterDataType = Qgis::Int32;
if ( mRandomLowerBound < std::numeric_limits<qint32>::min() || mRandomUpperBound > std::numeric_limits<qint32>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Integer32 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<qint32>::min() ).arg( std::numeric_limits<qint32>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<qint32>::min() ).arg( std::numeric_limits<qint32>::max() ).arg( QStringLiteral( "Integer32" ) ) );
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
mRandomUpperBound = std::numeric_limits<qint32>::max();
mRandomLowerBound = std::numeric_limits<qint32>::min();
}
break;
case ( 4 ):
case 4:
mRasterDataType = Qgis::UInt32;
if ( mRandomLowerBound < std::numeric_limits<quint32>::min() || mRandomUpperBound > std::numeric_limits<quint32>::max() )
throw QgsProcessingException( QObject::tr( "Raster datasets of type Unsigned Integer32 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<quint32>::min() ).arg( std::numeric_limits<quint32>::max() ) );
throw QgsProcessingException( QObject::tr( "Raster datasets of type %3 only accept positive values between %1 and %2. Please choose other bounds for random values." ).arg( std::numeric_limits<quint32>::min() ).arg( std::numeric_limits<quint32>::max() ).arg( QStringLiteral( "Unsigned Integer32" ) ) );
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
mRandomUpperBound = std::numeric_limits<quint32>::max();
mRandomLowerBound = std::numeric_limits<quint32>::min();
}
break;
case ( 5 ):
case 5:
mRasterDataType = Qgis::Float32;
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
mRandomUpperBound = std::numeric_limits<float>::max();
mRandomLowerBound = std::numeric_limits<float>::min();
}
break;
case ( 6 ):
case 6:
mRasterDataType = Qgis::Float64;
if ( ( qgsDoubleNear( mRandomLowerBound, 0.0 ) && qgsDoubleNear( mRandomUpperBound, 0.0 ) ) || qgsDoubleNear( mRandomUpperBound, mRandomLowerBound ) )
{
Expand Down Expand Up @@ -233,7 +233,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
QgsRasterBlock block( mRasterDataType, cols, 1 );
switch ( mTypeId )
{
case ( 0 ):
case 0:
{
std::vector<quint8> byteRow( cols );
for ( int col = 0; col < cols; col++ )
Expand All @@ -243,7 +243,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
block.setData( QByteArray( reinterpret_cast<const char *>( byteRow.data() ), QgsRasterBlock::typeSize( Qgis::Byte ) * cols ) );
break;
}
case ( 1 ):
case 1:
{
std::vector<qint16> int16Row( cols );
for ( int col = 0; col < cols; col++ )
Expand All @@ -253,7 +253,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
block.setData( QByteArray( reinterpret_cast<const char *>( int16Row.data() ), QgsRasterBlock::typeSize( Qgis::Int16 ) * cols ) );
break;
}
case ( 2 ):
case 2:
{
std::vector<quint16> uInt16Row( cols );
for ( int col = 0; col < cols; col++ )
Expand All @@ -263,7 +263,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
block.setData( QByteArray( reinterpret_cast<const char *>( uInt16Row.data() ), QgsRasterBlock::typeSize( Qgis::UInt16 ) * cols ) );
break;
}
case ( 3 ):
case 3:
{
std::vector<qint32> int32Row( cols );
for ( int col = 0; col < cols; col++ )
Expand All @@ -273,7 +273,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
block.setData( QByteArray( reinterpret_cast<const char *>( int32Row.data() ), QgsRasterBlock::typeSize( Qgis::Int32 ) * cols ) );
break;
}
case ( 4 ):
case 4:
{
std::vector<quint32> uInt32Row( cols );
for ( int col = 0; col < cols; col++ )
Expand All @@ -283,7 +283,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
block.setData( QByteArray( reinterpret_cast<const char *>( uInt32Row.data() ), QgsRasterBlock::typeSize( Qgis::UInt32 ) * cols ) );
break;
}
case ( 5 ):
case 5:
{
std::vector<float> float32Row( cols );
for ( int col = 0; col < cols; col++ )
Expand All @@ -293,7 +293,7 @@ QVariantMap QgsRandomRasterAlgorithm::processAlgorithm( const QVariantMap &param
block.setData( QByteArray( reinterpret_cast<const char *>( float32Row.data() ), QgsRasterBlock::typeSize( Qgis::Float32 ) * cols ) );
break;
}
case ( 6 ):
case 6:
{
std::vector<double> float64Row( cols );
for ( int col = 0; col < cols; col++ )
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgisapp.ui
Expand Up @@ -3318,7 +3318,7 @@ Shows placeholders for labels which could not be placed, e.g. due to overlaps wi
<normaloff>:/images/themes/default/mActionAddVectorTileLayer.svg</normaloff>:/images/themes/default/mActionAddVectorTileLayer.svg</iconset>
</property>
<property name="text">
<string>Add Vector TIle Layer…</string>
<string>Add Vector Tile Layer…</string>
</property>
<property name="toolTip">
<string>Add Vector Tile Layer…</string>
Expand Down

0 comments on commit 067e925

Please sign in to comment.