--- a/QTfrontend/net/tcpBase.cpp Wed Jan 16 00:01:29 2019 +0100
+++ b/QTfrontend/net/tcpBase.cpp Wed Jan 16 00:37:26 2019 +0100
@@ -21,10 +21,12 @@
#include <QImage>
#include <QThread>
#include <QApplication>
+#include <QProcessEnvironment>
#include "tcpBase.h"
#include "hwconsts.h"
#include "MessageDialog.h"
+#include "gameuiconfig.h"
#ifdef HWLIBRARY
extern "C" {
@@ -104,11 +106,12 @@
}
-TCPBase::TCPBase(bool demoMode, QObject *parent) :
+TCPBase::TCPBase(bool demoMode, bool usesCustomLanguage, QObject *parent) :
QObject(parent),
m_hasStarted(false),
m_isDemoMode(demoMode),
m_connected(false),
+ m_usesCustomLanguage(usesCustomLanguage),
IPCSocket(0)
{
process = 0;
@@ -183,6 +186,18 @@
process->setProcessChannelMode(QProcess::ForwardedChannels);
#endif
+ // If game config uses non-system locale, we set the environment
+ // of the engine first
+ if(m_usesCustomLanguage)
+ {
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ QString hwengineLang = QLocale().name() + ".UTF8";
+ qDebug("Setting hwengine environment: LANG=%s", qPrintable(hwengineLang));
+ // TODO: Check if this is correct and works on all systems
+ env.insert("LANG", QLocale().name() + ".UTF8");
+ process->setProcessEnvironment(env);
+ }
+ qDebug("Starting hwengine ...");
process->start(bindir->absolutePath() + "/hwengine", arguments);
#endif
m_hasStarted = true;