Skip to content

Commit

Permalink
fix: Using linux-pam to provide translation
Browse files Browse the repository at this point in the history
Change-Id: I54d501ee78201d3a79b6dd29226fe2e6a58079af
  • Loading branch information
justforlxz committed Jan 16, 2018
1 parent 48e6550 commit f82c13e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion AuthDialog.cpp
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@
#include <PolkitQt1/Authority>
#include <PolkitQt1/Details>

#include <libintl.h>

#include "usersmanager.h"

AuthDialog::AuthDialog(const QString &actionId,
@@ -55,6 +57,8 @@ AuthDialog::AuthDialog(const QString &actionId,
// TODO: associate this dialog with its parent.
setupUI();

setlocale(LC_ALL, "");

// find action description for actionId
foreach(const PolkitQt1::ActionDescription &desc, PolkitQt1::Authority::instance()->enumerateActionsSync()) {
if (actionId == desc.actionId()) {
@@ -95,7 +99,14 @@ void AuthDialog::setRequest(const QString &request, bool requiresAdmin)
{
Q_UNUSED(requiresAdmin)

m_passwordInput->setPlaceholderText(request);
// NOTE: Here needs to be processed for a character ending with a colon.

QString placeHolder;
if (!request.isEmpty() && QString(request.at(request.size() - 1)) == QString(":")) {
placeHolder = request + " ";
}

m_passwordInput->setPlaceholderText(QString(dgettext("Linux-PAM", placeHolder.toLatin1())));
}

void AuthDialog::setOptions()

0 comments on commit f82c13e

Please sign in to comment.