Skip to content

Commit

Permalink
Make OAuth2 HTML brower page translatable
Browse files Browse the repository at this point in the history
Currently the HTML page returned after logging in to the authentication
server is hardcoded in English. Let's make it translatable.

Funded by Régie de Gestion des Données Savoie Mont Blanc (rgd.fr)
  • Loading branch information
rouault authored and nyalldawson committed Oct 16, 2024
1 parent 047cab1 commit a4e9b24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/auth/oauth2/core/qgso2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ void QgsO2::setVerificationResponseContent()
QFile verhtml( QStringLiteral( ":/oauth2method/oauth2_verification_finished.html" ) );
if ( verhtml.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
setReplyContent( verhtml.readAll() );
setReplyContent( QString::fromUtf8( verhtml.readAll() )
.replace( QStringLiteral( "{{ H2_TITLE }}" ), tr( "QGIS OAuth2 verification has finished" ) )
.replace( QStringLiteral( "{{ H3_TITLE }}" ), tr( "If you have not been returned to QGIS, bring the application to the forefront." ) )
.replace( QStringLiteral( "{{ CLOSE_WINDOW }}" ), tr( "Close window" ) ).toUtf8()
);
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/auth/oauth2/resources/oauth2_verification_finished.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
</head>
<body>

<h2>QGIS OAuth2 verification has finished</h2>
<!-- Replacement of below placeholders is done by src/auth/oauth2/core/qgso2.cpp -->

<h3>If you have not been returned to QGIS, bring the application to the forefront.</h3>
<h2>{{ H2_TITLE }}</h2>

<p><a href="#" onclick="window.close()">Close window</a></p>
<h3>{{ H3_TITLE }}</h3>

<p><a href="#" onclick="window.close()">{{ CLOSE_WINDOW }}</a></p>

</body>
</html>

0 comments on commit a4e9b24

Please sign in to comment.