-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project Translation considers descriptions of Value Map Widget #60744
base: master
Are you sure you want to change the base?
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
…rectly in a map instead of maps in a list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
if ( categories.testFlag( Forms ) ) | ||
{ | ||
const QString widgetType = fieldWidgetElement.attribute( QStringLiteral( "type" ) ); | ||
const QDomElement cfgElem = fieldConfigElement.elementsByTagName( QStringLiteral( "config" ) ).at( 0 ).toElement(); | ||
const QDomElement optionsElem = cfgElem.childNodes().at( 0 ).toElement(); | ||
QVariantMap optionsMap = QgsXmlUtils::readVariant( optionsElem ).toMap(); | ||
if ( widgetType == QLatin1String( "ValueRelation" ) ) | ||
// translate widged configuration strings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// translate widged configuration strings | |
// translate widget configuration strings |
for ( int i = 0, row = 0; i < valueList.count(); i++, row++ ) | ||
{ | ||
QMap<QString, QVariant> translatedValueMap; | ||
QString translatedKey = context.projectTranslator()->translate( QStringLiteral( "project:layers:%1:fields:%2:valuemapdescriptions" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text(), fieldName ), valueList[i].toMap().constBegin().key() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so there's a map in the list? and only one entry in this map with key/value?
Value Map descriptions can now be translated as well.
The values are of course the same.
This fixes #56089
Additionally I included missing tests for the Value Relation value translation.
The ts file is committed as well, so the tests can be extended in future with low effort.
This handles only value maps stored as QLists (means after this implementation #6091 and > 3.4)