liblxqt-packaging/cmake/modules/Qt5TranslationLoader.cpp.in
Andrew Lee (李健秋) c9e09e4533
Adding upstream version 0.9.0.
Signed-off-by: Andrew Lee (李健秋) <ajqlee@debian.org>
2015-08-12 05:33:06 +08:00

34 lines
1.0 KiB
C++

/* 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)