Loading translations in a Qt application
In the previous section, we created translation files and understood the uses of the tools. To look up translations in a TS file, QTranslator functions are used. The translator must be instantiated before the application's GUI objects.
Let's have a look at how to load these translation files using QTranslator in the following code snippet:
QTranslator translator;
if(translator.load(QLocale(),QLatin1String("MyApplication")
, QLatin1String("_"), QLatin1String(":/i18n")))
{
application.installTranslator(&translator);
}
else
{
qDebug() << "Failed to load. "
...