From 1bccedd1d1b1260b340b862caa5859f1b40e715b Mon Sep 17 00:00:00 2001 From: signedav Date: Mon, 23 Jul 2018 18:21:02 +0200 Subject: [PATCH] working translation of project from qm file Translated objects and tests included: - [x] layer names - [x] layer group names - [x] relation names - [x] attribute alias (if no alias, then the field translation) - [x] forms group box titles - [x] forms sub group box titles included restructured with QTranslator object. Updated test-data used for the test. --- .../auto_generated/qgseditformconfig.sip.in | 2 +- python/core/auto_generated/qgsproject.sip.in | 37 -- .../qgstranslationcontext.sip.in | 79 ---- src/app/qgisapp.cpp | 2 +- src/app/qgsprojectproperties.cpp | 2 +- src/core/qgsproject.cpp | 43 +- src/core/qgsproject.h | 12 +- src/core/qgsvectorlayer.cpp | 12 +- tests/src/core/testqgstranslateproject.cpp | 148 +++++-- .../points_translation.qgs | 406 ++++++++++-------- .../points_translation_de.qm | Bin 1272 -> 1983 bytes 11 files changed, 386 insertions(+), 357 deletions(-) delete mode 100644 python/core/auto_generated/qgstranslationcontext.sip.in diff --git a/python/core/auto_generated/qgseditformconfig.sip.in b/python/core/auto_generated/qgseditformconfig.sip.in index 7fe7a8681c1..9144a785e70 100644 --- a/python/core/auto_generated/qgseditformconfig.sip.in +++ b/python/core/auto_generated/qgseditformconfig.sip.in @@ -264,7 +264,7 @@ Write XML information Serialize on project save %End - QgsAttributeEditorElement *attributeEditorElementFromDomElement( QDomElement &elem, QgsAttributeEditorElement *parent, const QString &layerId = 0 ); + QgsAttributeEditorElement *attributeEditorElementFromDomElement( QDomElement &elem, QgsAttributeEditorElement *parent ); %Docstring Deserialize drag and drop designer elements. %End diff --git a/python/core/auto_generated/qgsproject.sip.in b/python/core/auto_generated/qgsproject.sip.in index 18d08c08e98..5170f482f4c 100644 --- a/python/core/auto_generated/qgsproject.sip.in +++ b/python/core/auto_generated/qgsproject.sip.in @@ -135,14 +135,6 @@ Returns last modified time of the project file as returned by the file system (o Returns full absolute path to the project file if the project is stored in a file system - derived from fileName(). Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages). -.. versionadded:: 3.2 -%End - - QString absolutePath() const; -%Docstring -Returns full absolute path to the project folder if the project is stored in a file system - derived from fileName(). -Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages). - .. versionadded:: 3.2 %End @@ -991,25 +983,6 @@ and it is mainly a hint for the user interface to protect users from removing la in the project. The removeMapLayer(), removeMapLayers() calls do not block removal of layers listed here. .. versionadded:: 3.2 -%End - - void generateTsFile( const QString &locale ); -%Docstring -Triggers the collection strings of .qgs to be included in ts file and calls writeTsFile() - -.. versionadded:: 3.2 -%End - - QString translate( const QString &context, const QString &sourceText, const char *disambiguation = 0, int n = -1 ); -%Docstring -Translates the project with QTranslator and qm file - -:return: the result string (in case there is no QTranslator loaded the sourceText) - -:param context: describing layer etc. -:param sourceText: is the identifier of this text -:param disambiguation: it's the disambiguation -:param n: if -1 uses the appropriate form %End signals: @@ -1362,16 +1335,6 @@ home path will be automatically determined from the project's file path. .. seealso:: :py:func:`homePathChanged` .. versionadded:: 3.2 -%End - - void registerTranslatableObjects( QgsTranslationContext *translationContext ); -%Docstring -Registers the translatable objects into the tranlationContext -so there can be created a ts file these values - -.. versionadded:: 3.2 - -:param translationContext: where the objects will be registered %End }; diff --git a/python/core/auto_generated/qgstranslationcontext.sip.in b/python/core/auto_generated/qgstranslationcontext.sip.in deleted file mode 100644 index 9b3e059eb1b..00000000000 --- a/python/core/auto_generated/qgstranslationcontext.sip.in +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************ - * This file has been generated automatically from * - * * - * src/core/qgstranslationcontext.h * - * * - * Do not edit manually ! Edit header and run scripts/sipify.pl again * - ************************************************************************/ - - - - -class QgsTranslationContext -{ -%Docstring - used for the collecting of strings of .qgs to be translated and writing of ts file - -.. versionadded:: 3.2 -%End - -%TypeHeaderCode -#include "qgstranslationcontext.h" -%End - public: - - QgsTranslationContext( ); -%Docstring -Constructor -%End - - QgsProject *project() const; -%Docstring -Returns the project - -.. seealso:: :py:func:`setProject` -%End - - void setProject( QgsProject *project ); -%Docstring -Sets the ``project`` where the translation need to be done for - -.. seealso:: :py:func:`project` -%End - - QString fileName() const; -%Docstring -Returns the TS fileName - -.. seealso:: :py:func:`setFileName` -%End - - void setFileName( const QString &fileName ); -%Docstring -Sets the ``name`` of the TS file - -.. seealso:: :py:func:`fileName` -%End - - void registerTranslation( const QString &context, const QString &source ); -%Docstring -Registers the ``string`` to be translated - -:param translationString: name and path of the object need to be translated -:param layerName: the name of the layer -%End - - void writeTsFile( const QString &locale ); -%Docstring -Writes the Ts-file -%End - -}; - -/************************************************************************ - * This file has been generated automatically from * - * * - * src/core/qgstranslationcontext.h * - * * - * Do not edit manually ! Edit header and run scripts/sipify.pl again * - ************************************************************************/ diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 5ebb580bbac..f1d21c87d14 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -5950,10 +5950,10 @@ void QgisApp::fileSaveAs() return; QFileInfo fullPath( path ); + settings.setValue( QStringLiteral( "UI/lastProjectDir" ), fullPath.path() ); if ( filter == zipExt ) - { if ( fullPath.suffix().compare( QLatin1String( "qgz" ), Qt::CaseInsensitive ) != 0 ) fullPath.setFile( fullPath.filePath() + ".qgz" ); diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index ad20107fe77..71f34b6ca09 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -850,7 +850,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l ); } cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( QStringLiteral( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) ); - cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings->value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) ); + cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) ); connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::generateTsFileButton_clicked ); diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index 2affc736149..b9b99b1118d 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -37,7 +37,6 @@ #include "qgsrectangle.h" #include "qgsrelationmanager.h" #include "qgsannotationmanager.h" -#include "qgsvectorlayer.h" #include "qgsvectorlayerjoininfo.h" #include "qgsmapthemecollection.h" #include "qgslayerdefinition.h" @@ -367,9 +366,6 @@ QgsProject::QgsProject( QObject *parent ) connect( mLayerStore.get(), &QgsMapLayerStore::layersAdded, this, &QgsProject::layersAdded ); connect( mLayerStore.get(), &QgsMapLayerStore::layerWasAdded, this, &QgsProject::layerWasAdded ); connect( QgsApplication::instance(), &QgsApplication::requestForTranslatableObjects, this, &QgsProject::registerTranslatableObjects ); - - mTranslator = new QTranslator(); - } @@ -445,6 +441,24 @@ void QgsProject::setPresetHomePath( const QString &path ) setDirty( true ); } +void QgsProject::registerTranslatableContainers( QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId ) +{ + QList elements = parent->children(); + + for ( QgsAttributeEditorElement *element : elements ) + { + if ( element->type() == QgsAttributeEditorElement::AeTypeContainer ) + { + QgsAttributeEditorContainer *container = dynamic_cast( element ); + + translationContext->registerTranslation( QStringLiteral( "project:layers:%1:formcontainers" ).arg( layerId ), container->name() ); + + if ( container->children().size() > 0 ) + registerTranslatableContainers( translationContext, container, layerId ); + } + } +} + void QgsProject::registerTranslatableObjects( QgsTranslationContext *translationContext ) { //register layers @@ -457,6 +471,7 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation { QgsVectorLayer *vlayer = qobject_cast( mapLayer ); + //register aliases and fields const QgsFields fields = vlayer->fields(); for ( const QgsField &field : fields ) { @@ -465,6 +480,10 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation else translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( vlayer->id() ), field.alias() ); } + + //register formcontainers + registerTranslatableContainers( translationContext, vlayer->editFormConfig().invisibleRootContainer(), vlayer->id() ); + } } @@ -931,10 +950,6 @@ bool QgsProject::read() QString filename = mFile.fileName(); bool rc; - //dave dirty hack - delete mTranslator; - mTranslator = new QTranslator(); - if ( QgsProjectStorage *storage = projectStorage() ) { QTemporaryFile inDevice; @@ -969,10 +984,15 @@ bool QgsProject::read() } //on translation we should not change the filename back - if ( mTranslator->isEmpty() ) + if ( !mTranslator ) { mFile.setFileName( filename ); } + else + { + //but delete the translator + delete mTranslator; + } return rc; } @@ -988,6 +1008,7 @@ bool QgsProject::readProjectFile( const QString &filename ) if ( QFile( QStringLiteral( "%1/%2.qm" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ).exists() ) { + mTranslator = new QTranslator(); if ( mTranslator->load( localeFileName, QFileInfo( projectFile.fileName() ).absolutePath() ) ) { QgsDebugMsg( "Translation loaded" ); @@ -1290,7 +1311,7 @@ bool QgsProject::readProjectFile( const QString &filename ) emit nonIdentifiableLayersChanged( nonIdentifiableLayers() ); - if ( !mTranslator->isEmpty() ) + if ( mTranslator ) { //project possibly translated -> rename it with locale postfix QString newFileName( QStringLiteral( "%1/%2.qgs" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ); @@ -2800,7 +2821,7 @@ void QgsProject::generateTsFile( const QString &locale ) QString QgsProject::translate( const QString &context, const QString &sourceText, const char *disambiguation, int n ) { - if ( mTranslator->isEmpty() ) + if ( !mTranslator ) { return sourceText; } diff --git a/src/core/qgsproject.h b/src/core/qgsproject.h index 364a3f8dd78..f386c8adbe1 100644 --- a/src/core/qgsproject.h +++ b/src/core/qgsproject.h @@ -46,6 +46,7 @@ #include "qgsreadwritecontext.h" #include "qgsprojectmetadata.h" #include "qgstranslationcontext.h" +#include "qgsvectorlayer.h" class QFileInfo; class QDomDocument; @@ -97,7 +98,6 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera Q_PROPERTY( QgsRelationManager *relationManager READ relationManager ) Q_PROPERTY( QList avoidIntersectionsLayers READ avoidIntersectionsLayers WRITE setAvoidIntersectionsLayers NOTIFY avoidIntersectionsLayersChanged ) Q_PROPERTY( QgsProjectMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged ) - //dave to do Q_PROPERTY( QTranslator translator READ translator ) public: //! Returns the QgsProject singleton instance @@ -1296,6 +1296,16 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera */ void setPresetHomePath( const QString &path ); + /** + * Registers the translatable containers into the tranlationContext + * this is a rekursive function to get all the child containers + * \since QGIS 3.2 + * + * \param translationContext where the objects will be registered + * \param parent parent-container containing list of children + */ + void registerTranslatableContainers( QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId ); + /** * Registers the translatable objects into the tranlationContext * so there can be created a ts file these values diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 7f2f8496c94..d655c5c49be 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -1907,15 +1907,15 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes if ( !aliasElem.attribute( QStringLiteral( "name" ) ).isEmpty() ) { //if it has alias - alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ), aliasElem.attribute( QStringLiteral( "name" ) ) ); - QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ) + " source " + aliasElem.attribute( QStringLiteral( "name" ) ), 1 ); + alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ), aliasElem.attribute( QStringLiteral( "name" ) ) ); + QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ) + " source " + aliasElem.attribute( QStringLiteral( "name" ) ), 1 ); } else { - //if it has no alias, but alias is should be the fields translation - alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ), aliasElem.attribute( QStringLiteral( "name" ) ) ); - QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ) + " source " + field, 1 ); - //if it gets the exact field value, there has been no translation (no translation loaded); + //if it has no alias, it should be the fields translation + alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ), field ); + QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ) + " source " + field, 1 ); + //if it gets the exact field value, there has been no translation (or not even translation loaded) - so no alias should be generated; if ( alias == aliasElem.attribute( QStringLiteral( "field" ) ) ) alias.clear(); } diff --git a/tests/src/core/testqgstranslateproject.cpp b/tests/src/core/testqgstranslateproject.cpp index 442498a16de..cdcf8fd5d6c 100644 --- a/tests/src/core/testqgstranslateproject.cpp +++ b/tests/src/core/testqgstranslateproject.cpp @@ -24,6 +24,9 @@ #include "qgssettings.h" #include #include +#include +#include +#include "qgsrelationmanager.h" class TestQgsTranslateProject : public QObject { @@ -48,12 +51,11 @@ class TestQgsTranslateProject : public QObject void TestQgsTranslateProject::initTestCase() { - //start application in german + //start application QgsApplication::init(); QgsApplication::initQgis(); original_locale = settings.value( QStringLiteral( "locale/userLocale" ), "" ).toString() ; - settings.setValue( QStringLiteral( "locale/userLocale" ), "de" ); } void TestQgsTranslateProject::cleanupTestCase() @@ -76,10 +78,7 @@ void TestQgsTranslateProject::cleanupTestCase() void TestQgsTranslateProject::init() { - //open project - QString projectFileName( TEST_DATA_DIR ); - projectFileName = projectFileName + "/project_translation/points_translation.qgs"; - QgsProject::instance()->read( projectFileName ); + //not needed } void TestQgsTranslateProject::cleanup() @@ -89,15 +88,18 @@ void TestQgsTranslateProject::cleanup() void TestQgsTranslateProject::createTsFile() { - //the base is points_translation_de.qgs and with german values - //then we generate a ts file for spanish and the ts file with additional es postfix is created + //open project in english + settings.setValue( QStringLiteral( "locale/userLocale" ), "en" ); + QString projectFileName( TEST_DATA_DIR ); + projectFileName = projectFileName + "/project_translation/points_translation.qgs"; + QgsProject::instance()->read( projectFileName ); - //create ts-file - QgsProject::instance()->generateTsFile( "es" ); + //create ts file for german + QgsProject::instance()->generateTsFile( "de" ); - //check if tsfile is created + //check if ts file is created QString tsFileName( TEST_DATA_DIR ); - tsFileName = tsFileName + "/project_translation/points_translation_de_es.ts"; + tsFileName = tsFileName + "/project_translation/points_translation_de.ts"; QFile tsFile( tsFileName ); QVERIFY( tsFile.exists() ); @@ -105,46 +107,130 @@ void TestQgsTranslateProject::createTsFile() QString tsFileContent( tsFile.readAll() ); - //check if tsFile contains layer name Punkte - QVERIFY( tsFileContent.contains( "Punkte" ) ); + //LAYER NAMES + //lines + QVERIFY( tsFileContent.contains( "lines" ) ); + //points + QVERIFY( tsFileContent.contains( "points" ) ); - //check if tsFile contains layer group name + //LAYER GROUPS AND SUBGROUPS + //Points: + //Planes and Roads + QVERIFY( tsFileContent.contains( "Planes and Roads" ) ); + //Little bit of nothing + QVERIFY( tsFileContent.contains( "Little bit of nothing" ) ); - //check if tsFile contains alias value + //FIELDS AND ALIASES + //Lines: + //Name (Alias: Runwayid) + QVERIFY( tsFileContent.contains( "Runwayid" ) ); + //Value (Alias: Name) + QVERIFY( tsFileContent.contains( "Name" ) ); - //check if tsFile contains field name - // QVERIFY( tsFileContent.contains( "klaso" ) ); + //Points: + //Class (Alias: Level) + QVERIFY( tsFileContent.contains( "Level" ) ); + //Heading + QVERIFY( tsFileContent.contains( "Heading" ) ); + //Importance + QVERIFY( tsFileContent.contains( "Importance" ) ); + //Pilots + QVERIFY( tsFileContent.contains( "Pilots" ) ); + //Cabin Crew + QVERIFY( tsFileContent.contains( "Cabin Crew" ) ); + //Staff + QVERIFY( tsFileContent.contains( "Staff" ) ); - //check if tsFile contains relation name + //FORMCONTAINERS + //Plane + QVERIFY( tsFileContent.contains( "Plane" ) ); + //Employees + QVERIFY( tsFileContent.contains( "Employees" ) ); + //Flightattends + QVERIFY( tsFileContent.contains( "Flightattends" ) ); + + //RELATIONS + //Runway + QVERIFY( tsFileContent.contains( "Runway" ) ); + //Sheepwalk + QVERIFY( tsFileContent.contains( "Sheepwalk" ) ); tsFile.close(); } void TestQgsTranslateProject::translateProject() { + //open project in german + settings.setValue( QStringLiteral( "locale/userLocale" ), "de" ); + QString projectFileName( TEST_DATA_DIR ); + projectFileName = projectFileName + "/project_translation/points_translation.qgs"; + QgsProject::instance()->read( projectFileName ); + //with the qm file containing translation from en to de, the project should be in german and renamed with postfix .de QgsVectorLayer *points_layer = qobject_cast( QgsProject::instance()->mapLayer( "points_240d6bd6_9203_470a_994a_aae13cd9fa04" ) ); QgsVectorLayer *lines_layer = qobject_cast( QgsProject::instance()->mapLayer( "lines_a677672a_bf5d_410d_98c9_d326a5719a1b" ) ); - //check if layer names translated - QCOMPARE( points_layer->name(), QStringLiteral( "Punkte" ) ); + //LAYER NAMES + //lines -> Linien QCOMPARE( lines_layer->name(), QStringLiteral( "Linien" ) ); + //points -> Punkte + QCOMPARE( points_layer->name(), QStringLiteral( "Punkte" ) ); - //check if group name translated + //LAYER GROUPS AND SUBGROUPS + //Points: + //Planes and Roads -> Flugzeuge und Strassen + QVERIFY( QgsProject::instance()->layerTreeRoot()->findGroup( QStringLiteral( "Flugzeuge und Strassen" ) ) ); + //Little bit of nothing -> Bisschen nichts + QVERIFY( QgsProject::instance()->layerTreeRoot()->findGroup( QStringLiteral( "Bisschen nichts" ) ) ); - //check if second group name translated + //FIELDS AND ALIASES + //Lines: + const QgsFields lines_fields = lines_layer->fields(); + //Name (Alias: Runwayid) -> Pistenid + QCOMPARE( lines_fields.field( QStringLiteral( "Name" ) ).alias(), QStringLiteral( "Pistenid" ) ); + //Value (Alias: Name) -> Pistenname + QCOMPARE( lines_fields.field( QStringLiteral( "Value" ) ).alias(), QStringLiteral( "Pistenname" ) ); - //check if first alias value translated + //Points: + const QgsFields points_fields = points_layer->fields(); + //Class (Alias: Level) -> Klasse + QCOMPARE( points_fields.field( QStringLiteral( "Class" ) ).alias(), QStringLiteral( "Klasse" ) ); + //Heading -> Titel + QCOMPARE( points_fields.field( QStringLiteral( "Heading" ) ).alias(), QStringLiteral( "Titel" ) ); + //Importance -> Wichtigkeit + QCOMPARE( points_fields.field( QStringLiteral( "Importance" ) ).alias(), QStringLiteral( "Wichtigkeit" ) ); + //Pilots -> Piloten + QCOMPARE( points_fields.field( QStringLiteral( "Pilots" ) ).alias(), QStringLiteral( "Piloten" ) ); + //Cabin Crew -> Kabinenpersonal + QCOMPARE( points_fields.field( QStringLiteral( "Cabin Crew" ) ).alias(), QStringLiteral( "Kabinenpersonal" ) ); + //Staff -> Mitarbeiter + QCOMPARE( points_fields.field( QStringLiteral( "Staff" ) ).alias(), QStringLiteral( "Mitarbeiter" ) ); - //check if second alias value translated + //FORMCONTAINERS + QList elements = points_layer->editFormConfig().invisibleRootContainer()->children(); + QList containers; + for ( QgsAttributeEditorElement *element : elements ) + { + if ( element->type() == QgsAttributeEditorElement::AeTypeContainer ) + containers.append( dynamic_cast( element ) ); + } - //check if first field name translated to the alias + //Plane -> Flugzeug + QCOMPARE( containers.at( 0 )->name(), QStringLiteral( "Flugzeug" ) ); + //Employees -> Angestellte + QCOMPARE( containers.at( 1 )->name(), QStringLiteral( "Angestellte" ) ); + //Flightattends -> Flugbegleitung + for ( QgsAttributeEditorElement *element : containers.at( 1 )->children() ) + { + if ( element->type() == QgsAttributeEditorElement::AeTypeContainer ) + QCOMPARE( element->name(), QStringLiteral( "Flugbegleitung" ) ); + } - //check if second field name translated to the alias - - //check if first relation name translated - - //check if second relation name translated + //RELATIONS + //Runway -> Piste + QCOMPARE( QgsProject::instance()->relationManager()->relation( QStringLiteral( "points_240_Importance_lines_a677_Value" ) ).name(), QStringLiteral( "Piste" ) ); + //Sheepwalk -> Schafweide + QCOMPARE( QgsProject::instance()->relationManager()->relation( QStringLiteral( "points_240_Importance_lines_a677_Value_1" ) ).name(), QStringLiteral( "Schafweide" ) ); QString deProjectFileName( TEST_DATA_DIR ); deProjectFileName = deProjectFileName + "/project_translation/points_translation_de.qgs"; diff --git a/tests/testdata/project_translation/points_translation.qgs b/tests/testdata/project_translation/points_translation.qgs index 75754ef4834..fb019d83c4e 100644 --- a/tests/testdata/project_translation/points_translation.qgs +++ b/tests/testdata/project_translation/points_translation.qgs @@ -1,5 +1,5 @@ - + @@ -19,29 +19,38 @@ - + - - + + + + + + + + - + points_240d6bd6_9203_470a_994a_aae13cd9fa04 lines_a677672a_bf5d_410d_98c9_d326a5719a1b - + - - + + - - + + + + + - + degrees -119.77777777777767199 @@ -65,20 +74,23 @@ 0 - - - - - - + + + + + + + + + - + -117.62319839219053108 23.20820580488508966 @@ -131,11 +143,11 @@ - true + false - + @@ -154,14 +166,14 @@ - + - - + + - - + + @@ -179,15 +191,15 @@ - - + + @@ -205,9 +217,9 @@ @@ -225,17 +237,17 @@ 0 1 - + - + - + @@ -243,44 +255,50 @@ - - - - + + - - + + - - + + - - + + - + - . @@ -317,7 +335,12 @@ def my_form_open(dialog, layer, feature): - + + + + @@ -326,10 +349,10 @@ def my_form_open(dialog, layer, feature): - Name + Value - + -118.88888888888877204 22.80020703933767834 @@ -386,7 +409,7 @@ def my_form_open(dialog, layer, feature): - + @@ -405,15 +428,15 @@ def my_form_open(dialog, layer, feature): - + - - - + + + - - + + @@ -433,15 +456,15 @@ def my_form_open(dialog, layer, feature): - - + + @@ -461,15 +484,15 @@ def my_form_open(dialog, layer, feature): - - + + @@ -489,9 +512,9 @@ def my_form_open(dialog, layer, feature): @@ -509,17 +532,17 @@ def my_form_open(dialog, layer, feature): 0 1 - + - + - + @@ -527,7 +550,10 @@ def my_form_open(dialog, layer, feature): - @@ -568,51 +594,51 @@ def my_form_open(dialog, layer, feature): - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + - . @@ -639,15 +665,17 @@ def my_form_open(dialog, layer, feature): 0 tablayout - + - + - + + + @@ -681,94 +709,94 @@ def my_form_open(dialog, layer, feature): - - MU - true - 2 - - - - 1 - - - - - - - conditions unknown - - false - - - - - - false - - 16 - true - false - false - 30 - false - true - 0 - 50 - - - - false - - 8 - - - - - - WGS84 - - - - meters - m2 - - - 255 - 255 - 255 - 255 - 0 - 255 - 255 - - false - 90 - - false - false - - false + None + + true + 1 - 1 - - + + + + + false - + + + + 90 + + false + 30 + 16 + true + 0 + false + true + false + 50 + + + false + + 8 + + + + + + 255 + 0 + 255 + 255 + 255 + 255 + 255 + - - + + - None + + + + conditions unknown + + + WGS84 + + false + false + + m2 + meters + + + 1 + + + false + + false + + + true + MU + 2 + + + false + + diff --git a/tests/testdata/project_translation/points_translation_de.qm b/tests/testdata/project_translation/points_translation_de.qm index af36c99323a9656a2f2c099b83c1c1dbce0a606d..6ea4a2c3a1f5ef8728054b276809a40d12556ea3 100644 GIT binary patch delta 689 zcmZ{hL1@%K6o&s~lT8<^yWrMdqyz*J>D4Nt6onSWN|#-*pcI^LX0xN|Bur+ztUa{g zrS+h$p@)LvLBXSfhhBsg3VP6!Uc7qfq2O6O`jRa{5edVa%$xVU|NZl;G$=o=u5AF* z3xLUCUpWI96R3ZF2Nb?w;nWOJJdK;LJ^aAiYeT(qp7!)pSHJF z8-V@7e!93xb#cEgq{L){kACl-!ID!jv+`h388 zT=^>OM6r>gCoziv9r(CMV2bk;T-r!@6dTY`U|DbKn|G?z0w#IvGU>VXka_WcoAgz) zTtzL@uQTnk|IIs5`Rho)%h4nCj_k6Y@cKV$$xCA|`DyMao94JZ$5(ieJS^;vT_>6* zRSHW)O!pirX<4_EdCM)AW|pHM>~Wrnx|&=xFI)@Nax;{g3CY!P@Z=J{>!W6yaOY1hMjqp8kE(J{#l#6x6Vzb?@%SH)5m3Kp_@tZ Yz;i^Y(dInrvfys=-5Pf`sK7Lg-;hA1H~;_u delta 174 zcmdnb|ATXaNL&O1gMByy17kk}tA{BA14BH6m&RfS1}0&KsO85P7?^J|#58XOiXUSr zW;qO`8CVO2gn>YkXd1gIi;zaqnJz?Cs(kDvpVM_78h@}W42