From 4253d384b6e5034686baf919a8a9ad4987f5f16a Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 9 Nov 2024 17:50:06 +0700 Subject: [PATCH] Fix untranslatable authentication string, use service name when host is missing --- src/core/qfieldappauthrequesthandler.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/qfieldappauthrequesthandler.cpp b/src/core/qfieldappauthrequesthandler.cpp index 6fa4757dc2..d453237e40 100644 --- a/src/core/qfieldappauthrequesthandler.cpp +++ b/src/core/qfieldappauthrequesthandler.cpp @@ -223,5 +223,14 @@ QString QFieldAppAuthRequestHandler::getCredentialTitle( const QString &realm ) if ( uri.database().isEmpty() ) return realm; - return "Please enter credentials for database " + uri.database() + " at host " + uri.host() + "."; + QString title = tr( "Please enter credentials for database" ) + QStringLiteral( " %1 " ).arg( uri.database() ); + if ( !uri.host().isEmpty() ) + { + title += tr( "at host" ) + QStringLiteral( " %1 " ).arg( uri.host() ); + } + else if ( !uri.service().isEmpty() ) + { + title += tr( "at service" ) + QStringLiteral( " %1 " ).arg( uri.service() ); + } + return title; }