Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

signedav
Copy link
Contributor

@signedav signedav commented Feb 25, 2025

Value Map descriptions can now be translated as well.

This loaded with EN settings ...becomes this loaded with DE settings
image image

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)

@github-actions github-actions bot added this to the 3.44.0 milestone Feb 25, 2025
Copy link

github-actions bot commented Feb 25, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 529d85b)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 529d85b)

@signedav signedav closed this Feb 25, 2025
@signedav signedav reopened this Feb 25, 2025
Copy link
Member

@3nids 3nids left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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() );
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Value maps definition in attribute widget are not translated
2 participants