You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
screengrab-packaging/cmake/Qt5TranslationLoader.cpp.in

34 lines
1.0 KiB

/* This file has been generated by the CMake qt_translation_loader().
* It loads Qt application translations.
*
* Attention: All changes will be overwritten!!!
*/
#include <QCoreApplication>
#include <QLocale>
#include <QTranslator>
#include <QLibraryInfo>
static void loadQtTranslation()
{
QString locale = QLocale::system().name();
QTranslator *qtTranslator = new QTranslator(qApp);
if (qtTranslator->load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
qApp->installTranslator(qtTranslator);
} else {
delete qtTranslator;
}
QTranslator *appTranslator = new QTranslator(qApp);
if (appTranslator->load(QString("@translations_dir@/@catalog_name@_%1.qm").arg(locale))) {
QCoreApplication::installTranslator(appTranslator);
} else if (locale == QLatin1String("C") ||
locale.startsWith(QLatin1String("en"))) {
// English is the default. It's translated anyway.
delete appTranslator;
}
}
Q_COREAPP_STARTUP_FUNCTION(loadQtTranslation)