Skip to content

Commit 80c3a87

Browse files
committed
Implement /etc/locale.conf support
Resolves #460, fixes #365 and fixes #364
1 parent ba87491 commit 80c3a87

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/auth/Auth.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,22 @@ namespace SDDM {
113113
, id(lastId++) {
114114
SocketServer::instance()->helpers[id] = this;
115115
QProcessEnvironment env = child->processEnvironment();
116-
env.insert("LANG", "C");
116+
bool langEmpty = true;
117+
QFile localeFile("/etc/locale.conf");
118+
if (localeFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
119+
QTextStream in(&localeFile);
120+
while (!in.atEnd()) {
121+
QStringList parts = in.readLine().split('=');
122+
if (parts.size() >= 2) {
123+
env.insert(parts[0], parts[1]);
124+
if (parts[0] == QStringLiteral("LANG"))
125+
langEmpty = false;
126+
}
127+
}
128+
localeFile.close();
129+
}
130+
if (langEmpty)
131+
env.insert("LANG", "C");
117132
child->setProcessEnvironment(env);
118133
connect(child, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(childExited(int,QProcess::ExitStatus)));
119134
connect(child, SIGNAL(error(QProcess::ProcessError)), this, SLOT(childError(QProcess::ProcessError)));

0 commit comments

Comments
 (0)