Skip to content

Commit 1bccedd

Browse files
committedAug 7, 2018
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.
1 parent 628292b commit 1bccedd

File tree

11 files changed

+390
-361
lines changed

11 files changed

+390
-361
lines changed
 

‎python/core/auto_generated/qgseditformconfig.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Write XML information
264264
Serialize on project save
265265
%End
266266

267-
QgsAttributeEditorElement *attributeEditorElementFromDomElement( QDomElement &elem, QgsAttributeEditorElement *parent, const QString &layerId = 0 );
267+
QgsAttributeEditorElement *attributeEditorElementFromDomElement( QDomElement &elem, QgsAttributeEditorElement *parent );
268268
%Docstring
269269
Deserialize drag and drop designer elements.
270270
%End

‎python/core/auto_generated/qgsproject.sip.in

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ Returns last modified time of the project file as returned by the file system (o
135135
Returns full absolute path to the project file if the project is stored in a file system - derived from fileName().
136136
Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages).
137137

138-
.. versionadded:: 3.2
139-
%End
140-
141-
QString absolutePath() const;
142-
%Docstring
143-
Returns full absolute path to the project folder if the project is stored in a file system - derived from fileName().
144-
Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages).
145-
146138
.. versionadded:: 3.2
147139
%End
148140

@@ -991,25 +983,6 @@ and it is mainly a hint for the user interface to protect users from removing la
991983
in the project. The removeMapLayer(), removeMapLayers() calls do not block removal of layers listed here.
992984

993985
.. versionadded:: 3.2
994-
%End
995-
996-
void generateTsFile( const QString &locale );
997-
%Docstring
998-
Triggers the collection strings of .qgs to be included in ts file and calls writeTsFile()
999-
1000-
.. versionadded:: 3.2
1001-
%End
1002-
1003-
QString translate( const QString &context, const QString &sourceText, const char *disambiguation = 0, int n = -1 );
1004-
%Docstring
1005-
Translates the project with QTranslator and qm file
1006-
1007-
:return: the result string (in case there is no QTranslator loaded the sourceText)
1008-
1009-
:param context: describing layer etc.
1010-
:param sourceText: is the identifier of this text
1011-
:param disambiguation: it's the disambiguation
1012-
:param n: if -1 uses the appropriate form
1013986
%End
1014987

1015988
signals:
@@ -1362,16 +1335,6 @@ home path will be automatically determined from the project's file path.
13621335
.. seealso:: :py:func:`homePathChanged`
13631336

13641337
.. versionadded:: 3.2
1365-
%End
1366-
1367-
void registerTranslatableObjects( QgsTranslationContext *translationContext );
1368-
%Docstring
1369-
Registers the translatable objects into the tranlationContext
1370-
so there can be created a ts file these values
1371-
1372-
.. versionadded:: 3.2
1373-
1374-
:param translationContext: where the objects will be registered
13751338
%End
13761339

13771340
};

‎python/core/auto_generated/qgstranslationcontext.sip.in

Lines changed: 0 additions & 79 deletions
This file was deleted.

‎src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5950,10 +5950,10 @@ void QgisApp::fileSaveAs()
59505950
return;
59515951

59525952
QFileInfo fullPath( path );
5953+
59535954
settings.setValue( QStringLiteral( "UI/lastProjectDir" ), fullPath.path() );
59545955

59555956
if ( filter == zipExt )
5956-
59575957
{
59585958
if ( fullPath.suffix().compare( QLatin1String( "qgz" ), Qt::CaseInsensitive ) != 0 )
59595959
fullPath.setFile( fullPath.filePath() + ".qgz" );

‎src/app/qgsprojectproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
850850
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l );
851851
}
852852
cbtsLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( QStringLiteral( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
853-
cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings->value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) );
853+
cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) );
854854

855855
connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::generateTsFileButton_clicked );
856856

‎src/core/qgsproject.cpp

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "qgsrectangle.h"
3838
#include "qgsrelationmanager.h"
3939
#include "qgsannotationmanager.h"
40-
#include "qgsvectorlayer.h"
4140
#include "qgsvectorlayerjoininfo.h"
4241
#include "qgsmapthemecollection.h"
4342
#include "qgslayerdefinition.h"
@@ -367,9 +366,6 @@ QgsProject::QgsProject( QObject *parent )
367366
connect( mLayerStore.get(), &QgsMapLayerStore::layersAdded, this, &QgsProject::layersAdded );
368367
connect( mLayerStore.get(), &QgsMapLayerStore::layerWasAdded, this, &QgsProject::layerWasAdded );
369368
connect( QgsApplication::instance(), &QgsApplication::requestForTranslatableObjects, this, &QgsProject::registerTranslatableObjects );
370-
371-
mTranslator = new QTranslator();
372-
373369
}
374370

375371

@@ -445,6 +441,24 @@ void QgsProject::setPresetHomePath( const QString &path )
445441
setDirty( true );
446442
}
447443

444+
void QgsProject::registerTranslatableContainers( QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId )
445+
{
446+
QList<QgsAttributeEditorElement *> elements = parent->children();
447+
448+
for ( QgsAttributeEditorElement *element : elements )
449+
{
450+
if ( element->type() == QgsAttributeEditorElement::AeTypeContainer )
451+
{
452+
QgsAttributeEditorContainer *container = dynamic_cast<QgsAttributeEditorContainer *>( element );
453+
454+
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:formcontainers" ).arg( layerId ), container->name() );
455+
456+
if ( container->children().size() > 0 )
457+
registerTranslatableContainers( translationContext, container, layerId );
458+
}
459+
}
460+
}
461+
448462
void QgsProject::registerTranslatableObjects( QgsTranslationContext *translationContext )
449463
{
450464
//register layers
@@ -457,6 +471,7 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation
457471
{
458472
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mapLayer );
459473

474+
//register aliases and fields
460475
const QgsFields fields = vlayer->fields();
461476
for ( const QgsField &field : fields )
462477
{
@@ -465,6 +480,10 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation
465480
else
466481
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( vlayer->id() ), field.alias() );
467482
}
483+
484+
//register formcontainers
485+
registerTranslatableContainers( translationContext, vlayer->editFormConfig().invisibleRootContainer(), vlayer->id() );
486+
468487
}
469488
}
470489

@@ -931,10 +950,6 @@ bool QgsProject::read()
931950
QString filename = mFile.fileName();
932951
bool rc;
933952

934-
//dave dirty hack
935-
delete mTranslator;
936-
mTranslator = new QTranslator();
937-
938953
if ( QgsProjectStorage *storage = projectStorage() )
939954
{
940955
QTemporaryFile inDevice;
@@ -969,10 +984,15 @@ bool QgsProject::read()
969984
}
970985

971986
//on translation we should not change the filename back
972-
if ( mTranslator->isEmpty() )
987+
if ( !mTranslator )
973988
{
974989
mFile.setFileName( filename );
975990
}
991+
else
992+
{
993+
//but delete the translator
994+
delete mTranslator;
995+
}
976996

977997
return rc;
978998
}
@@ -988,6 +1008,7 @@ bool QgsProject::readProjectFile( const QString &filename )
9881008

9891009
if ( QFile( QStringLiteral( "%1/%2.qm" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ).exists() )
9901010
{
1011+
mTranslator = new QTranslator();
9911012
if ( mTranslator->load( localeFileName, QFileInfo( projectFile.fileName() ).absolutePath() ) )
9921013
{
9931014
QgsDebugMsg( "Translation loaded" );
@@ -1290,7 +1311,7 @@ bool QgsProject::readProjectFile( const QString &filename )
12901311

12911312
emit nonIdentifiableLayersChanged( nonIdentifiableLayers() );
12921313

1293-
if ( !mTranslator->isEmpty() )
1314+
if ( mTranslator )
12941315
{
12951316
//project possibly translated -> rename it with locale postfix
12961317
QString newFileName( QStringLiteral( "%1/%2.qgs" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) );
@@ -2800,7 +2821,7 @@ void QgsProject::generateTsFile( const QString &locale )
28002821

28012822
QString QgsProject::translate( const QString &context, const QString &sourceText, const char *disambiguation, int n )
28022823
{
2803-
if ( mTranslator->isEmpty() )
2824+
if ( !mTranslator )
28042825
{
28052826
return sourceText;
28062827
}

‎src/core/qgsproject.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "qgsreadwritecontext.h"
4747
#include "qgsprojectmetadata.h"
4848
#include "qgstranslationcontext.h"
49+
#include "qgsvectorlayer.h"
4950

5051
class QFileInfo;
5152
class QDomDocument;
@@ -97,7 +98,6 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
9798
Q_PROPERTY( QgsRelationManager *relationManager READ relationManager )
9899
Q_PROPERTY( QList<QgsVectorLayer *> avoidIntersectionsLayers READ avoidIntersectionsLayers WRITE setAvoidIntersectionsLayers NOTIFY avoidIntersectionsLayersChanged )
99100
Q_PROPERTY( QgsProjectMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
100-
//dave to do Q_PROPERTY( QTranslator translator READ translator )
101101

102102
public:
103103
//! Returns the QgsProject singleton instance
@@ -1296,6 +1296,16 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
12961296
*/
12971297
void setPresetHomePath( const QString &path );
12981298

1299+
/**
1300+
* Registers the translatable containers into the tranlationContext
1301+
* this is a rekursive function to get all the child containers
1302+
* \since QGIS 3.2
1303+
*
1304+
* \param translationContext where the objects will be registered
1305+
* \param parent parent-container containing list of children
1306+
*/
1307+
void registerTranslatableContainers( QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId );
1308+
12991309
/**
13001310
* Registers the translatable objects into the tranlationContext
13011311
* so there can be created a ts file these values

‎src/core/qgsvectorlayer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,15 +1907,15 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
19071907
if ( !aliasElem.attribute( QStringLiteral( "name" ) ).isEmpty() )
19081908
{
19091909
//if it has alias
1910-
alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ), aliasElem.attribute( QStringLiteral( "name" ) ) );
1911-
QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ) + " source " + aliasElem.attribute( QStringLiteral( "name" ) ), 1 );
1910+
alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ), aliasElem.attribute( QStringLiteral( "name" ) ) );
1911+
QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ) + " source " + aliasElem.attribute( QStringLiteral( "name" ) ), 1 );
19121912
}
19131913
else
19141914
{
1915-
//if it has no alias, but alias is should be the fields translation
1916-
alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ), aliasElem.attribute( QStringLiteral( "name" ) ) );
1917-
QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( this->name() ) + " source " + field, 1 );
1918-
//if it gets the exact field value, there has been no translation (no translation loaded);
1915+
//if it has no alias, it should be the fields translation
1916+
alias = QgsProject::instance()->translate( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ), field );
1917+
QgsDebugMsgLevel( "context" + QStringLiteral( "project:layers:%1:fieldaliases" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text() ) + " source " + field, 1 );
1918+
//if it gets the exact field value, there has been no translation (or not even translation loaded) - so no alias should be generated;
19191919
if ( alias == aliasElem.attribute( QStringLiteral( "field" ) ) )
19201920
alias.clear();
19211921
}

‎tests/src/core/testqgstranslateproject.cpp

Lines changed: 126 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include "qgssettings.h"
2525
#include <qgsmaplayer.h>
2626
#include <qgsvectorlayer.h>
27+
#include <qgslayertree.h>
28+
#include <qgslayertreegroup.h>
29+
#include "qgsrelationmanager.h"
2730

2831
class TestQgsTranslateProject : public QObject
2932
{
@@ -48,12 +51,11 @@ class TestQgsTranslateProject : public QObject
4851

4952
void TestQgsTranslateProject::initTestCase()
5053
{
51-
//start application in german
54+
//start application
5255
QgsApplication::init();
5356
QgsApplication::initQgis();
5457

5558
original_locale = settings.value( QStringLiteral( "locale/userLocale" ), "" ).toString() ;
56-
settings.setValue( QStringLiteral( "locale/userLocale" ), "de" );
5759
}
5860

5961
void TestQgsTranslateProject::cleanupTestCase()
@@ -76,10 +78,7 @@ void TestQgsTranslateProject::cleanupTestCase()
7678

7779
void TestQgsTranslateProject::init()
7880
{
79-
//open project
80-
QString projectFileName( TEST_DATA_DIR );
81-
projectFileName = projectFileName + "/project_translation/points_translation.qgs";
82-
QgsProject::instance()->read( projectFileName );
81+
//not needed
8382
}
8483

8584
void TestQgsTranslateProject::cleanup()
@@ -89,62 +88,149 @@ void TestQgsTranslateProject::cleanup()
8988

9089
void TestQgsTranslateProject::createTsFile()
9190
{
92-
//the base is points_translation_de.qgs and with german values
93-
//then we generate a ts file for spanish and the ts file with additional es postfix is created
91+
//open project in english
92+
settings.setValue( QStringLiteral( "locale/userLocale" ), "en" );
93+
QString projectFileName( TEST_DATA_DIR );
94+
projectFileName = projectFileName + "/project_translation/points_translation.qgs";
95+
QgsProject::instance()->read( projectFileName );
9496

95-
//create ts-file
96-
QgsProject::instance()->generateTsFile( "es" );
97+
//create ts file for german
98+
QgsProject::instance()->generateTsFile( "de" );
9799

98-
//check if tsfile is created
100+
//check if ts file is created
99101
QString tsFileName( TEST_DATA_DIR );
100-
tsFileName = tsFileName + "/project_translation/points_translation_de_es.ts";
102+
tsFileName = tsFileName + "/project_translation/points_translation_de.ts";
101103
QFile tsFile( tsFileName );
102104
QVERIFY( tsFile.exists() );
103105

104106
tsFile.open( QIODevice::ReadWrite );
105107

106108
QString tsFileContent( tsFile.readAll() );
107109

108-
//check if tsFile contains layer name Punkte
109-
QVERIFY( tsFileContent.contains( "<source>Punkte</source>" ) );
110-
111-
//check if tsFile contains layer group name
112-
113-
//check if tsFile contains alias value
114-
115-
//check if tsFile contains field name
116-
// QVERIFY( tsFileContent.contains( "<source>klaso</source>" ) );
117-
118-
//check if tsFile contains relation name
110+
//LAYER NAMES
111+
//lines
112+
QVERIFY( tsFileContent.contains( "<source>lines</source>" ) );
113+
//points
114+
QVERIFY( tsFileContent.contains( "<source>points</source>" ) );
115+
116+
//LAYER GROUPS AND SUBGROUPS
117+
//Points:
118+
//Planes and Roads
119+
QVERIFY( tsFileContent.contains( "<source>Planes and Roads</source>" ) );
120+
//Little bit of nothing
121+
QVERIFY( tsFileContent.contains( "<source>Little bit of nothing</source>" ) );
122+
123+
//FIELDS AND ALIASES
124+
//Lines:
125+
//Name (Alias: Runwayid)
126+
QVERIFY( tsFileContent.contains( "<source>Runwayid</source>" ) );
127+
//Value (Alias: Name)
128+
QVERIFY( tsFileContent.contains( "<source>Name</source>" ) );
129+
130+
//Points:
131+
//Class (Alias: Level)
132+
QVERIFY( tsFileContent.contains( "<source>Level</source>" ) );
133+
//Heading
134+
QVERIFY( tsFileContent.contains( "<source>Heading</source>" ) );
135+
//Importance
136+
QVERIFY( tsFileContent.contains( "<source>Importance</source>" ) );
137+
//Pilots
138+
QVERIFY( tsFileContent.contains( "<source>Pilots</source>" ) );
139+
//Cabin Crew
140+
QVERIFY( tsFileContent.contains( "<source>Cabin Crew</source>" ) );
141+
//Staff
142+
QVERIFY( tsFileContent.contains( "<source>Staff</source>" ) );
143+
144+
//FORMCONTAINERS
145+
//Plane
146+
QVERIFY( tsFileContent.contains( "<source>Plane</source>" ) );
147+
//Employees
148+
QVERIFY( tsFileContent.contains( "<source>Employees</source>" ) );
149+
//Flightattends
150+
QVERIFY( tsFileContent.contains( "<source>Flightattends</source>" ) );
151+
152+
//RELATIONS
153+
//Runway
154+
QVERIFY( tsFileContent.contains( "<source>Runway</source>" ) );
155+
//Sheepwalk
156+
QVERIFY( tsFileContent.contains( "<source>Sheepwalk</source>" ) );
119157

120158
tsFile.close();
121159
}
122160

123161
void TestQgsTranslateProject::translateProject()
124162
{
163+
//open project in german
164+
settings.setValue( QStringLiteral( "locale/userLocale" ), "de" );
165+
QString projectFileName( TEST_DATA_DIR );
166+
projectFileName = projectFileName + "/project_translation/points_translation.qgs";
167+
QgsProject::instance()->read( projectFileName );
168+
125169
//with the qm file containing translation from en to de, the project should be in german and renamed with postfix .de
126170
QgsVectorLayer *points_layer = qobject_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( "points_240d6bd6_9203_470a_994a_aae13cd9fa04" ) );
127171
QgsVectorLayer *lines_layer = qobject_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( "lines_a677672a_bf5d_410d_98c9_d326a5719a1b" ) );
128172

129-
//check if layer names translated
130-
QCOMPARE( points_layer->name(), QStringLiteral( "Punkte" ) );
173+
//LAYER NAMES
174+
//lines -> Linien
131175
QCOMPARE( lines_layer->name(), QStringLiteral( "Linien" ) );
176+
//points -> Punkte
177+
QCOMPARE( points_layer->name(), QStringLiteral( "Punkte" ) );
132178

133-
//check if group name translated
134-
135-
//check if second group name translated
136-
137-
//check if first alias value translated
138-
139-
//check if second alias value translated
140-
141-
//check if first field name translated to the alias
142-
143-
//check if second field name translated to the alias
144-
145-
//check if first relation name translated
146-
147-
//check if second relation name translated
179+
//LAYER GROUPS AND SUBGROUPS
180+
//Points:
181+
//Planes and Roads -> Flugzeuge und Strassen
182+
QVERIFY( QgsProject::instance()->layerTreeRoot()->findGroup( QStringLiteral( "Flugzeuge und Strassen" ) ) );
183+
//Little bit of nothing -> Bisschen nichts
184+
QVERIFY( QgsProject::instance()->layerTreeRoot()->findGroup( QStringLiteral( "Bisschen nichts" ) ) );
185+
186+
//FIELDS AND ALIASES
187+
//Lines:
188+
const QgsFields lines_fields = lines_layer->fields();
189+
//Name (Alias: Runwayid) -> Pistenid
190+
QCOMPARE( lines_fields.field( QStringLiteral( "Name" ) ).alias(), QStringLiteral( "Pistenid" ) );
191+
//Value (Alias: Name) -> Pistenname
192+
QCOMPARE( lines_fields.field( QStringLiteral( "Value" ) ).alias(), QStringLiteral( "Pistenname" ) );
193+
194+
//Points:
195+
const QgsFields points_fields = points_layer->fields();
196+
//Class (Alias: Level) -> Klasse
197+
QCOMPARE( points_fields.field( QStringLiteral( "Class" ) ).alias(), QStringLiteral( "Klasse" ) );
198+
//Heading -> Titel
199+
QCOMPARE( points_fields.field( QStringLiteral( "Heading" ) ).alias(), QStringLiteral( "Titel" ) );
200+
//Importance -> Wichtigkeit
201+
QCOMPARE( points_fields.field( QStringLiteral( "Importance" ) ).alias(), QStringLiteral( "Wichtigkeit" ) );
202+
//Pilots -> Piloten
203+
QCOMPARE( points_fields.field( QStringLiteral( "Pilots" ) ).alias(), QStringLiteral( "Piloten" ) );
204+
//Cabin Crew -> Kabinenpersonal
205+
QCOMPARE( points_fields.field( QStringLiteral( "Cabin Crew" ) ).alias(), QStringLiteral( "Kabinenpersonal" ) );
206+
//Staff -> Mitarbeiter
207+
QCOMPARE( points_fields.field( QStringLiteral( "Staff" ) ).alias(), QStringLiteral( "Mitarbeiter" ) );
208+
209+
//FORMCONTAINERS
210+
QList<QgsAttributeEditorElement *> elements = points_layer->editFormConfig().invisibleRootContainer()->children();
211+
QList<QgsAttributeEditorContainer *> containers;
212+
for ( QgsAttributeEditorElement *element : elements )
213+
{
214+
if ( element->type() == QgsAttributeEditorElement::AeTypeContainer )
215+
containers.append( dynamic_cast<QgsAttributeEditorContainer *>( element ) );
216+
}
217+
218+
//Plane -> Flugzeug
219+
QCOMPARE( containers.at( 0 )->name(), QStringLiteral( "Flugzeug" ) );
220+
//Employees -> Angestellte
221+
QCOMPARE( containers.at( 1 )->name(), QStringLiteral( "Angestellte" ) );
222+
//Flightattends -> Flugbegleitung
223+
for ( QgsAttributeEditorElement *element : containers.at( 1 )->children() )
224+
{
225+
if ( element->type() == QgsAttributeEditorElement::AeTypeContainer )
226+
QCOMPARE( element->name(), QStringLiteral( "Flugbegleitung" ) );
227+
}
228+
229+
//RELATIONS
230+
//Runway -> Piste
231+
QCOMPARE( QgsProject::instance()->relationManager()->relation( QStringLiteral( "points_240_Importance_lines_a677_Value" ) ).name(), QStringLiteral( "Piste" ) );
232+
//Sheepwalk -> Schafweide
233+
QCOMPARE( QgsProject::instance()->relationManager()->relation( QStringLiteral( "points_240_Importance_lines_a677_Value_1" ) ).name(), QStringLiteral( "Schafweide" ) );
148234

149235
QString deProjectFileName( TEST_DATA_DIR );
150236
deProjectFileName = deProjectFileName + "/project_translation/points_translation_de.qgs";

‎tests/testdata/project_translation/points_translation.qgs

Lines changed: 212 additions & 184 deletions
Large diffs are not rendered by default.
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.