PDA

View Full Version : QTranslator is not working in autostart!



MisterIKS
21st June 2010, 15:39
Hey everybody,

I'm using translations in my program the following way:

QString locale = QLocale::system().name();
QTranslator translator;
translator.load("Program_" + locale);
app.installTranslator(&translator);

This code appears in main.cpp after creating the QApplication and before executing it. When opening the program at a later point everything works fine, but my program can "start with windows", if the user likes that. In order to make this happen I added a key in registry-key in "HKCU/Software/Microsoft/Windows/CurrentVersion/Run". The program starts as expected, but the translation is missing. I read, that installing the translator in main.cpp is too early, but it works fine starting the program manually some seconds after windows started.

Maybe it actually is too early to install the translation in autostart, but I can't figure out why, even installing the language directly is not showing any effect:

translator.load("Program_de");
app.installTranslator(&translator);

It this a bug in Qt or is it really to early in autostart? Why? If it's too early , how can I install the translation at a later point?

Thanks alot for your help,

MisterIKS

MisterIKS
25th June 2010, 23:49
This morning I installed Qt Creator 2.0 on my computer, and after building the first time with it there was no translation at all anymore, not even when starting the program manually.

I can't fix any of these problems, because I don't even know why it's not working. So if you have any general hint or tip on why translations may not work as expected, I'd be greatful!

MisterIKS
27th June 2010, 08:36
It's not right, that the translation does not work at all, it does not when I'm in debugging-mode in QtCreator, running the exe directly still shows the translation!