Quantcast
Viewing all articles
Browse latest Browse all 13965

QLocale gets the wrong system locale on Windows 7

Hello, I am trying to get the system locale using the following code: #include “mainwindow.h” #include <QApplication> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QLocale thisLoc = QLocale::system(); QString locale = thisLoc.name(); qDebug() << “locale : “ << locale; qDebug() << “Country : “ << thisLoc.countryToString(thisLoc.country()); MainWindow w; w.show(); return a.exec(); } This is just a standard Qt GUI application created with Qt Creator. I run it on a Japanese Windows 7 box and it always reports en_US for the local name and UnitedStates for the country no matter what I set the actual system local to. locale : “en_US” Country : “UnitedStates” Is this a known bug or do I need to do something special to make it work? BTW. It works as expected on Mac OS X. Thanks.

Viewing all articles
Browse latest Browse all 13965