Hi:
I'm trying my hand at a little internationalization and I wanted to start with a simple app and two languages: english and spanish. I managed to succesfully load the spanish packet and saw everything in my application as it should. Next I wanted to implement a bit of code so that the user could choose the language at the program startup since changing it on the fly is apparently pretty complicated. Since I only had two options I tried this in main.cpp.
int main(int argc, char *argv[])
{
LanguageDialog diag; \\
diag.exec(); \\
if (diag.shouldTranslate()){\\
translator.
load(QString("mastermind_es"));
a.installTranslator(&translator);
}\\
Mastermind w;
w.show();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
LanguageDialog diag; \\
diag.exec(); \\
if (diag.shouldTranslate()){\\
QTranslator translator;
translator.load(QString("mastermind_es"));
a.installTranslator(&translator);
}\\
Mastermind w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
And it doesn't work. Nothing gets translated no matter what I choose and I've allready checked, I effectively enter the if sentence in spanish is chosen in the diag object.
If the lines with a \\ are commented then I get my app translated (everytime) obviously.
Can anyone tell me what I'm doing wrong?
Thanks for any help in advance.
Bookmarks