Hi, I am working on a german windows 2000 workstation and wanted to try out a little application that I have written for our company. I had created translation files and wanted to load them at startup but realised they were not loaded. After putting in debug print statements I found out that the locale returned is "C" -- the fallback default locale -- as opposed to "de" which should be the case since this is a german windows installation. Can anybody tell me what I am doing wrong? May it be a windows 2000 issue?

Qt Code:
  1. #include <QApplication>
  2. #include <QDebug>
  3. #include <QLocale>
  4. #include <QTranslator>
  5. #include "pollmonitor.h"
  6. #include "mainwindow.h"
  7.  
  8. #include <iostream> // DEBUG
  9.  
  10. int main(int argc, char* argv[])
  11. {
  12. QApplication app(argc, argv);
  13. app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
  14.  
  15. // Settings
  16. QCoreApplication::setOrganizationName("MLHB");
  17. QCoreApplication::setOrganizationDomain("mlhb.de");
  18. QCoreApplication::setApplicationName("Hygiene-Befund");
  19.  
  20. // Translations
  21. QString locale = QLocale::system().name();
  22. qDebug() << locale; // DEBUG
  23.  
  24. QTranslator appTranslator;
  25. QTranslator qtTranslator;
  26. QString appTranslation = app.applicationDirPath()
  27. + "/../translations/" + QString("dirmon_" + locale + ".qm");
  28. QString qtTranslation = app.applicationDirPath()
  29. + "/../translations/" + QString("qt_" + locale + ".qm");
  30.  
  31. // Load App Translation file
  32. bool b;
  33. b = appTranslator.load(appTranslation);
  34. if (!b)
  35. qDebug() << app.tr("couldn't load translation file %1").arg(appTranslation).toLatin1();
  36.  
  37. // Load Qt Translation file
  38. b = qtTranslator.load(qtTranslation);
  39. if (!b)
  40. qDebug() << app.tr("couldn't load translation file %1").arg(qtTranslation);
  41.  
  42. app.installTranslator(&appTranslator);
  43. app.installTranslator(&qtTranslator);
  44.  
  45. // Main Window
  46. MainWindow mw;
  47. mw.show();
  48. return app.exec();
  49. }
To copy to clipboard, switch view to plain text mode